Repository navigation
Conversation
RFC 9110 Section 5.3 mandates that header fields sent as a single line with comma-joined values be treated as equivalent to the same field sent on multiple header lines. The extractor already handled the multiple-header-lines form (iterating each physical header occurrence) but took a single comma-joined header line as one opaque value, so e.g. "Authorization: Bearer <jwt1>, Bearer <jwt2>" extracted a single, invalid token instead of two valid ones. - For headers without a value_prefix, split the raw value on commas, mirroring how repeated header lines are already handled. - For headers with a value_prefix, find every occurrence of the prefix within the header line and bound each extracted token at the next occurrence, so repeated credentials of the same scheme split cleanly while a single occurrence (the common case, and existing flexible-match configs that use commas as part of one credential's own syntax) keeps its historical run-to-end-of-value behavior. Signed-off-by: Alex Bakon <abakon@netflix.com>
|
This PR took pains to keep the existing handling of |
|
/retest |
|
I'll also run this by @wbpcode once. |
|
/wait |
|
A defensive runtime flag. Considering the runtime flag check is not that cheap as I expected before, may could fetch the flag value and store it at the ExtractorImpl. |
Latch it at filter construction time for efficiency. Signed-off-by: Alex Bakon <abakon@netflix.com>
|
SGTM, done. While I've got y'all, WDYT of the switch I proposed above from |
Note, no matter cc @agrawroh |
|
That behavior was added in #6384, so definitely intentional, but not necessarily still used. I think the minimal change would be to keep the extra functionality but narrow the set of non-base64 characters allowed to exclude |
|
/retest |
Signed-off-by: Alex Bakon <abakon@netflix.com>
7e3a074 to
76cae56
Compare
Commit Message:
RFC 9110 Section 5.3 mandates that header fields sent as a single line
with comma-joined values be treated as equivalent to the same field sent
on multiple header lines. The JWT extractor already handled the
multiple-header-lines form (iterating each physical header occurrence)
but took a single comma-joined header line as one opaque value, so e.g.
"Authorization: Bearer , Bearer " extracted a single,
invalid token instead of two valid ones.
Additional Description:
Found this by breaking JWT handling by a well-known header registration. The registered header appeared in a
from_headersconfig. Registering it caused Envoy to collapse multiple values, which caused JWT extraction to barf.AI disclosure: the author wrote this PR with assistance of AI tools but takes responsibility for the contents.
Risk Level: med, changes JWT header parsing
Testing: ran unit tests
Docs Changes: n/a
Release Notes: none
Platform Specific Features: none