Skip to content

fix(websocket): configure WebSocket gateway with CORS allowed origins allowlist (#159) - #164

Open
ghzhost wants to merge 1 commit into
Cylo-Traders:masterfrom
ghzhost:fix/websocket-cors-allowlist
Open

fix(websocket): configure WebSocket gateway with CORS allowed origins allowlist (#159)#164
ghzhost wants to merge 1 commit into
Cylo-Traders:masterfrom
ghzhost:fix/websocket-cors-allowlist

Conversation

@ghzhost

@ghzhost ghzhost commented Aug 17, 2026

Copy link
Copy Markdown

Summary

Replaces the permissive origin: '*' wildcard in @WebSocketGateway with the configured allowlist (appConfig.app.corsAllowedOrigins / CORS_ALLOWED_ORIGINS).

Changes

  • server/src/websocket/campaign-events.gateway.ts:
    • Dynamically load corsAllowedOrigins from app configuration.
    • Configure @WebSocketGateway({ cors: { origin: corsAllowedOrigins, credentials: true } }).
  • server/src/websocket/campaign-events.gateway.spec.ts:
    • Add unit test asserting CampaignEventsGateway options do not use '*' wildcard in CORS origin.
  • server/test/websocket.e2e-spec.ts:
    • Update E2E test suite with origin checks for allowed and disallowed origin handshakes.

Closes #159

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] WebSocket gateway allows CORS from any origin

1 participant