Skip to content

bug(platform): backup-code regeneration reopens with the previous password #3900

Closed

Description

@yannickmonney

Successful backup-code regeneration leaves the password in the next confirmation dialog

P3 client form-reset defect. The account password is retained in the mounted prompt after a successful regeneration. Reopening Regenerate backup codes reveals a prefilled masked password and enabled Confirm; a second click resubmits that earlier password without new entry.

Reproduction

  1. Open Account settings with TOTP enabled.
  2. Choose Regenerate backup codes; enter a synthetic password and Confirm.
  3. Complete/dismiss the backup-code display and choose Regenerate backup codes again.

Actual: the password field still holds the earlier value, Confirm is enabled immediately, and clicking it repeats the regeneration call with the retained password. The prompt is not reset on successful completion. Explicit Cancel followed by reopen correctly gives an empty password and disabled Confirm.

Expected: clear password state when the prompt closes, including parent-driven success closure; each fresh confirmation should start empty. This is a client form-reset defect; no claim of server authentication bypass or exposure to another account is made.

Root cause

At source 9ea5972, services/platform/app/features/settings/account/components/two-factor-section.tsx:214-216 closes via setRegenOpen(false), retaining the mounted PasswordPromptDialog. Its password state is initialized once at line 296 and cleared only in the dialog's onOpenChange handler at lines 301-305. A parent changing open does not invoke that handler, so success closure skips the reset. Lines 311-315 immediately permit resubmission of the retained value on reopen.

Isolated evidence

two-factor-regeneration-password.probe.test.tsx: two actual TwoFactorSection component tests pass. The successful path generates codes, closes, reopens, asserts retained password and enabled Confirm, and records a second call carrying the same synthetic password. The explicit-Cancel control clears it. Auth-client methods and backup-code-provider callback are fixture seams; the latter represents dismissing the separate root dialog. No real password, backup code, credential operation, browser layout or production system was used.

Dedup: searched findings.json, baseline-102.json and issues-live-batch11.json; read #2085 auth/2FA aggregate and #1507 feature body. Neither covers password retention after regeneration. Distinct from #3671 account name/discard query invalidation and generic credential draft remount #3667.

Parent independently replayed success/reopen and explicit-Cancel controls at the pinned SHA: 2 tests passed. Parent log: settings-functional-next/parent.replay.log.

Activity

  1. yannickmonney commented on Sep 29, 2026

    @yannickmonney
    ContributorAuthor

    Current-main revalidation — b7f8ca0

    Source: b7f8ca02ec249c004652b1ee52e112d9cdfa53ea. Two current-source TwoFactorSection cases reproduce successful backup-code regeneration reopening with the previous password; explicit Cancel clears it in the control. Authentication callbacks are inert. No real password or backup code was used or changed.

    Evidence: /Users/yannick/.codex/notes/tale-1000-additional/current-main-reconciliation/settings-triage/current-replay.log. Installed external dependencies are reused; app/UI/shared source points at the isolated current tree. Browser runs retain the runner/browser version warning. These revalidations add no findings and include no production testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions