Skip to content

fix(web): only DANGEROUSLY_OMIT_AUTH=true/1 disables /api auth - #2390

Merged
cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2331-omit-auth-false
Sep 16, 2026
Merged

cliffhall merged 1 commit into
v2/mainfrom
v2/fix/2331-omit-auth-false

Conversation

@cliffhall

Copy link
Copy Markdown
Member

Closes #2331

buildWebServerConfigFromEnv read the flag as !!process.env.DANGEROUSLY_OMIT_AUTH, so every non-empty string — including false and 0 — turned the /api/* bearer gate off and printed Auth: disabled. A deployment that set =false to keep auth on got the opposite.

Changes

  • resolve-bind-host.ts: the DANGEROUSLY_BIND_ALL_INTERFACES parser (already fail-closed: only trimmed, case-insensitive true/1 enable it) is exported as isEnvFlagEnabled, so both DANGEROUSLY_* safety flags parse one way.
  • web-server-config.ts: DANGEROUSLY_OMIT_AUTH now goes through it.
  • Tests: it.each over the opt-in spellings (true, TRUE, True, 1, 1) and the ones that must keep auth on (false, FALSE, 0, empty, whitespace, no, yes, on, 2), asserting both dangerouslyOmitAuth and that the token survives.
  • Docs: docs/environment-variables.md no longer warns that false disables auth; the v1→v2 migration table notes the stricter parsing (v1 also used !!, verified on v1/main).

⚠️ Behavior change: a value like yes or on used to disable auth and now keeps it on. That is the fail-closed direction, and the docs have only ever shown =true.

npm run local:gate passes. No UI change, so no screenshots.

🤖 Generated with Claude Code

!!process.env.DANGEROUSLY_OMIT_AUTH read every non-empty string as on, so
=false silently disabled the bearer gate. Reuse the DANGEROUSLY_BIND_ALL_INTERFACES
parser (exported as isEnvFlagEnabled) so both safety flags fail closed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Signed-off-by: cliffhall <cliff@futurescale.com>
@cliffhall cliffhall added the v2 Issues and PRs for v2 label Sep 16, 2026
@cliffhall
cliffhall requested a balanced review from Copilot September 16, 2026 17:20

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation matches the issue requirements and includes comprehensive regression coverage.

Pull request overview

Fixes fail-closed parsing for the web backend’s auth-disable flag.

Changes:

  • Shares explicit true/1 environment-flag parsing.
  • Adds regression coverage for accepted and rejected values.
  • Updates environment and migration documentation.
File summaries
File Description
docs/v1-to-v2-migration.md Documents stricter v2 parsing.
docs/environment-variables.md Clarifies accepted flag values.
clients/web/src/test/integration/server/web-server-config.test.ts Tests opt-in and fail-closed cases.
clients/web/server/web-server-config.ts Applies safe parsing to auth omission.
clients/web/server/resolve-bind-host.ts Exports the shared flag parser.
Review details
  • Files reviewed: 5/5 changed files
  • Comments generated: 0
  • Review effort level: Balanced

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

v2 Issues and PRs for v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(web): DANGEROUSLY_OMIT_AUTH=false still disables /api auth

2 participants