Skip to content

fix(auth): disable password login and Fever when no password is set - #287

Merged
0x2E merged 1 commit into
mainfrom
fix/oidc-only-auth-bypass-1
Nov 22, 2026
Merged

0x2E merged 1 commit into
mainfrom
fix/oidc-only-auth-bypass-1

Conversation

@0x2E

@0x2E 0x2E commented Nov 22, 2026

Copy link
Copy Markdown
Owner

Summary

With OIDC configured and no password, the empty password was still treated as a credential. Auth methods now follow the configured credentials:

Config POST /api/sessions Fever key
password set registered md5(user:password)
OIDC only not registered (404) empty → always auth:0
neither (anon) not registered unchanged (md5(user:))
 New()
+  passwordEnabled = TrimSpace(password) != ""
-  passwordHash = bcrypt(password)
+  if passwordEnabled: passwordHash = bcrypt(password)
-  feverAPIKey = md5(user:password)
+  feverAPIKey = passwordEnabled ? md5(user:password)
+              : anonymous      ? md5(user:)
+              : ""             // warn: Fever disabled
 SetupRouter()
-  POST /api/sessions
+  if passwordEnabled: POST /api/sessions
   GET/DELETE /api/sessions   // still needed for OIDC sessions

Refs #276

Evidence

  • Before: TestOIDCOnlyDisablesPasswordLoginAndFever against the old handler.go: OIDC-only login returns 200 with a session cookie, and Fever returns auth:1.
    After: go test -count=1 ./... passes.
  • End-to-end on a release-style build with a local signing OIDC IdP: full OIDC login, logout, FUSION_OIDC_ALLOWED_USER, and forged/replayed callbacks behave correctly. Password+OIDC and anonymous modes are unchanged.

Merge Danger

Door: two-way

Blast Radius: auth

  • OIDC-only deployments lose Fever access. Fever clients need FUSION_PASSWORD set.
  • A whitespace-only FUSION_PASSWORD now counts as unset. In anonymous mode the Fever key becomes md5(user:).
  • The login page still shows the password form in OIDC-only mode; submitting it shows "invalid password". A follow-up hides it.

🤖 Generated with Claude Code

In OIDC-only deployments (OIDC configured, FUSION_PASSWORD empty) the
empty password was still hashed and accepted by POST /api/sessions, and
the Fever API key was derived from it. Neither should exist without a
configured password.

- Treat a whitespace-only password as unset everywhere.
- Without a password, skip hashing and do not register POST
  /api/sessions; GET/DELETE stay for OIDC sessions.
- Fever: key from the password when set, unchanged in anonymous mode,
  empty (always auth:0) in OIDC-only mode, with a startup warning.
- Add handler tests for OIDC-only, password and anonymous modes.

Refs #276

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@0x2E
0x2E merged commit c281770 into main Nov 22, 2026
1 check passed
nicnic-cc added a commit to nicnic-cc/refusion that referenced this pull request Nov 23, 2026
- brings upstream's oidc-only auth fix (0x2E#287), which closes the same hole as our 652160e
- keeps our passwordAuthDisabled guard and its test for now: dropping them deletes a committed test
- docs/fever-api.md stays deleted, upstream's new lines went to .agents/notes/fever-api.md
- go mod tidy raised x/tools and x/mod past upstream's pins because our deps are newer
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