Skip to content

fix(auth): lower new-password minimum to 8 chars and cap length at 128 - #4

Merged
andrespineli merged 2 commits into
mainfrom
fix/password-policy-8-128
Aug 7, 2026
Merged

fix(auth): lower new-password minimum to 8 chars and cap length at 128#4
andrespineli merged 2 commits into
mainfrom
fix/password-policy-8-128

Conversation

@andrespineli

@andrespineli andrespineli commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Lowers the minimum length for new master passwords from 16 to 8 characters (Password.strong()), fixing the inconsistency where the TUI form and OpenRPC schema already advertised a minimum of 8 but the server rejected anything under 16.
  • Adds a 128-character maximum, enforced in the Password constructor so it also bounds the unauthenticated auth.authenticate path.

Why 128 as the maximum?

The password feeds the Argon2id key derivation (hash-wasm, 256 MB / 3 iterations) that unlocks the AES-256-GCM key. Unlike bcrypt, Argon2 has no truncation limit, so there is no crypto-correctness constraint — the cap is input hygiene: without it, an arbitrarily long string flows into a 256 MB KDF on an unauthenticated endpoint. NIST SP 800-63B requires accepting at least 64 characters; 128 leaves ample room for passphrases.

Changes

  • server/src/auth/domain/models/password.tsSTRONG_MINIMUM 16 → 8, new MAXIMUM = 128 enforced in the constructor
  • server/src/auth/domain/exceptions/password-too-long.ts — new parameterized exception, mirroring WeakPassword
  • libs/jsonrpc-schemas/auth.openrpc.jsonmaxLength: 128 on MasterPassword and MasterPasswordVerify, description updated; auth.gen.ts regenerated via deno task contracts:codegen
  • tui/ink/src/auth/configure-password-form.tsx — client-side max gate + hint text "8-128 characters"
  • Unit + integration tests updated with boundary cases (7/8 and 128/129)

Testing

  • deno task check — clean
  • deno task test — 622 passed, 0 failed (an unrelated StationDetailScreen TUI render test flaked once under full-suite load; it passes in isolation and on re-run, on main and on this branch alike)

The 16-char minimum for new passwords was stricter than intended and
inconsistent with the TUI form and OpenRPC schema, which already said 8.
Also adds a 128-char maximum: the password feeds the Argon2id derivation
(256 MB memory cost) on the unauthenticated authenticate path, so input
must be bounded. Argon2 itself has no truncation limit, so 128 is purely
input hygiene (NIST 800-63B asks for at least 64 to be accepted).
@andrespineli
andrespineli force-pushed the fix/password-policy-8-128 branch from ea1be12 to 4a0d73a Compare August 7, 2026 11:36
deno audit was failing the Quality gate on three high advisories in
transitive deps: fast-uri <3.1.5 (host confusion, via ajv) and
ip-address <=10.3.0 (SSRF octal-octet bypass, via ssh2/socks).
Regenerating the lockfile resolves fast-uri 3.1.5, ip-address 10.4.0,
hono 4.13.0 and @hono/node-server 2.1.0, which also clears the four
moderate advisories. Full suite stays green.
@andrespineli
andrespineli merged commit 72a89fb into main Aug 7, 2026
6 checks passed
@andrespineli
andrespineli deleted the fix/password-policy-8-128 branch August 7, 2026 15:02
@andrespineli andrespineli mentioned this pull request Aug 7, 2026
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