-
Notifications
You must be signed in to change notification settings - Fork 0
Closed
Labels
P0Production blocker - must fix immediatelyProduction blocker - must fix immediatelybugSomething isn't workingSomething isn't workingsecuritySecurity related changesSecurity related changes
Description
📋 Sub-task of #94
Critical Security Issue
TwoFactorAuthService.swift:252 contains hardcoded verification code '123456' which is a severe security vulnerability.
Current Implementation
// Line 252: FIXME - Mock verification (hardcoded)
private func verifyCode(_ code: String) -> Bool {
return code == "123456"
}Required Changes
- Remove hardcoded PIN from TwoFactorAuthService
- Implement secure code generation using CryptoKit
- Add time-based one-time password (TOTP) support
- Store secrets securely in Keychain
- Add code expiration (30 seconds)
- Implement retry limits and lockout
Implementation Details
- Generate cryptographically secure codes
- Store shared secret in Keychain
- Implement TOTP algorithm (RFC 6238)
- Add rate limiting for verification attempts
- Log security events for audit trail
Security Requirements
- Codes must be 6-8 digits
- Expire after 30 seconds
- Maximum 3 retry attempts
- 5-minute lockout after failures
- Secure random number generation
Testing Requirements
- Test code generation randomness
- Test expiration timing
- Test retry limit enforcement
- Test keychain storage/retrieval
- Security penetration testing
Files to Update
- Modules/Core/Sources/Services/TwoFactorAuthService.swift
- Create: Modules/Core/Sources/Services/TOTPGenerator.swift
Estimated Effort: 2 days
Priority: P0 - Critical Security Fix
Metadata
Metadata
Assignees
Labels
P0Production blocker - must fix immediatelyProduction blocker - must fix immediatelybugSomething isn't workingSomething isn't workingsecuritySecurity related changesSecurity related changes