Allow credentialed CORS only for your own origins
CORS headers tell a browser which other sites may read a response. With Access-Control-Allow-Credentials: true, that read happens with the visitor's own cookies, so any site the server allows can see what the visitor sees while signed in. The scan reads these headers on the responses it already received and never sends a request from another origin, so it can see a server that names *, null or another site, but not one that echoes back whatever origin asks.
Find out whether your site has this problem, and every other check, in one free scan.
Check your site freeWhy it matters
A server that allows credentialed cross-origin reads from another site, or from the null origin, lets that site read your visitors' data with their own login, without them noticing.
How to fix
- 1 List the exact origins of your own front ends in the server or CORS middleware config, instead of *, null, or a copy of the request Origin.
- 2 Send Access-Control-Allow-Credentials: true only on responses to those origins, and only on endpoints that need cookies.
- 3 Remove origins left from development (localhost, old staging hosts) from the production list.
Common mistakes
- Echoing back the request's Origin header to make CORS errors go away, which allows every site in the world, with credentials.
- Allowing the null origin for local file testing: sandboxed frames on any site send null too.
- Leaving localhost or old staging origins in the production allow list.
How to verify
- 1 Re-run the scan and confirm the CORS with credentials finding is gone.
- 2 Send a request with an Origin header of a site you do not own (for example with curl -H) and confirm the response does not name it in Access-Control-Allow-Origin.
- 3 Confirm Access-Control-Allow-Credentials appears only on responses to your own front ends.
Related checks
Ready to see where you stand?
Scan your site and get your Engineering Score with a prioritized roadmap in under a minute, no signup required.
