Skip to content

[WEB-10169] fix: use eight-digit magic sign-in codes - #10301

Merged
sriramveeraghanta merged 1 commit into
previewfrom
fix/web-10169-magic-code-entropy
Nov 16, 2026
Merged

sriramveeraghanta merged 1 commit into
previewfrom
fix/web-10169-magic-code-entropy

Conversation

@pablohashescobar

@pablohashescobar pablohashescobar commented Nov 15, 2026 •

Copy link
Copy Markdown
Member

Description

Magic sign-in codes were six digits. With five attempts per code and four codes per ten minutes per email, and no longer-term cap, that left a small code space open to slow guessing.

  • magic_code.py: codes are now eight digits (still numeric, still from secrets). The per-code attempt limit and the per-window code limit are unchanged.
  • Placeholders that showed a six-digit example (apps/space unique-code form and the auth.json locale files) now show eight digits.

A longer code was chosen over a longer lockout because a lockout would make it cheaper for someone else to lock a user out of magic sign-in.

Behavior change: users type eight digits instead of six. Nothing in the web, space or email templates validates the length.

Not changed: the email-change confirmation code in app/views/user/base.py has its own generator and stays at six digits; it needs a signed-in session.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

  • New test_generated_code_is_eight_digits in plane/tests/contract/app/test_authentication.py; the module passes (43 passed).
  • packages/i18n/scripts/sync-check.ts --ci: all locales in sync.
  • Suggested: request a magic code on web and on a published space, confirm the email shows eight digits and sign-in completes.

References

  • WEB-10169

Created with Claude Code

Summary by CodeRabbit

  • New Features
    • Email sign-in codes are now eight digits, with the updated format shown in the code-entry field across supported languages.
  • Tests
    • Added coverage to verify that generated sign-in codes contain eight digits.

Six digits left too small a code space for the per-code and per-window attempt caps. The code stays numeric and is still generated with secrets; the sign-in forms do not validate its length, so only the example placeholders change.
Copilot AI balanced review requested due to automatic review settings November 15, 2026 22:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@makeplane

makeplane Bot commented Nov 15, 2026

Copy link
Copy Markdown

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@github-actions

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit 6192b64.

@coderabbitai

coderabbitai Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Magic-code generation now creates eight-digit tokens instead of six-digit tokens. The contract test checks the generated code. The authentication input placeholder and locale examples now show eight digits.

Changes: Magic Code Length

Layer / File(s) Summary
Generate and display eight-digit codes
apps/api/plane/authentication/provider/credentials/magic_code.py, apps/api/plane/tests/contract/app/test_authentication.py, apps/space/components/account/auth-forms/unique-code.tsx, packages/i18n/src/locales/*/auth.json
The generator creates an eight-digit token. A contract test checks that the code passed to the email task has eight numeric characters. The authentication input and locale placeholders show an eight-digit example.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Bug fix

Merge Risk: Minimal · up to 6192b

Magic sign-in codes become eight digits, and the placeholders now show eight digits. The supplied evidence shows the endpoints and email accept and render the longer code, so the merge risk is minimal.

Pre-merge checks: Passed 4

Check name Status Explanation
Description check Passed The description covers the required template sections. It explains the change and the reason for it, and it marks the Type of Change boxes. It gives test scenarios and references the issue WEB-10169. …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Title check Passed The title names the main change: magic sign-in codes move from six digits to eight. The changeset matches this. It changes the token generation in magic_code.py, the placeholders in the space form and…
Full details: Description check

Explanation

The description covers the required template sections. It explains the change and the reason for it, and it marks the Type of Change boxes. It gives test scenarios and references the issue WEB-10169. The Screenshots section is left as an unfilled placeholder, which is acceptable because the template marks that section as applicable only if relevant. The description also states a behavior change for users and notes what was not changed.

Full details: Title check

Explanation

The title names the main change: magic sign-in codes move from six digits to eight. The changeset matches this. It changes the token generation in magic_code.py, the placeholders in the space form and locale files, and adds a test for eight-digit codes. The ticket tag and the 'fix' prefix do not affect the match.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c01a609a-f205-4f4a-af97-68de73d3de81
Commits

Reviewing files that changed from the base of the PR and between 290383d and 6192b64.

Files selected for processing: 21

  • apps/api/plane/authentication/provider/credentials/magic_code.py
  • apps/api/plane/tests/contract/app/test_authentication.py
  • apps/space/components/account/auth-forms/unique-code.tsx
  • packages/i18n/src/locales/bg/auth.json
  • packages/i18n/src/locales/cs/auth.json
  • packages/i18n/src/locales/de/auth.json
  • packages/i18n/src/locales/en/auth.json
  • packages/i18n/src/locales/fr/auth.json
  • packages/i18n/src/locales/id/auth.json
  • packages/i18n/src/locales/it/auth.json
  • packages/i18n/src/locales/ja/auth.json
  • packages/i18n/src/locales/ko/auth.json
  • packages/i18n/src/locales/nl/auth.json
  • packages/i18n/src/locales/pl/auth.json
  • packages/i18n/src/locales/pt-BR/auth.json
  • packages/i18n/src/locales/ru/auth.json
  • packages/i18n/src/locales/sk/auth.json
  • packages/i18n/src/locales/ua/auth.json
  • packages/i18n/src/locales/vi-VN/auth.json
  • packages/i18n/src/locales/zh-CN/auth.json
  • packages/i18n/src/locales/zh-TW/auth.json

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.

@pablohashescobar pablohashescobar changed the title [WEB-10169] fix(security): use eight-digit magic sign-in codes [WEB-10169] fix: use eight-digit magic sign-in codes Nov 16, 2026

@sriramveeraghanta sriramveeraghanta left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Codes compare as strings, so 6-digit codes already in flight during a rolling deploy still validate. Worth confirming that no client outside this repo (e.g. mobile) has a fixed 6-box input.

@sriramveeraghanta
sriramveeraghanta merged commit 0d51b87 into preview Nov 16, 2026
21 of 22 checks passed
@sriramveeraghanta
sriramveeraghanta deleted the fix/web-10169-magic-code-entropy branch November 16, 2026 20:23
sriramveeraghanta pushed a commit that referenced this pull request Nov 16, 2026
Six digits left too small a code space for the per-code and per-window attempt caps. The code stays numeric and is still generated with secrets; the sign-in forms do not validate its length, so only the example placeholders change.
Pawel-Kranzberg added a commit to klazwi/pi-plane that referenced this pull request Nov 18, 2026
Ported from makeplane#10301 (WEB-10169). The fork renamed the magic
code to one_time_code, so the generator, the placeholder in all locales and
the generation test are applied by hand to the renamed files. The four
locales whose placeholder is a word example are left as they were, as upstream
did.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
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.

3 participants