Repository navigation
Strip sec-ch-* client-hint headers by prefix for CORS classification - #48
Merged
Merged
Conversation
The client-hint header family is open-ended and grows with every Chrome release (sec-ch-ua-wow64, sec-ch-ua-form-factors, ...). Enumerating them in ALWAYS_CLEAN_HEADERS rots: any unlisted client-hint fails the CORS-simple check and returns a 500 for that subresource request. Match the whole sec-ch- family by prefix instead.
m4dni5
marked this pull request as ready for review
September 9, 2026 23:40
Owner
|
Looks like unrelated concurrency cap code was in the PR, I removed it and reduced it to just the header strip logic. Thanks for the contribution! |
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.
Problem
Chromium sends client-hint headers like
sec-ch-ua-wow64that aren't inALWAYS_CLEAN_HEADERS. Requests carrying them return a 500 and their subresources fail to load.Root cause
To classify a request,
is_simple_cors_requestrequires every header to be on a fixed allowlist. Any header it doesn't recognize fails the check, no routing rule matches, and the request 500s.New
sec-ch-*headers appear with every Chrome release, so listing them one by one inALWAYS_CLEAN_HEADERSbreaks again each time.Fix
Strip the whole
sec-ch-*family by prefix before classification, so any current or future client hint is handled. Existing entries are left for any other consumers of the list.Verification
Requests carrying
sec-ch-ua-wow64: ?0500'd before, route correctly after.