How to fix: Cache-Control Missing no-store on Token-Bearing JSON Response
A JSON API response body contains a key that looks like a live credential, such as access_token, refresh_token, api_key, or session_token, but the Cache-Control header does not include no-store.
Why it matters
Without no-store, browsers, proxies, and shared or CDN caches are permitted to store the response body under their normal caching rules. A credential cached on a shared machine, in a corporate proxy, or at a CDN edge can later be replayed by someone else, or recovered from browser disk cache or back/forward cache inspection.
Responses that hand back a live credential are exactly the case Cache-Control: no-store exists for. RFC 6749 section 5.1 requires OAuth token endpoints to send it for this reason. A response that returns an access_token, session_token, or similar value without no-store leaves the browser and any intermediary free to store it.
How to fix it
- 1Add Cache-Control: no-store to any response body that includes a token, session id, or other credential.
- 2Scope the header to the specific route returning credentials rather than the whole app, so static assets and public pages keep normal caching.
Code examples
Next.js route handler
export async function POST() {
const body = { access_token: issueToken(), token_type: 'bearer' };
return Response.json(body, {
headers: { 'Cache-Control': 'no-store' },
});
}References
Detected automatically by VulnRadar. The check id is cache-control-no-store-missing-tokens, stable across every scan so you can filter or diff on it.
More headers checks
Questions
- How severe is Cache-Control Missing no-store on Token-Bearing JSON Response?
- VulnRadar rates this medium 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 cache-control-no-store-missing-tokens, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Cache-Control Missing no-store on Token-Bearing JSON Response map to?
- It maps to CWE-525. In the OWASP Top 10 it falls under A04: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.