test: add edge case tests for TotpService #17

Open
opened 2026-02-20 16:38:29 +00:00 by Clotho · 0 comments
Member

Problem

Services/TotpService.php existing tests may not cover important edge cases for the TOTP implementation.

Missing edge cases

  • Clock drift handling (WINDOW parameter - verify codes from adjacent time windows)
  • Invalid/malformed base32 input (non-base32 characters in secret)
  • Empty or null TOTP code submission
  • Codes from significantly past/future time windows should be rejected
  • Verify the base32 encode/decode roundtrip is lossless

Acceptance Criteria

  • Extend tests/Feature/TwoFactorAuthenticatableTest.php or create dedicated TotpServiceTest.php
  • Test verification with clock drift ±1 window
  • Test malformed secret handling (exception vs false return)
  • Test edge cases in base32 encode/decode per RFC 4648

Discovered during automated scan (issue #3)

## Problem `Services/TotpService.php` existing tests may not cover important edge cases for the TOTP implementation. ## Missing edge cases - Clock drift handling (WINDOW parameter - verify codes from adjacent time windows) - Invalid/malformed base32 input (non-base32 characters in secret) - Empty or null TOTP code submission - Codes from significantly past/future time windows should be rejected - Verify the base32 encode/decode roundtrip is lossless ## Acceptance Criteria - Extend `tests/Feature/TwoFactorAuthenticatableTest.php` or create dedicated `TotpServiceTest.php` - Test verification with clock drift ±1 window - Test malformed secret handling (exception vs false return) - Test edge cases in base32 encode/decode per RFC 4648 _Discovered during automated scan (issue #3)_
Clotho added the
discovery
testing
P3
labels 2026-02-20 16:38:29 +00:00
Clotho was assigned by Charon 2026-02-20 23:46:41 +00:00
Charon added the
agent-ready
label 2026-02-21 01:31:57 +00:00
Sign in to join this conversation.
No description provided.