Skip to content

fix(settings): show rate-limit message on passkey 429#20531

Open
dschom wants to merge 2 commits intomainfrom
worktree-FXA-13666
Open

fix(settings): show rate-limit message on passkey 429#20531
dschom wants to merge 2 commits intomainfrom
worktree-FXA-13666

Conversation

@dschom
Copy link
Copy Markdown
Contributor

@dschom dschom commented May 6, 2026

Because

  • When a user clicks Create in Settings > Security > Passkeys and the auth-server rate-limits the request (errno 114 / HTTP 429 from POST /passkey/registration/start), the UI surfaced a misleading red banner reading "System not available. Try again later." — implying a server outage rather than a client-side throttle. QA filed this as must-fix before prod release.

This pull request

  • Detects rate-limit errors in the PagePasskeyAdd catch block by checking errno === 114 or HTTP code === 429, mirroring the existing pattern in MfaGuard for OTP requests (packages/fxa-settings/src/components/Settings/MfaGuard/index.tsx:154-160).
  • Routes the rate-limit case through getLocalizedErrorMessage() so the user sees the localized "You've tried too many times. Please try again {retryAfter}." (or generic) string from the existing auth-error-114 / auth-error-114-generic FTL keys.
  • Skips Sentry.captureException for throttle responses since they are expected behaviour rather than exceptions.
  • Emits a new rate_limited Glean reason on passkeyCreateSubmitFrontendError so the metric distinguishes throttling from real server errors. The existing reasons in this metric (not_allowed, timeout, etc.) are also free-form strings.
  • Adds three jest cases covering 429 with retryAfterLocalized on begin, 429 generic on begin, and 429 on complete.

No backend changes. No new FTL strings. Same fix covers both /passkey/registration/start and /passkey/registration/finish since the catch block is shared.

Issue that this pull request solves

Closes: FXA-13666

Checklist

Put an x in the boxes that apply

  • My commit is GPG signed.
  • If applicable, I have modified or added tests which pass locally.
  • I have added necessary documentation (if appropriate).
  • I have verified that my changes render correctly in RTL (if appropriate).
  • I have manually reviewed all AI generated code.

How to review (Optional)

  • Key files/areas to focus on:
    • packages/fxa-settings/src/components/Settings/PagePasskeyAdd/index.tsx — the rate-limit branch in the catch block.
    • packages/fxa-settings/src/components/Settings/PagePasskeyAdd/index.test.tsx — three new test cases.
  • Suggested review order: source change first, then tests.
  • Risky or complex parts: none

How to Test

  • Open rate-limit-rules.txt
  • Set passkeyRegisterStart to passkeyRegisterStart : ip_uid : 1 : 10 minutes : 10 minutes : block, which makes testing eay.
  • Login or singup.
  • Once on the setting page, click add pass key. You can then cancle
  • Repeat, you'll see the rate lmitting error message
image

@dschom dschom marked this pull request as ready for review May 7, 2026 21:46
@dschom dschom requested a review from a team as a code owner May 7, 2026 21:46
@dschom dschom force-pushed the worktree-FXA-13666 branch from a6352d2 to 3769bdf Compare May 7, 2026 22:05
dschom and others added 2 commits May 7, 2026 15:28
… mgmt

Because:
- If rate limiting errors were encountered during passkey management, an unhelpful error message would be displayed.

This PR:
- Displays standard rate limiting error messages to user in the event that rate limit is exceed.
Because:

* The passkey_create_submit_frontend_error Glean metric now emits a
  new "rate_limited" value for the "reason" extra-key, but the
  description in fxa-ui-metrics.yaml still listed only the prior
  values. Data reviewers and dashboards that key off this
  description should reflect the full set of values.

This commit:

* Adds "rate_limited" to the documented reason values for
  passkey_create_submit_frontend_error.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dschom dschom force-pushed the worktree-FXA-13666 branch from 7c51238 to f07ec69 Compare May 7, 2026 22:43
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