Headers on the move
Redirect filtering works in one client and leaks credentials in another.
What’s going wrong
A redirect sanitizer removes configured sensitive headers when a request changes origin. It succeeds for the example used during development, yet equivalent requests from another client can retain credentials.
Input is JSON with `cross_origin` (boolean), `headers` (ordered `[name, value]` pairs), and `remove` (header names). HTTP header names are ASCII and case-insensitive. On a cross-origin redirect, remove every matching pair. Otherwise preserve every pair. Keep the exact spelling, values, duplicates, and order of surviving headers. Print the resulting array as compact JSON.
Origin detection is supplied; the bug is in the sanitizing step.
Expected behavior
Cross-origin redirects remove configured names regardless of capitalization. Same-origin requests and nonmatching names are preserved.
Reproduction
{"cross_origin":true,"headers":[["authorization","secret"],["Accept","text/plain"]],"remove":["Authorization"]}[["Accept","text/plain"]]
{"cross_origin":false,"headers":[["Authorization","secret"]],"remove":["Authorization"]}[["Authorization","secret"]]
Before you begin
- Lists and comprehensions
- Strings
- HTTP header semantics (stated in report)
Need a nudge?
Reveal one investigation hint at a time. Try each clue before opening the next.
Read the report, then sign in to start your investigation.