Skip to content

Require password proof when disabling TOTP#33

Merged
sidhujag merged 3 commits intomasterfrom
fix/totp-disable-step-up
Apr 25, 2026
Merged

Require password proof when disabling TOTP#33
sidhujag merged 3 commits intomasterfrom
fix/totp-disable-step-up

Conversation

@sidhujag
Copy link
Copy Markdown
Member

Summary

  • Show the current-password field when TOTP is enabled.
  • Derive and send oldAuthHash alongside the authenticator code when disabling TOTP.
  • Add auth service and TwoFactorCard coverage for the new contract.

Test plan

  • npm test -- --watchAll=false src/components/TwoFactorCard.test.js src/lib/authService.test.js
  • ReadLints on changed frontend files

Made with Cursor

Send current-password step-up proof with the TOTP disable request so the UI matches the hardened backend contract.

Made-with: Cursor
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fd35904e39

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/components/TwoFactorCard.js Outdated
) : null}

{!status.enabled ? (
{!setup ? (
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep password field editable during active TOTP setup

Switching the password field guard to !setup hides the current-password input as soon as setup starts, but enable() still derives oldAuthHash from currentPassword. If the server returns invalid_credentials at this stage (for example, password changed in another session between setup and verify), the UI shows an error but provides no way to correct the password because the field is hidden while setup is truthy, so the flow is effectively stuck until a full refresh.

Useful? React with 👍 / 👎.

Keep the current-password field available during active setup so users can correct stale password proof before enabling TOTP.

Made-with: Cursor
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

Addressed the inline P2 by keeping the current-password field available during active TOTP setup, so users can correct stale password proof before retrying enable. Added regression coverage for editing the field while setup is active.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 38cd41a1e5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/components/TwoFactorCard.js Outdated
) : null}

{!status.enabled ? (
{!recoveryCodes ? (
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep password input visible while recovery codes are active

The new disable() flow now always derives oldAuthHash, but this render guard hides the current-password field whenever recoveryCodes exists. After a successful enable, recoveryCodes is set and currentPassword is cleared, while the “Disable two-factor authentication” button remains available; clicking disable then repeatedly fails with password_required and the user has no way to correct it in-session (without a full reload).

Useful? React with 👍 / 👎.

Keep the current-password field visible through setup, recovery-code display, and disable states so step-up retries cannot get stuck.

Made-with: Cursor
@sidhujag
Copy link
Copy Markdown
Member Author

@codex review

Addressed the second inline P2 by making the current-password field always available in the TOTP card body, including while recovery codes are displayed and disable remains available. Added regression coverage for that recovery-code state.

@chatgpt-codex-connector
Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Delightful!

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@sidhujag sidhujag merged commit d8243a6 into master Apr 25, 2026
4 checks passed
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