Skip to content

fix(ui): populate issuer field when editing OAuth gateway - #3756

Merged
crivetimihai merged 3 commits into
IBM:mainfrom
kimsehwan96:fix/gateway-edit-oauth-issuer-populate
Mar 22, 2026
Merged

crivetimihai merged 3 commits into
IBM:mainfrom
kimsehwan96:fix/gateway-edit-oauth-issuer-populate

Conversation

@kimsehwan96

Copy link
Copy Markdown
Contributor

🔗 Related Issue

Closes #3755


📝 Summary

The editGateway() function populates all OAuth config fields (client_id, token_url, authorization_url, redirect_uri, scopes) but omits the issuer field. This causes the issuer to be silently dropped when saving, breaking OAuth flows that depend on it.


🏷️ Type of Change

  • Bug fix
  • Feature / Enhancement
  • Documentation
  • Refactor
  • Chore (deps, CI, tooling)
  • Other (describe below)

🧪 Verification

Check Command Status
Lint suite make lint pass
Unit tests make test
Coverage ≥ 80% make coverage

✅ Checklist

  • Code formatted (make black isort pre-commit)
  • Tests added/updated for changes
  • Documentation updated (if applicable)
  • No secrets or credentials committed

📓 Notes (optional)

@crivetimihai crivetimihai added bug Something isn't working SHOULD P2: Important but not vital; high-value items that are not crucial for the immediate release ui User Interface security Improves security labels Mar 20, 2026
@crivetimihai crivetimihai added this to the Release 1.0.0 milestone Mar 20, 2026
@crivetimihai

Copy link
Copy Markdown
Member

Thanks @kimsehwan96. Clean fix — correctly addresses #3755 by populating the missing issuer field in editGateway(). One note: no tests were added. Since this is a UI form population fix, a Playwright regression test would be ideal but not blocking. LGTM for merge once CI passes.

kimsehwan96 and others added 3 commits March 22, 2026 01:43
The editGateway() function populates all OAuth config fields
(client_id, token_url, authorization_url, redirect_uri, scopes)
but omits the issuer field. This causes the issuer to be silently
dropped when saving, breaking OAuth flows that depend on it.

Signed-off-by: kimsehwan96 <[email protected]>
…t coverage

Apply the same issuer field fix to the editA2AAgent function that was
missing the same population logic. Add id="oauth-issuer-a2a-edit" to
the A2A edit modal HTML template.

Strengthen OAuth form-field assembly tests to verify all fields
(issuer, token_url, authorization_url, redirect_uri, client_id)
round-trip through edit for both gateways and A2A agents.

Signed-off-by: Mihai Criveti <[email protected]>
All OAuth field population guards used `if (field && config.value)`
which only sets the field when the value is truthy. When reusing the
edit modal for a different entity that lacks a particular OAuth field,
the previous value would persist and be silently resubmitted on save.

Change all OAuth field assignments to unconditionally set the value
with a fallback to empty string (e.g. `config.issuer || ""`), matching
the pattern already used by oauthClientSecretField.

Signed-off-by: Mihai Criveti <[email protected]>
@crivetimihai
crivetimihai force-pushed the fix/gateway-edit-oauth-issuer-populate branch from c445243 to 75cebda Compare March 22, 2026 08:50

@crivetimihai crivetimihai left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — the missing issuer field population was causing it to be silently dropped on save, breaking OAuth flows that depend on it (e.g. DCR).

I rebased onto main and added two follow-up commits on top of yours:

  1. A2A agent same-bug fix + tests — the editA2AAgent() function had the identical omission. Added id="oauth-issuer-a2a-edit" to the HTML template and the corresponding JS population. Strengthened existing backend tests to verify all OAuth fields (issuer, token_url, authorization_url, redirect_uri, client_id) round-trip through form assembly for both gateways and A2A agents.

  2. Stale field value fix — all OAuth field guards used if (field && config.value) which only sets the field when truthy. When reusing the edit modal for an entity without a particular field, the old value would persist. Changed all assignments to config.value || "" so fields are always cleared.

@crivetimihai crivetimihai self-assigned this Mar 22, 2026
@crivetimihai
crivetimihai merged commit 3a10c29 into IBM:main Mar 22, 2026
1 check passed
msureshkumar88 pushed a commit that referenced this pull request May 13, 2026
* fix(ui): populate issuer field when editing OAuth gateway

The editGateway() function populates all OAuth config fields
(client_id, token_url, authorization_url, redirect_uri, scopes)
but omits the issuer field. This causes the issuer to be silently
dropped when saving, breaking OAuth flows that depend on it.

Signed-off-by: kimsehwan96 <[email protected]>

* fix(ui): populate issuer field when editing OAuth A2A agent + add test coverage

Apply the same issuer field fix to the editA2AAgent function that was
missing the same population logic. Add id="oauth-issuer-a2a-edit" to
the A2A edit modal HTML template.

Strengthen OAuth form-field assembly tests to verify all fields
(issuer, token_url, authorization_url, redirect_uri, client_id)
round-trip through edit for both gateways and A2A agents.

Signed-off-by: Mihai Criveti <[email protected]>

* fix(ui): clear stale OAuth fields when editing gateways and A2A agents

All OAuth field population guards used `if (field && config.value)`
which only sets the field when the value is truthy. When reusing the
edit modal for a different entity that lacks a particular OAuth field,
the previous value would persist and be silently resubmitted on save.

Change all OAuth field assignments to unconditionally set the value
with a fallback to empty string (e.g. `config.issuer || ""`), matching
the pattern already used by oauthClientSecretField.

Signed-off-by: Mihai Criveti <[email protected]>

---------

Signed-off-by: kimsehwan96 <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Co-authored-by: Mihai Criveti <[email protected]>
kamath-a pushed a commit to kamath-a/mcp-context-forge that referenced this pull request Jun 26, 2026
* fix(ui): populate issuer field when editing OAuth gateway

The editGateway() function populates all OAuth config fields
(client_id, token_url, authorization_url, redirect_uri, scopes)
but omits the issuer field. This causes the issuer to be silently
dropped when saving, breaking OAuth flows that depend on it.

Signed-off-by: kimsehwan96 <[email protected]>

* fix(ui): populate issuer field when editing OAuth A2A agent + add test coverage

Apply the same issuer field fix to the editA2AAgent function that was
missing the same population logic. Add id="oauth-issuer-a2a-edit" to
the A2A edit modal HTML template.

Strengthen OAuth form-field assembly tests to verify all fields
(issuer, token_url, authorization_url, redirect_uri, client_id)
round-trip through edit for both gateways and A2A agents.

Signed-off-by: Mihai Criveti <[email protected]>

* fix(ui): clear stale OAuth fields when editing gateways and A2A agents

All OAuth field population guards used `if (field && config.value)`
which only sets the field when the value is truthy. When reusing the
edit modal for a different entity that lacks a particular OAuth field,
the previous value would persist and be silently resubmitted on save.

Change all OAuth field assignments to unconditionally set the value
with a fallback to empty string (e.g. `config.issuer || ""`), matching
the pattern already used by oauthClientSecretField.

Signed-off-by: Mihai Criveti <[email protected]>

---------

Signed-off-by: kimsehwan96 <[email protected]>
Signed-off-by: Mihai Criveti <[email protected]>
Co-authored-by: Mihai Criveti <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working security Improves security SHOULD P2: Important but not vital; high-value items that are not crucial for the immediate release ui User Interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][UI]: OAuth issuer URL not populated when editing gateway — silently dropped on save

2 participants