Skip to main content
InfoAPIOWASP A05:2021CWE-346

How to fix: Access-Control-Allow-Credentials sent with no allowed origin

The response sets Access-Control-Allow-Credentials: true with no Access-Control-Allow-Origin. There is no origin the credentialed cross-origin request could be allowed for.

Why it matters

No browser will honour the credentialed cross-origin request, so this configuration cannot work as intended. That matters less for what it permits than for what it signals: a CORS policy that is half-applied, typically because the Allow-Origin half is set conditionally on a code path that did not run, while the credentials flag is set unconditionally.

Reported as informational because in this state the header grants nothing. It is worth fixing because the two halves are meant to be decided together: whoever adds the missing Allow-Origin is one step from reflecting the request's Origin unconditionally, which combined with the credentials flag already present here is the arbitrary-origin-with-credentials case that is genuinely critical. Set both from the same allowlist check, or neither.

How to fix it

  1. 1Set Access-Control-Allow-Origin and Access-Control-Allow-Credentials in the same branch, after the origin has been matched against an allowlist.
  2. 2Never pair the credentials flag with a reflected or wildcard origin.
  3. 3Send Vary: Origin whenever the response depends on the request's Origin.
  4. 4Drop the credentials flag entirely if the endpoint does not need cookies or HTTP authentication.

Code examples

Set both together or neither

JavaScript
const ALLOWED = new Set(['https://app.example.com']);

app.use((req, res, next) => {
  const origin = req.headers.origin;
  if (origin && ALLOWED.has(origin)) {
    res.set('Access-Control-Allow-Origin', origin);
    res.set('Access-Control-Allow-Credentials', 'true');
  }
  res.append('Vary', 'Origin');
  next();
});

References

Detected automatically by VulnRadar. The check id is api-cors-credentials-without-allow-origin, stable across every scan so you can filter or diff on it.

See every api check

Questions

How severe is Access-Control-Allow-Credentials sent with no allowed origin?
VulnRadar rates this info severity in the api 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 api-cors-credentials-without-allow-origin, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Access-Control-Allow-Credentials sent with no allowed origin map to?
It maps to CWE-346. 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.

Propose a checkHow a check is built

Scan your own site for access-control-allow-credentials sent with no allowed origin

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

Access-Control-Allow-Credentials sent with no allowed origin | VulnRadar