Skip to content

Feat/password policy2 - #10

Merged
raymondproguy merged 4 commits into
mainfrom
feat/password-policy2
Sep 3, 2026
Merged

Feat/password policy2#10
raymondproguy merged 4 commits into
mainfrom
feat/password-policy2

Conversation

@raymondproguy

Copy link
Copy Markdown
Contributor

No description provided.

Swapping the real crypto/rand.Reader package variable to simulate an
entropy-source failure isn't portable: on at least one real platform
(reported: Termux/Android), a failed read through that actual global
triggers the Go runtime's own unrecoverable fatal-error path instead
of returning a normal error — crashing the entire test binary rather
than failing one test.

CryptoRandTokenGenerator now holds its own randReader field (defaults
to crypto/rand.Reader, set in the constructor), and the regression
test injects a fake failing reader directly into a same-package
instance instead of mutating any global state. Same coverage, no
process-crashing side effect.
TestGoWebAuthnProvider_LoginRoundTrip asserted the returned
credential's SignCount must be nonzero after a real login.
virtualwebauthn's simulated credential starts at counter 0 and never
auto-increments on its own — and a counter of 0 is itself a
legitimate, spec-allowed value (many real platform authenticators
never track one at all), so the assertion was simply testing a false
assumption, not a real property of the code under test.

Now manually sets the simulated credential's counter to a known
nonzero value before the login call and asserts FinishLogin correctly
surfaces that exact value — actually exercising the pass-through path
this test cares about (persisting whatever the authenticator reports,
which is what makes cloned-authenticator detection possible later)
instead of an assumption that doesn't hold.
Missed when SignUp/ChangePassword's signature changed on the stacked
feat/password-policy branch — this file was written earlier on
feat/breached-password-check and never revisited, so it built fine on
that branch alone but failed to compile once merged after the
password-policy signature change landed on top. Same class of miss as
an earlier one on login_second_factor_test.go — a full grep across
every call site for a changed signature, not just the files touched in
that commit, is the actual fix to the process here.
@raymondproguy
raymondproguy merged commit 8835f98 into main Sep 3, 2026
1 check passed
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