Skip to content

fix(security): correct auth bypass negation for localhost binding (#1080)#1301

Closed
OneStepAt4time wants to merge 1 commit intodevelopfrom
fix/auth-bypass-negation
Closed

fix(security): correct auth bypass negation for localhost binding (#1080)#1301
OneStepAt4time wants to merge 1 commit intodevelopfrom
fix/auth-bypass-negation

Conversation

@OneStepAt4time
Copy link
Copy Markdown
Owner

Problem

After #1289 merged, the smoke test and all unauthenticated localhost requests return 401.

Root Cause

Negation bug in src/server.ts:370:

// WRONG (current):
if (!authManager.authEnabled && !authManager.isLocalhostBinding) return;
// CORRECT:
if (!authManager.authEnabled && authManager.isLocalhostBinding) return;

The logic was inverted β€” it skipped auth only for non-localhost bindings with no auth, instead of localhost bindings with no auth.

Fix

One-line negation fix. Verified locally: smoke test passes, /v1/sessions returns 200.

Verification

  • npm run test:smoke β€” exits 0 βœ…
  • npm run build β€” compiles clean βœ…

Refs: #1080, #1289, #1299 (closed β€” wrong fix)

)

The auth middleware at src/server.ts:370 had an inverted negation:
  - BEFORE: if (!authEnabled && !isLocalhostBinding) return;  (wrong)
  - AFTER:  if (!authEnabled && isLocalhostBinding) return;    (correct)

The previous logic skipped auth only when binding to a non-localhost
interface with no auth configured β€” the exact opposite of the intent.
This caused the smoke test and all unauthenticated localhost requests
to be rejected with 401 after the #1080 auth guard was merged.

Refs: #1080, #1289
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