Repository navigation
Fix: stop a password being stored and deleted in one save - #32
Merged
Merged
Conversation
Typing a password in the same save that switches Password Protection off stored it first, which rotates the session secret and signs every other device out, and the toggle then deleted it a moment later. The save reported success. The password is now left unwritten, and the field is cleared so it cannot read as one the dashboard holds. The toggle route accepts only a real true or false. An empty body, a null or a string used to be read as off, permanently deleting the stored password and secret over a request that said nothing. The sign-out row is resynced after protection is turned off, where it could stay on screen and answer with an error, and the change listener that kept it in step is attached again: it hung off an element that does not exist in the markup, so it never ran. The dead branch also wired the password strength meter, which admin.js already does. Password and Unsplash key status labels are translated rather than always reading in English.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
shouldWritePasswordbesideauthEnableBlockedand gate the set-password call on it, so a password typed in the same save that switches protection off is never written; writing it rotated the session secret, signing every other device out, before the toggle deleted it again./api/auth/togglebody whoseenabledis not a boolean;{},null,0and"false"were read as off and permanently deletedpasswordHashandsecret.sec-sub, which exists nowhere in the markup, so the listener never ran; the same dead branch wired the password strength meter, whichinitSecToggleinadmin.jsalready does.common.configuredandcommon.notSetkeys in all six locales.auth.jsthat clearing the hash lets anyone who can reach the dashboard while protection is off set a password, which is accepted because protection being off already exposes the whole config.Testing
All green: 1092 backend, 609 frontend, 94.8% line coverage, lint, format, both typechecks,
paths:checkand cache-busting. Added 9 tests: six malformed toggle bodies that must change nothing, and the write-password rule.Checklist