Skip to content

Fix: clear the stored password when protection is turned off - #30

Merged
SandObserver merged 1 commit into
mainfrom
fix/clear-password-on-disable
Aug 10, 2026
Merged

SandObserver merged 1 commit into
mainfrom
fix/clear-password-on-disable

Conversation

@SandObserver

Copy link
Copy Markdown
Owner

Summary

  • Delete settings.auth.passwordHash and settings.auth.secret in POST /api/auth/toggle when the request disables auth, and audit the clear separately from the toggle.
  • Confirm in saveServer() before the first request of the save, so cancelling leaves every field unsaved and the stored password intact.
  • Reset the client _passwordSet flag and the security row back to "Not set" after a successful disable, so re-enabling in the same session requires a new password.
  • Add confirm.clearPassword to all six locale catalogues.

Testing
All green. Added 4 API tests covering the clear, the orphaned-hash recovery path, session invalidation and the no-password case; each was verified to fail without the fix.

Checklist

  • Stays within the project constraints: one container, no runtime dependencies, no build step (see CONTRIBUTING.md).
  • Tests added or updated for new logic, and the full suite, lint, and typechecks pass.
  • Docs updated if behavior or configuration changed.
  • CHANGELOG.md updated under Unreleased if the change is user-visible.

Disabling Password Protection only flipped settings.auth.enabled. The hash
stayed on disk, where it could not be replaced: set-password refuses while a
hash exists unless the caller holds a session, no session can be obtained while
auth is off, and login is a pure bypass that issues no cookie. A forgotten
password could only be cleared by editing the config on the data volume. The
hash also came back into force on re-enable, without the admin choosing it.

Switching auth off now deletes the hash and the session secret, so tokens
signed under it cannot be honoured if protection returns. The admin UI confirms
before the save, drops its own passwordSet flag and shows the password as not
set. Enabling still requires a stored password, so a cleared install must set a
new one.
@SandObserver SandObserver added the security Security fix label Aug 10, 2026
@SandObserver
SandObserver merged commit aa73e4e into main Aug 10, 2026
4 checks passed
@SandObserver
SandObserver deleted the fix/clear-password-on-disable branch August 10, 2026 23:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security Security fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant