Skip to content

fix(server): trim whitespace and drop empty entries in ALLOWED_ORIGINS - #232

Open
aymanmali wants to merge 1 commit into
CopilotKit:mainfrom
aymanmali:fix/allowed-origins-trim
Open

aymanmali wants to merge 1 commit into
CopilotKit:mainfrom
aymanmali:fix/allowed-origins-trim

Conversation

@aymanmali

Copy link
Copy Markdown

Summary

  • Trim whitespace around comma-separated entries and drop empty entries when parsing ALLOWED_ORIGINS in apps/server/src/config.ts.
  • Previously, a value such as ALLOWED_ORIGINS="https://app.example.com, https://admin.example.com" kept leading/trailing spaces (e.g. " https://admin.example.com"), causing the origin check in apps/server/src/app.ts to reject valid requests with 403 Origin is not allowed, and a blank or trailing-comma value left empty strings in allowedOrigins.
  • Added unit tests in tests/config.test.ts covering whitespace trimming, empty segments, and blank values.

Verification

  • pnpm format — clean
  • pnpm lint — clean
  • pnpm typecheck — clean
  • pnpm test — 524/524 passed

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.

1 participant