CORS Wildcard Allow-Origin Too Permissive
CORS configured with Access-Control-Allow-Origin: * allowing any origin to access the API. Security audit flags this as a vulnerability. Any website can make requests to the API on behalf of users.
While allowing all origins is convenient for development, it's a security risk in production.
Error Messages You Might See
Common Causes
- Wildcard used for simplicity during development and never changed for production
- CORS allowed for all endpoints including sensitive ones
- Misunderstanding that wildcard is safe (it's not)
- No authentication on API endpoints, relying on origin restriction
- CORS configured globally without considering security implications
How to Fix It
Replace * with specific domains: Access-Control-Allow-Origin: https://trusted.example.com. For multiple domains: check Origin header, return specific domain if in whitelist. Only allow CORS for non-sensitive endpoints. Sensitive operations (delete, payment) should require stronger auth. Always combine with authentication (JWT tokens), don't rely on origin alone.
Real developers can help you.
You don't need to be technical. Just describe what's wrong and a verified developer will handle the rest.
Get HelpFrequently Asked Questions
Why is Access-Control-Allow-Origin: * unsafe?
Any website can make authenticated requests on user's behalf. If user logged in, attacker's site can call API as that user.
How to allow multiple specific origins?
Check Origin header. If in whitelist, return it: Access-Control-Allow-Origin: origin (where origin is the value sent).
Should sensitive APIs allow CORS?
No. CORS should only apply to read-only or public APIs. Sensitive operations (delete, payment) should require stronger auth.