Repository navigation
fix(opensecret): enforce 8-64 character password policy on user-account password boundaries - #1477
Merged
Merged
Conversation
w3irdrobot
force-pushed
the
fix/opensecret-password-policy
branch
from
November 6, 2026 02:44
26f7e88 to
4e06407
Compare
w3irdrobot
changed the base branch from
feat/recovery-credentials-integrated
to
master
November 6, 2026 02:46
Contributor
|
something messed up with cicd due to the force push and edit. can you rebase and trigger it again? |
…nt password boundaries The backend accepted any password string - including the empty string - at every user-account password boundary. Platform routes already validated 8-64 via the validator crate, but /register, /password-reset/confirm and /protected/change_password did not. Add a shared password policy (8-64 Unicode characters, counted per character like the Agent client) and enforce it before any database or seed-wrap effect at those three boundaries. Login is intentionally not length-validated: a wrong-length attempt is an authentication failure, and existing accounts (including short-password ones) keep working. Rejects return 400 with a specific message (PasswordTooShort / PasswordTooLong) so clients can surface the reason. A rejected reset does not consume the one-shot reset request; a rejected password change leaves the current credential intact. Covered by unit tests plus disposable-database route tests proving rejection without side effects on register and change_password. The transport-v2 password-reset completion route lands with the recovery credentials work (#1470) and will pick up the same policy there.
w3irdrobot
force-pushed
the
fix/opensecret-password-policy
branch
from
November 6, 2026 03:35
4e06407 to
d74c663
Compare
Contributor
Author
|
@AnthonyRonning should be good now |
AnthonyRonning
approved these changes
Nov 6, 2026
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
The backend accepted any password string — including the empty string — at every user-account password boundary. This PR adds a shared server-side password policy of 8–64 characters and enforces it before any database or seed-wrap effect. (Confirmed empirically before the fix:
POST /registerandPOST /loginboth succeeded withpassword: ""over the real encrypted transport.)The platform routes already validated 8–64 via the
validatorcrate; this closes the same gap for user accounts, using one shared policy module so all boundaries stay in sync.Functional changes
POST /register(email + guest signup)""POST /password-reset/confirm(v1)new_passwordacceptedPOST /protected/change_passwordnew_passwordaccepted400with a specific message ("Password must be at least 8 characters"/"Password must not exceed 64 characters") so clients that surfaceerror.messageshow a real reason instead of a genericBad Request.Intentionally unchanged
POST /loginis not length-validated: a wrong-length attempt is simply an authentication failure, and existing accounts (including short-password ones) keep working. This stops new bad credentials without locking anyone out.Follow-up
The transport-v2 password-reset completion route (
/password-reset/v2/complete) lands with #1470 and is not on master yet. Once this PR merges, #1470 should pick up the same one-linevalidate_passwordcall for itsnew_passwordso the policy covers that route too.Client notes
400the client doesn't pre-validate. It surfaces cleanly; a small frontend follow-up can align the forms.MIN_PASSWORD_LENGTH = 8) matches the new floor; no change needed.Validation
cargo fmt --checkclean;clippy -D warningsclean;cargo test --locked --all-features→ 1110 passed, 0 failed (includes the source-scanningsecurity_invariantssuite).password_policy_route_tests.rs) prove empty/7-char/65-char passwords are rejected with the exact messages on register and change-password — and that a rejected register creates no user row while a rejected change leaves the old credential authenticating. 2 passed against an isolated temp Postgres cluster (created, migrated, removed).