You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Used authenticator codes: three small things left after #58 #59
From the audit of #58 (workers/auth/used-codes.ts). None of them is a way in; each makes the control easier to trust or to operate.
Done when
A write that fails for another reason is told to the operator. Every failure of the claim's write is answered as a wrong code, which is the safe side, but nothing is logged: if the database refuses writes, every person sees "Invalid code" and the log is silent. One log line (never the code, never the key) when the failure is not the key being there already.
The key says what it is for. The claim's key is an HMAC under the instance secret over the person and the code. The same secret signs other things; put a fixed label of this use into what is signed, so that a value made here can never mean something elsewhere.
The module says who removes old claims, and a test holds it. The comment says a claim "is then replaced", which is true only when the same person meets the same six digits again. What removes the rest is the sign-in library's own clean-up of expired rows whenever it looks one up (read in the installed version; the option that turns it off is not set). Say that, and hold it with a test that fails if the clean-up stops, since an option or an update could end it silently.
The two minutes follow the library's settings.USED_CODE_SECONDS is right for a period of 30 seconds and a window of one step. A test reads the configured period and window and fails when they no longer fit.
Activity