fix: refuse zero-value totp, blank password characters and non-canonical email local parts - #479
Merged
Merged
Conversation
…olicy snapshots, the ceilings and the label parser Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
…get an RFC 4226 oracle Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
…the empty MX answer Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
Merged
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.
Closes #478 in four commits, one per package, each building and passing on its own.
password
isPrintablealso refuses U+2800 BRAILLE PATTERN BLANK and the code points in Unicode'sOther_Default_Ignorable_Code_Point(the Hangul fillers, U+034F and the like), whichunicode.IsPrintadmits although they render as nothing. Variation selectors stay accepted: they modify a visible base. The package doc anddocs/password.mdsay what is refused. A new password holding one of these is refused now; existing hashes verify as before, sinceVerifyapplies no policy.Hashnormalises to NFC (NFD register, NFD and NFC sign-in); all four*boolpolicy snapshots, by flipping the caller's variable afterNew; theMemoryandIterationsceilings atNew, with the value at the ceiling accepted; and a stored hash with a bare label ($v$,$m$, ...) refused withErrInvalidHashrather than panicking.totp
Enroll,VerifyStepandVerifywithErrNotInitialised,VerifyRecoveryCodewith(0, false), andHashRecoveryCodenow returns(string, error)so it can report it, the change fix(auth): refuse the inputs that produced output under an empty key #425 made toapikey.Hashfor the same reason. The sentinel is indocs/errors.md.FuzzVerifyhas an oracle: RFC 4226 written apart from the package (HMAC-SHA1, dynamic truncation, six digits) decides which codes the fixed clock's window accepts, andVerifyStepandVerify(with an in-memory recorder) must agree exactly. Seeds cover every step of the window and one outside it on each side.email
i). U+212A KELVIN SIGN is canonically equivalent to K and becomeskthrough NFC, which the test states.josé@now stores asjosé@, so a row stored from decomposed input before this change no longer matches; I know of none.evictExpired, which nothing in production called, is gone; the eviction insidestoreis tested with a full cache of expired entries, and an empty MX answer with no error is pinned asErrDomainNoMX. ThemaxCacheSizecomment no longer describes a background goroutine.username: the fuzz target asserts the
[a-z0-9_-]set, the length bounds and the reserved list on every accepted value, with seeds that put a disallowed byte between allowed ones, since the start and end rules refuse the old seeds beforeisAllowedsees them.Sabotage, each edit confirmed to change the file:
HashTestHash_normalisesTheInputItHashesfailsrefusesWorkFactorsPastTheCeilingsfailsEnroll,HashRecoveryCodeorVerifyRecoveryCodeguardstepMatchesaccept every codeFuzzVerifyfails on its seedsisAllowedaccept every byteFuzzValidateAndNormalizefails on the new seedsgofmt,go vet ./...,go test -race -count=1 ./..., gosec and the nine example builds are clean. Coverage: password 98.8%, totp 95.4%, email 95.9%, username 94.8%.Signed-off-by: Jaro-c 75870284+Jaro-c@users.noreply.github.com