Skip to content

fix(cors): make prod CORS_ALLOWED_ORIGINS required (fail-closed)#108

Open
DavidHLP wants to merge 1 commit into
mainfrom
fix/cors-prod-fail-closed
Open

fix(cors): make prod CORS_ALLOWED_ORIGINS required (fail-closed)#108
DavidHLP wants to merge 1 commit into
mainfrom
fix/cors-prod-fail-closed

Conversation

@DavidHLP

@DavidHLP DavidHLP commented Jul 5, 2026

Copy link
Copy Markdown
Owner

${CORS_ALLOWED_ORIGINS:?... is required} replaces the localhost fallback that let prod silently allow localhost cross-origin if the operator forgot to set the var. Aligns with the 10x existing fail-closed siblings in this file. Dev fallback stays in .env.example:36.

Closes #102

The previous default
  ${CORS_ALLOWED_ORIGINS:-http://localhost:9002,http://localhost:9003}
let production silently fall back to localhost origins if the operator
forgot to set the var — anyone running a local :9002/:9003 page could
then call the prod API with the user's cookie. Production fail-open.

Switch to ${CORS_ALLOWED_ORIGINS:?... is required}, matching the
existing fail-closed pattern used 10x in this file (NACOS_PASSWORD,
DB_PASSWORD, REDIS_PASSWORD, JWT_SECRET, ...). Dev fallback stays in
.env.example:36 (dev reads .env, never this prod compose default).

Fixes #102
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.

fix: CORS prod compose 改 fail-closed(默认 localhost 跨域是隐患)

1 participant