[PR #2423] [MERGED] fix: prevent TOTP passcode reuse within validity window #9972

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

📋 Pull Request Information

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

Base: fix-caldav-2fa-bypassHead: fix-totp-reuse


📝 Commits (5)

  • 819ed13 test: add TOTP fixture and load it in user test bootstrap
  • e6d5bf7 test: add failing test for TOTP passcode reuse prevention
  • 6ef72a3 fix: prevent TOTP passcode reuse within validity window
  • d2d3e54 fix: update TOTP reuse test to use user10 matching rebased fixture
  • 8438fd7 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/2423 **Author:** [@tink-bot](https://github.com/tink-bot) **Created:** 3/20/2026 **Status:** ✅ Merged **Merged:** 3/20/2026 **Merged by:** [@kolaente](https://github.com/kolaente) **Base:** `fix-caldav-2fa-bypass` ← **Head:** `fix-totp-reuse` --- ### 📝 Commits (5) - [`819ed13`](https://github.com/go-vikunja/vikunja/commit/819ed13265c8451f0f5301c7a49f83275fee22eb) test: add TOTP fixture and load it in user test bootstrap - [`e6d5bf7`](https://github.com/go-vikunja/vikunja/commit/e6d5bf71f52980eff9006ea2f1bee9a07ad8338d) test: add failing test for TOTP passcode reuse prevention - [`6ef72a3`](https://github.com/go-vikunja/vikunja/commit/6ef72a38a48ba68f9d053b4cf8ec8507009705f5) fix: prevent TOTP passcode reuse within validity window - [`d2d3e54`](https://github.com/go-vikunja/vikunja/commit/d2d3e5428b65db35fb0d689ed7bf0934356efe59) fix: update TOTP reuse test to use user10 matching rebased fixture - [`8438fd7`](https://github.com/go-vikunja/vikunja/commit/8438fd7cd0f599d536e1397359a435e82ee07bc9) 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:15 -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#9972