CORS "Access-Control-Allow-Origin: *" on my AI-built app: is it a problem?
Sometimes. A wildcard on a public, read-only API is usually fine. It becomes a problem when your API also trusts the visitor's cookies or login, or when your server copies back whatever Origin it's sent and allows credentials. Then another website can read your users' data while they're signed in.
Ember checks CORS as one of the 15 checks in the free scan. Full fixes free for every critical issue (no critical? one other fix is free).
Home › Guides › CORS "Access-Control-Allow-Origin: *" on my AI-built app: is it a problem? · Last updated · By Ember, SniffPup
What CORS does, in plain English
Browsers stop one website from reading responses from another website by default. CORS headers are how your server says “these other sites may read my responses.” The header that matters most is Access-Control-Allow-Origin.
The three setups to know
- Access-Control-Allow-Origin: * with no credentials: Any site can read the response, but the browser will not send the visitor's cookies with it. Fine for truly public data, like a list of blog posts.
- The server echoes the request's Origin and sends Access-Control-Allow-Credentials: true: This is the risky one. Any website your user visits can call your API as that user and read the answer.
- A short allow-list of your own domains: For example your live domain and your preview domain, with credentials only where you need them. This is what most apps want.
Why AI-built apps end up with it
AI coding tools often fix a “blocked by CORS policy” error in the fastest way: allow every origin, or reflect the origin, and turn on credentials so login works. The error goes away, and the guardrail goes with it.
How to check yours in a minute
- Open your live site, open the browser's developer tools, go to the Network tab and click a request to your API. Look at the response headers for
Access-Control-Allow-OriginandAccess-Control-Allow-Credentials. - If Allow-Origin shows your own site's address on every request, try the same request from another site you own: if the header changes to match that site and credentials are allowed, the server is reflecting origins.
- Or run SniffPup's free scan. Checking CORS is one of its 15 passive checks. The scan sends one extra GET of the page you entered, with an Origin header from a site SniffPup controls. It flags a high finding if your server copies that Origin back and allows credentials, and a low finding if it copies the Origin back without credentials. A bare
Access-Control-Allow-Origin: *without credentials is not flagged. Because the scan never signs in and only looks at the page you entered, a loose API route can be missed if the homepage is fine. There is also a short two-minute tip at Does your API say yes to every website?
How to fix it
1. List the exact origins you trust
Your live domain, and any preview domain you really use. Only send Access-Control-Allow-Origin when the request's Origin is on that list.
2. Send credentials only on routes that need the visitor's login
Only send Access-Control-Allow-Credentials: true on those routes.
3. Never combine "allow any origin" with credentials
Browsers refuse the literal * with credentials, which is why tools fall back to echoing the origin. Don't.
4. Keep public, read-only routes on * if you like
That is fine, as long as they return nothing private.
Fix prompt (paste into your AI builder)
Review my API's CORS setup. Replace any wildcard or reflected Origin with an allow-list of these domains: [your domains]. Only send Access-Control-Allow-Credentials: true on routes that need the user's session. Show me every file you changed.Honest limits
SniffPup's free scan is passive. It checks what any visitor can see and never signs in, so pages and APIs that need an account aren't covered. A clean report means we didn't find anything in the checks we run. It doesn't mean your app is secure. See what the scanner does and never does.
FAQ
Is Access-Control-Allow-Origin: * on my AI-built app a problem?
Sometimes. A wildcard on a public, read-only API is usually fine. It becomes a problem when your API also trusts the visitor's cookies or login, or when your server copies back whatever Origin it's sent and allows credentials. Then another website can read your users' data while they're signed in.
What does SniffPup's CORS check actually flag?
The free scan sends one extra GET of the page you entered, with an Origin header from a site SniffPup controls (https://cors-check.sniffpup.com). It flags a finding when the response's Access-Control-Allow-Origin is that test origin, or the value null. If Access-Control-Allow-Credentials is also true, the finding is high: any website can read the page as your logged-in users. If not, the finding is low: usually harmless for public pages, but often a sign the same loose rule is on your API routes. A bare Access-Control-Allow-Origin: * without credentials is not flagged.
Why don't browsers allow * with credentials?
A wildcard with credentials would let any site read responses using the visitor's login. Browsers refuse that pairing, so tools that want both login and "just make the CORS error go away" often echo the request's Origin instead. That reflected-origin-plus-credentials setup is the risky one.