fix(admin): allow clearing passthrough_headers via gateway edit form#4229
Open
ecthelion77 wants to merge 1 commit intoIBM:mainfrom
Open
fix(admin): allow clearing passthrough_headers via gateway edit form#4229ecthelion77 wants to merge 1 commit intoIBM:mainfrom
ecthelion77 wants to merge 1 commit intoIBM:mainfrom
Conversation
Signed-off-by: Olivier Gintrand <olivier.gintrand@forterro.com>
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
Fixes #4228
📌 Summary
Passthrough headers cannot be cleared once set on a gateway via the admin edit form. Clearing the field and saving silently preserves the old values.
🔁 Reproduction Steps
passthrough_headersset (e.g.["Authorization"])🐞 Root Cause
Two bugs:
admin.py:str(form.get("passthrough_headers"))converts empty/None to the string"None", which is truthy. The parsing logic treats it as valid content instead of a cleared field, sopassthrough_headersis never set to signal clearing.gateway_service.py: Even if an empty list[]is passed (meaning "user cleared the field"), it is stored as-is in the database. The canonical representation for "no passthrough headers" isNone, not[].💡 Fix Description
admin.py: Distinguish between "field cleared" (empty string → setpassthrough_headers = []to signal clearing) and "field not provided" (None→ no change). Avoidstr()coercion on raw form value.gateway_service.py: Convert empty list[]toNonebefore storing, so the DB always usesNoneto mean "no passthrough headers".🧪 Verification
make lintmake test📐 MCP Compliance
✅ Checklist