How to fix: Sensitive header exposed via Access-Control-Expose-Headers
The Access-Control-Expose-Headers response header names a specific sensitive header (Authorization, Set-Cookie, or X-Csrf-Token), exposing it to cross-origin JavaScript regardless of how many other headers are listed alongside it.
Why it matters
Exposing response headers like Set-Cookie, Authorization, or internal tracking headers to cross-origin JavaScript leaks information that was intended to be opaque to the requesting page.
Only expose the headers that cross-origin clients actually need to read.
How to fix it
- 1Review which headers cross-origin clients need to access
- 2List only those specific headers in Access-Control-Expose-Headers
- 3Never expose Set-Cookie, Authorization, or internal headers
Code examples
Expose only necessary headers
return new Response(data, {
headers: {
"Access-Control-Allow-Origin": "https://trusted-partner.com",
"Access-Control-Expose-Headers": "X-Total-Count, X-Rate-Limit-Remaining",
// Only expose what the client actually needs to read
},
});References
Detected automatically by VulnRadar. The check id is access-control-expose, stable across every scan so you can filter or diff on it.
More headers checks
Questions
- How severe is Sensitive header exposed via Access-Control-Expose-Headers?
- VulnRadar rates this low severity in the headers category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
- Does VulnRadar check for this automatically?
- Yes. It runs as part of every scan under the check id access-control-expose, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Sensitive header exposed via Access-Control-Expose-Headers map to?
- It maps to CWE-200. In the OWASP Top 10 it falls under A05:2021.
Missing a check?
The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.