Skip to content

Fix/issue 1410 persist encrypted 2fa - #1501

Open
tonymaga-bush wants to merge 5 commits into
AtomicIP:mainfrom
tonymaga-bush:fix/issue-1410-persist-encrypted-2fa
Open

tonymaga-bush wants to merge 5 commits into
AtomicIP:mainfrom
tonymaga-bush:fix/issue-1410-persist-encrypted-2fa

Conversation

@tonymaga-bush

@tonymaga-bush tonymaga-bush commented Dec 2, 2026 •

Copy link
Copy Markdown

Title

Fix: Persist encrypted 2FA credentials and state

Description

This PR adds encrypted, persistent storage for two-factor authentication (2FA) data.

Changes

  • Add AES-256-GCM encryption for sensitive 2FA data at rest.
  • Persist TOTP secrets and replay-prevention state.
  • Persist backup-code usage to prevent previously used codes from being reused.
  • Add configurable encryption and storage paths.

Configuration

Set the following environment variables:

  • TWO_FACTOR_ENCRYPTION_KEY — encryption key used to protect stored 2FA data.
  • TWO_FACTOR_STORE_PATH — path to the persistent 2FA storage file.

Motivation

Previously, 2FA state was not reliably preserved across server restarts. This change ensures that users' 2FA configuration and security state persist securely.

Testing

Automated tests have not yet been run. Please run the relevant test suite and verify persistence across server restarts before merging.

Closes: #1410

This branch has not been deployed

No deployments
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.

2FA enrolment state is held in process memory

1 participant