Skip to content

feat(server): harden CORS configuration with per-environment allowed origins - #1467

Open
guptakumarranjeet150 wants to merge 1 commit into
Arenax-gaming:mainfrom
guptakumarranjeet150:feat/cors-hardening-per-env
Open

guptakumarranjeet150 wants to merge 1 commit into
Arenax-gaming:mainfrom
guptakumarranjeet150:feat/cors-hardening-per-env

Conversation

@guptakumarranjeet150

Copy link
Copy Markdown

Summary

Implements hardened CORS configuration locked down per environment, preventing unauthorized external websites from making credentialed requests in production while maintaining smooth development and staging workflows.

Closes #1384

Acceptance Criteria Verified

  • Production Lockdown: Only origins specified in CORS_ALLOWED_ORIGINS (or sanitized fallback) are permitted. Wildcards in production are strictly rejected to eliminate credential leakage.
  • Staging & Development Flexibility: Permits configured origins, staging domains, and local development ports (localhost:3000, localhost:5173, localhost:3001).
  • Preflight OPTIONS Handling: Explicitly specifies Access-Control-Allow-Methods (GET, HEAD, PUT, PATCH, POST, DELETE, OPTIONS), Access-Control-Allow-Headers, exposed headers, and 204 status code.
  • Credentialed Protection: Explicitly configures credentials: true only for whitelisted origins.
  • Disallowed Origin Rejection: Requests from disallowed origins in production return 403 Forbidden with CORS policy: origin not allowed error and no CORS headers.
  • Comprehensive Unit Tests: 6/6 tests passing in server/test/cors.middleware.test.js.

@vercel

vercel Bot commented Nov 10, 2026

Copy link
Copy Markdown

@guptakumarranjeet150 is attempting to deploy a commit to the paul joseph's projects Team on Vercel.

A member of the Team first needs to authorize it.

This branch has not been deployed

No deployments
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.

[Server] - Add CORS configuration hardening with per-environment allowed origins

1 participant