fix(opa): apply send_headers_upstream for headers absent from OPA response#13433
Open
shreemaan-abhishek wants to merge 1 commit into
Open
fix(opa): apply send_headers_upstream for headers absent from OPA response#13433shreemaan-abhishek wants to merge 1 commit into
shreemaan-abhishek wants to merge 1 commit into
Conversation
2 tasks
f1b9983 to
8029525
Compare
…ponse When send_headers_upstream lists a header that the OPA response omits, the plugin previously left any incoming request value for that header in place on the upstream call. Iterate the configured list and call core.request.set_header(ctx, name, value) for every name, passing nil when OPA does not return that header so the incoming value is cleared. Also covers the case where the OPA response has no headers field.
8029525 to
684b382
Compare
membphis
approved these changes
May 28, 2026
nic-6443
approved these changes
May 28, 2026
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.
Description
When the
opaplugin is configured withsend_headers_upstreamand the OPA server returnsallow = truewithout including one of the configured headers in its response (or without aheadersfield at all), the plugin previously left any incoming request value for that header in place on the upstream call. The intent ofsend_headers_upstreamis that the upstream sees only the values OPA returns for those names; the prior behavior diverged from that.This change iterates the configured list and calls
core.request.set_header(ctx, name, value)for every name insend_headers_upstream. When OPA does not return that header,valueisniland the incoming request header is cleared. The condition no longer short-circuits on a missingresult.headersfield.t/plugin/opa3.tcovers the case where OPA returnsallow = truewith noheadersfield and a configured header is sent by the client: the upstream must not see the client-supplied value.Which issue(s) this PR fixes:
Fixes #
Checklist