Files
outline/server/utils
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
..