[PR #2428] [MERGED] fix: prevent TOTP passcode reuse within validity window #9977

Closed
opened 2026-04-23 09:19:23 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/go-vikunja/vikunja/pull/2428
Author: @tink-bot
Created: 3/20/2026
Status: Merged
Merged: 3/23/2026
Merged by: @kolaente

Base: mainHead: fix-totp-reuse


📝 Commits (5)

  • e924916 test: add TOTP fixture and load it in user test bootstrap
  • 0ccebc5 test: add failing test for TOTP passcode reuse prevention
  • 1088495 fix: prevent TOTP passcode reuse within validity window
  • 0546acf fix: update TOTP reuse test to use user10 matching rebased fixture
  • eaebbbd fix: add TTL-based expiry and cleanup for used TOTP passcode entries

📊 Changes

4 files changed (+128 additions, -1 deletions)

View changed files

📝 pkg/user/error.go (+26 -0)
📝 pkg/user/test.go (+1 -1)
📝 pkg/user/totp.go (+44 -0)
pkg/user/totp_test.go (+57 -0)

📄 Description

TOTP passcodes can be reused within their 30-second validity window. After validating a TOTP passcode, stores a timestamp in the keyvalue store keyed by user ID and passcode. Subsequent uses of the same passcode within 90 seconds (30s window + clock skew) are rejected. Expired entries are lazily cleaned up via a background goroutine to prevent unbounded growth.

Depends on #2422 for the TOTP fixture data.

Security Advisory: GHSA-p747-qc5p-773r


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/go-vikunja/vikunja/pull/2428 **Author:** [@tink-bot](https://github.com/tink-bot) **Created:** 3/20/2026 **Status:** ✅ Merged **Merged:** 3/23/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `main` ← **Head:** `fix-totp-reuse` --- ### 📝 Commits (5) - [`e924916`](https://github.com/go-vikunja/vikunja/commit/e9249161f8a2fa249621dd9fa33aeb1a872eceb5) test: add TOTP fixture and load it in user test bootstrap - [`0ccebc5`](https://github.com/go-vikunja/vikunja/commit/0ccebc5e445ed9788e4ba2659c3aed8cd94fa548) test: add failing test for TOTP passcode reuse prevention - [`1088495`](https://github.com/go-vikunja/vikunja/commit/1088495843084dbaaad4053515347091a9bc701f) fix: prevent TOTP passcode reuse within validity window - [`0546acf`](https://github.com/go-vikunja/vikunja/commit/0546acf6121c8e88fdc7379aaf0557000d51ba42) fix: update TOTP reuse test to use user10 matching rebased fixture - [`eaebbbd`](https://github.com/go-vikunja/vikunja/commit/eaebbbd5ef66ff7ea1e557f6afc540a87cd8e4c6) fix: add TTL-based expiry and cleanup for used TOTP passcode entries ### 📊 Changes **4 files changed** (+128 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `pkg/user/error.go` (+26 -0) 📝 `pkg/user/test.go` (+1 -1) 📝 `pkg/user/totp.go` (+44 -0) ➕ `pkg/user/totp_test.go` (+57 -0) </details> ### 📄 Description TOTP passcodes can be reused within their 30-second validity window. After validating a TOTP passcode, stores a timestamp in the keyvalue store keyed by user ID and passcode. Subsequent uses of the same passcode within 90 seconds (30s window + clock skew) are rejected. Expired entries are lazily cleaned up via a background goroutine to prevent unbounded growth. Depends on #2422 for the TOTP fixture data. Security Advisory: GHSA-p747-qc5p-773r --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-23 09:19:24 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/vikunja#9977