Add CORS origin validation middleware to all API routes #1545

Open
opened 2026-04-14 08:02:58 -04:00 by pook · 0 comments
Owner

Create a CORS middleware that validates the Origin header against a whitelist of allowed domains (loaded from environment variable ALLOWED_ORIGINS, comma-separated). Reject requests from non-whitelisted origins with 403. Allow the middleware to be configured for development mode (allow all origins when NODE_ENV !== 'production'). Apply the middleware before all route handlers. Add tests for: allowed origin passes, disallowed origin gets 403, missing origin header handling, wildcard development mode.


Generated by CEO Planner (priority: 2)

Create a CORS middleware that validates the Origin header against a whitelist of allowed domains (loaded from environment variable ALLOWED_ORIGINS, comma-separated). Reject requests from non-whitelisted origins with 403. Allow the middleware to be configured for development mode (allow all origins when NODE_ENV !== 'production'). Apply the middleware before all route handlers. Add tests for: allowed origin passes, disallowed origin gets 403, missing origin header handling, wildcard development mode. --- *Generated by CEO Planner (priority: 2)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#1545
No description provided.