Repository navigation
perf(auth): score the password strength meter on the server - #1582
Merged
Merged
Conversation
The meter loaded zxcvbn in the browser on demand. Its word-frequency dictionaries are about 375 KB gzip, more than any page of the app, and they made up most of the distinct client code the bundle budget counts: the release branch sat at the 1990 KB cap. The server already runs the same estimator when the form is sent. POST /api/auth/password-strength answers zxcvbn's score and untranslated feedback for at most 256 characters. Anonymous like the registration form that uses it, rate limited per address before the body is read, stores nothing. The meter asks once typing pauses (200 ms), keeps the last answer until the next one arrives, and translates the feedback as before. Distinct client code on a local build: 1991 to 1601 KB gzip in 1296 modules; first loads unchanged. The cap drops from 1990 to 1640 so it can still catch a regression of that size.
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.
The release branch sat at the 1990 KB gz cap on distinct client code (1991 locally, just under in CI). Source-map attribution of a local build put 375 KB gz of it in one module: zxcvbn's word-frequency dictionaries, which the password strength meter loaded on demand in the browser. Lazy loading does not lower that number (every module counts once wherever it loads), so the dictionaries have to leave the client.
POST /api/auth/password-strengthanswers zxcvbn's score and untranslated feedback for at most 256 characters. Anonymous like the registration form, rate limited per address (60 a minute) before the body is read, stores nothing. Public path in the proxy, published in the contract withsecurity: [], listed in the security-declaration and feature-key guards.PasswordStrength: registration, profile claim, admin reset) asks once typing pauses (200 ms), aborts the previous request, keeps the last answer until the next arrives, translates feedback as before. Same score and same feedback strings as the in-browser library.bundle-budget.json:uniqueClientKbGz1990 to 1640, so the gate can still catch a regression this size.Checked: tsc, lint, full unit suite (only the known dump-core failure), route test, e2e
invite-registrationandv142-managed-profile-handoveron desktop and mobile against a local production build, and the meter on/auth/registerin a browser (two typing bursts, two requests, same labels and feedback).