Skip to content

fix(auth): harden dashboard auth modes (Codex review follow-up)#384

Merged
Soju06 merged 6 commits intomainfrom
fix/dashboard-auth-mode-hardening
Apr 10, 2026
Merged

fix(auth): harden dashboard auth modes (Codex review follow-up)#384
Soju06 merged 6 commits intomainfrom
fix/dashboard-auth-mode-hardening

Conversation

@Soju06
Copy link
Copy Markdown
Owner

@Soju06 Soju06 commented Apr 10, 2026

Summary

Follow-up fixes for #366 (dashboard proxy auth modes) found during adversarial Codex review (5 rounds).

Changes

  1. password_session_active field — Distinguishes proxy-authenticated users from password-session holders so the SPA doesn't show unusable Change/Remove/TOTP buttons
  2. TOTP verify guard — Adds _ensure_password_management_enabled to verify_totp endpoint (was the only auth endpoint missing it)
  3. Verify-password dialog — Lets proxy-authenticated users re-establish a fallback password session inline, with TOTP step support
  4. Cookie header block — Adds cookie to _FORBIDDEN_PROXY_AUTH_HEADERS to prevent misconfigured proxy headers from collapsing the trust model
  5. Fully-authorized semanticspassword_session_active now requires both password AND TOTP verification (if enabled), preventing TOTP bypass via partial session
  6. Stale cookie guard — Gates password_session_active on password_required so expired cookies from a removed password don't surface management UI

Known limitation (separate issue)

_is_trusted_proxy_source uses post-ProxyHeadersMiddleware request.client.host instead of raw socket peer IP. Affects localhost reverse proxy setups (Authelia/Caddy/Nginx). Pre-existing in #366's original design — needs ASGI-level middleware to capture raw peer.

Testing

  • Backend: 26 integration + unit tests passed (including new test_trusted_header_proxy_auth_with_fallback_password_reports_no_active_session)
  • Frontend: 62 files, 332 tests passed (including new proxy-auth button visibility test)

Soju06 added 5 commits April 10, 2026 17:56
Add password_session_active field to session response so the frontend
can hide Change/Remove buttons when the user is authenticated only via
proxy header (no active cookie-based password session).

Without this, trusted_header users with a configured fallback password
see password management buttons that fail with 'Authentication required'
because the backend requires a password session for those operations.
…without password session

- Add _ensure_password_management_enabled guard to verify_totp endpoint
  (was the only auth endpoint missing it, allowing stale pre-TOTP sessions
  to complete login after switching to disabled mode)
- Condition TotpSettings rendering on passwordSessionActive so proxy-only
  users in trusted_header mode don't see controls that always fail
…e header

- Add verify dialog so proxy-authenticated users can re-establish a
  password session to unlock Change/Remove/TOTP controls
- Block Cookie as a dashboard auth proxy header to prevent browser
  session cookies from being treated as trusted identity assertions
…serve TOTP requirement for proxy fallback

- password_session_active now means fully authorized (password + TOTP
  if required), not just password-verified
- Proxy-auth branch preserves totp_required_on_login when TOTP is
  pending instead of always overriding to false
- Verify dialog gains a TOTP step so proxy-authenticated users can
  complete the full fallback login flow inline
@gitguardian
Copy link
Copy Markdown

gitguardian bot commented Apr 10, 2026

⚠️ GitGuardian has uncovered 2 secrets following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secrets in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
30078943 Triggered Generic Password db76398 app/modules/dashboard_auth/api.py View secret
30078943 Triggered Generic Password db76398 app/modules/dashboard_auth/api.py View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secrets safely. Learn here the best practices.
  3. Revoke and rotate these secrets.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@Soju06 Soju06 merged commit d106a71 into main Apr 10, 2026
14 of 15 checks passed
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