Spaces:
Paused
Paused
icebear0828 Claude Opus 4.6 commited on
Commit ·
a971da6
1
Parent(s): 365b839
fix: prevent .env inline comments from being parsed as JWT tokens
Browse filesDocker Compose env_file doesn't strip inline comments, so
"CODEX_JWT_TOKEN= # comment" was treated as a real token, creating
ghost accounts on every restart.
- Move .env.example comments to separate lines
- Validate JWT format in config.ts (must start with "eyJ")
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Files changed (2)
- .env.example+13-3
- src/config.ts+5-2
1234CODEX_JWT_TOKEN= # Optional: paste ChatGPT JWT (skip OAuth login)CODEX_PLATFORM=linux # linux for Docker, darwin for macOS, win32 for WindowsCODEX_ARCH=x64 # x64 for Docker/Intel, arm64 for Apple SiliconPORT=80801234567891011121314# Codex Proxy Configuration# Copy this file to .env and edit values as needed: cp .env.example .env# Optional: paste ChatGPT JWT to skip OAuth login (leave empty to use OAuth)CODEX_JWT_TOKEN=# Platform: linux for Docker, darwin for macOS, win32 for WindowsCODEX_PLATFORM=linux# Architecture: x64 for Docker/Intel, arm64 for Apple SiliconCODEX_ARCH=x64# Server portPORT=8080
76 unmodified lines777879808182838476 unmodified lines}function applyEnvOverrides(raw: Record<string, unknown>): Record<string, unknown> {if (process.env.CODEX_JWT_TOKEN) {(raw.auth as Record<string, unknown>).jwt_token = process.env.CODEX_JWT_TOKEN;}if (process.env.CODEX_PLATFORM) {(raw.client as Record<string, unknown>).platform = process.env.CODEX_PLATFORM;76 unmodified lines777879808182838485868776 unmodified lines}function applyEnvOverrides(raw: Record<string, unknown>): Record<string, unknown> {const jwtEnv = process.env.CODEX_JWT_TOKEN?.trim();if (jwtEnv && jwtEnv.startsWith("eyJ")) {(raw.auth as Record<string, unknown>).jwt_token = jwtEnv;} else if (jwtEnv) {console.warn("[Config] CODEX_JWT_TOKEN ignored: not a valid JWT (must start with 'eyJ')");}if (process.env.CODEX_PLATFORM) {(raw.client as Record<string, unknown>).platform = process.env.CODEX_PLATFORM;
.env.example+13-3
src/config.ts+5-2