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>
- .env.example +13 -3
- src/config.ts +5 -2
.env.example
CHANGED
|
@@ -1,4 +1,14 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
PORT=8080
|
|
|
|
| 1 |
+
# Codex Proxy Configuration
|
| 2 |
+
# Copy this file to .env and edit values as needed: cp .env.example .env
|
| 3 |
+
|
| 4 |
+
# Optional: paste ChatGPT JWT to skip OAuth login (leave empty to use OAuth)
|
| 5 |
+
CODEX_JWT_TOKEN=
|
| 6 |
+
|
| 7 |
+
# Platform: linux for Docker, darwin for macOS, win32 for Windows
|
| 8 |
+
CODEX_PLATFORM=linux
|
| 9 |
+
|
| 10 |
+
# Architecture: x64 for Docker/Intel, arm64 for Apple Silicon
|
| 11 |
+
CODEX_ARCH=x64
|
| 12 |
+
|
| 13 |
+
# Server port
|
| 14 |
PORT=8080
|
src/config.ts
CHANGED
|
@@ -77,8 +77,11 @@ function loadYaml(filePath: string): unknown {
|
|
| 77 |
}
|
| 78 |
|
| 79 |
function applyEnvOverrides(raw: Record<string, unknown>): Record<string, unknown> {
|
| 80 |
-
|
| 81 |
-
|
|
|
|
|
|
|
|
|
|
| 82 |
}
|
| 83 |
if (process.env.CODEX_PLATFORM) {
|
| 84 |
(raw.client as Record<string, unknown>).platform = process.env.CODEX_PLATFORM;
|
|
|
|
| 77 |
}
|
| 78 |
|
| 79 |
function applyEnvOverrides(raw: Record<string, unknown>): Record<string, unknown> {
|
| 80 |
+
const jwtEnv = process.env.CODEX_JWT_TOKEN?.trim();
|
| 81 |
+
if (jwtEnv && jwtEnv.startsWith("eyJ")) {
|
| 82 |
+
(raw.auth as Record<string, unknown>).jwt_token = jwtEnv;
|
| 83 |
+
} else if (jwtEnv) {
|
| 84 |
+
console.warn("[Config] CODEX_JWT_TOKEN ignored: not a valid JWT (must start with 'eyJ')");
|
| 85 |
}
|
| 86 |
if (process.env.CODEX_PLATFORM) {
|
| 87 |
(raw.client as Record<string, unknown>).platform = process.env.CODEX_PLATFORM;
|