Skip to content

CORS configuration uses ["*"] with credentials: true #223

@llinsss

Description

@llinsss

Description:
The backend sets credentials: true while allowing origin: ["*"] when CORS_ORIGIN is not configured. Browsers reject Access-Control-Allow-Origin: * with credentials, and the fallback can cause unexpected behavior or weaken intended CORS restrictions.

Evidence:

  • backend/app.js: origin: process.env.CORS_ORIGIN?.split(",") || ["*"], credentials: true
  • backend/services/SocketService.js: similar pattern.

Suggested Fix:
Require explicit CORS_ORIGIN values in production and reject startup when not provided (or set credentials: false when origin is wildcard). For Socket.io, align the CORS origin policy with the HTTP policy.

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions