feat(auth): 12-character minimum, 72-byte maximum and breach check for new passwords

- New passwords (create user, admin reset, own change) need at least 12
  characters (ASVS 2.1.1) and may not exceed 72 bytes, which bcrypt would
  silently cut off.
- They are checked against Have I Been Pwned with k-anonymity (only the
  first 5 SHA-1 characters leave the server, padded responses); an
  unreachable service is logged and does not block. PASSWORD_BREACH_CHECK
  =false disables it for offline deployments.
- Login accepts existing passwords as before, capped at 256 characters to
  bound anonymous bcrypt work.
- Password fields in the UI say the rule up front.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
Nick SzaunigandClaude Opus 5.5 committed 2026-10-01 02:47:09 +02:00
1 parent 61e32474e4
commit 0ba8996e3a
13 files changed
+212 -17

No files matched your search

@@ -8,7 +8,12 @@ describe('requestLoggerMiddleware', () => {
});
function fakeRequest(): Request {
return { method: 'GET', originalUrl: '/api/v1/dashboard' } as Request;
return {
method: 'GET',
baseUrl: '',
path: '/api/v1/dashboard',
originalUrl: '/api/v1/dashboard?q=secret',
} as Request;
}
function fakeResponse(statusCode: number): {