Skip to content

fix: resolve CORS misconfiguration vulnerability (allow_origins wildcard with credentials)#139

Open
namann5 wants to merge 1 commit into
Team-NoxVeil:mainfrom
namann5:fix/cors-misconfiguration-vulnerability
Open

fix: resolve CORS misconfiguration vulnerability (allow_origins wildcard with credentials)#139
namann5 wants to merge 1 commit into
Team-NoxVeil:mainfrom
namann5:fix/cors-misconfiguration-vulnerability

Conversation

@namann5
Copy link
Copy Markdown
Contributor

@namann5 namann5 commented May 27, 2026

Summary

Fixes CORS misconfiguration vulnerability - using allow_origins=["*"] with allow_credentials=True violates the CORS spec and allows any external website to make credentialed requests.

Changes

  • backend/app/config.py: Added CORS_ORIGINS config setting with specific allowed origins
  • backend/app/main.py: Changed from allow_origins=["*"] to allow_origins=settings.CORS_ORIGINS

Security Impact

Per RFC 6454, Access-Control-Allow-Origin: * must NOT be used with Access-Control-Allow-Credentials: true. Starlette reflects the origin back when credentials are enabled, making any origin able to read authenticated responses.

Related Issue

Closes #138

…ildcard

Critical security fix: Using allow_origins=['*'] with allow_credentials=True
violates the CORS specification and allows any external website to make
authenticated requests to the API. This enables cross-origin credential
leakage attacks where malicious sites can exfiltrate user data.

The fix:
- Moves allowed origins to Settings.CORS_ORIGINS config
- Restricts to specific development origins (localhost:5173, localhost:3000)
- Allows easy configuration via .env for production deployments
@namann5 namann5 force-pushed the fix/cors-misconfiguration-vulnerability branch from 74b97fa to 03028d0 Compare May 27, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Critical: CORS misconfiguration with allow_credentials=True and allow_origins=['*']

1 participant