3 Commits
Author SHA1 Message Date
Tom MoorandClaude Opus 4.8 a054809b51 Use full keyspace for email verification codes (#13031)
* Use full keyspace for email verification codes

Email verification codes were generated with randomInt(100000, 1000000),
which can never produce a value below 100000. That excluded every code
with a leading zero — shrinking the keyspace from 1,000,000 to 900,000
and letting an attacker assume the first digit is never zero. It also
made the existing padStart(6, "0") dead code.

Draw uniformly from the full 0–999999 range and rely on padStart to
render leading zeros, restoring the full six-digit keyspace. Add tests
covering the six-digit invariant across many samples and the presence of
leading-zero codes.

* Simplify verification code jsdoc and drop leading-zero test

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EWfLg5uQdYFuzj1UBEo1og

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-18 09:35:42 -04:00
Tom MoorandClaude Opus 4.7 347bdb10d4 fix: Ensure OTP is bound to workspace (#12096)
* fix: Ensure OTP is bound to teamId

* fix: Address review feedback on OTP tenant scoping

- Trim whitespace in VerificationCode Redis keys to match DB lookup
  normalization.
- Redirect with invalid-code (rather than leaking a backend error)
  when no user exists for the email in the resolved team.
- Correct retrieve() JSDoc to state undefined instead of null.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 23:22:58 -04:00
Tom Moor 1d86a4aee4 Add limit of 10 attempts for OTP login (#11623)
* Add limit of 10 attempts for OTP login

* test
2026-03-02 18:41:03 -05:00