Skip to content

fix: configure CORS via env ALLOWED_ORIGINS#581

Open
Xuccessor wants to merge 1 commit into
Gatheraa:mainfrom
Xuccessor:fix/issue-519-cors-allowlist
Open

fix: configure CORS via env ALLOWED_ORIGINS#581
Xuccessor wants to merge 1 commit into
Gatheraa:mainfrom
Xuccessor:fix/issue-519-cors-allowlist

Conversation

@Xuccessor

Copy link
Copy Markdown

Summary

No CORS was configured in main.ts, allowing any origin to connect. This fix adds an env-driven CORS allowlist (ALLOWED_ORIGINS) so only explicitly listed origins are permitted in production.

Changes

  • app/backend/src/main.ts: enable CORS with origin allowlist from process.env.ALLOWED_ORIGINS (comma-separated). Credentials are only passed when the origin is in the allowlist. Methods limited to GET/POST/PUT/PATCH/DELETE/OPTIONS.
  • app/backend/.env.example: document ALLOWED_ORIGINS with a sensible local default.

Testing

  • ALLOWED_ORIGINS=http://localhost:3000Origin: http://localhost:3000 preflight returns Access-Control-Allow-Origin.
  • Unlisted origin → no Access-Control-Allow-Origin header returned.

Closes #519

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.

[backend][security] CORS allowlist is commented out

1 participant