fix(admin): preserve OAuth client_secret when editing gateways and A2A agents#4150
Open
ecthelion77 wants to merge 1 commit intoIBM:mainfrom
Open
fix(admin): preserve OAuth client_secret when editing gateways and A2A agents#4150ecthelion77 wants to merge 1 commit intoIBM:mainfrom
ecthelion77 wants to merge 1 commit intoIBM:mainfrom
Conversation
Contributor
Author
|
Suggested labels: |
e58ecb8 to
6281288
Compare
5758a09 to
6477883
Compare
…A agents Signed-off-by: Olivier Gintrand <olivier.gintrand@forterro.com>
6477883 to
b8a1e11
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🐛 Bug-fix PR
🔗 Issue
Closes #4156
📌 Summary
Editing a gateway or A2A agent via the admin UI silently erases the OAuth
client_secret, breaking all OAuth-authenticated gateways that are subsequently edited for any reason (e.g., changing tags, description, or team assignment).🔁 Reproduction Steps
client_secretclient_secretis gone fromoauth_config🐞 Root Cause
Two bugs that combine to cause data loss:
Bug 1 — Frontend (
gateways.js,a2aAgents.js):When the edit modal populates form fields, all secret fields (bearer token, password, custom headers, query params) are set to
MASKED_AUTH_VALUE("*****") — exceptoauth_client_secretwhich is set to"":Bug 2 — Backend (
admin.py,admin_edit_gatewayandadmin_edit_a2a_agent):When the form submits with
oauth_client_secret = "", the handler skips addingclient_secretto theoauth_configdict entirely:The service layer's
protect_oauth_config_for_storage()has preservation logic forMASKED_AUTH_VALUE, but it only works when the key exists in the dict. Since admin.py omits the key entirely, the preservation logic never fires.Note: The
admin_edit_serverhandler (virtual servers) already has the correct preservation pattern, making the inconsistency clear.💡 Fix Description
Frontend: Set
oauthClientSecretField.valuetoMASKED_AUTH_VALUEwhen a secret exists (consistent with all other secret fields), or""when no secret is configured.Backend: When
oauth_client_secretis empty or equalsMASKED_AUTH_VALUEand aclient_idis present, send the masked placeholder value so the service layer preserves the existing encrypted secret:🧪 Verification
make lintmake testmake coverage📐 MCP Compliance (if relevant)
✅ Checklist
make black isort pre-commit)