mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2026-11-17 18:43:15 +01:00
Handle short TOTP secrets rejected by PyOTP 2.12 in auth-gateway and gatekeeper forms
This commit is contained in:
@@ -4,6 +4,7 @@ import unittest
|
||||
from pathlib import Path
|
||||
|
||||
import pyotp
|
||||
|
||||
from auth_gateway.config_loader import load_runtime_config
|
||||
from auth_gateway.services.policy_engine import build_effective_policy, evaluate_ip_rules
|
||||
from auth_gateway.services.resolver import resolve_request_context
|
||||
@@ -62,10 +63,16 @@ class AuthGatewayConfigTests(unittest.TestCase):
|
||||
self.assertFalse(evaluate_ip_rules("10.10.10.10", method.rules))
|
||||
|
||||
def test_totp_verification_accepts_valid_tokens(self):
|
||||
secret = "JBSWY3DPEHPK3PXP"
|
||||
secret = "JBSWY3DPEHPK3PXPJBSWY3DPEHPK3PXP"
|
||||
token = pyotp.TOTP(secret).now()
|
||||
self.assertTrue(verify_totp(secret, token))
|
||||
|
||||
def test_totp_verification_rejects_short_secrets(self):
|
||||
self.assertFalse(verify_totp("JBSWY3DPEHPK3PXP", "123456"))
|
||||
|
||||
def test_totp_verification_rejects_invalid_secrets(self):
|
||||
self.assertFalse(verify_totp("NOT-A-BASE32-SECRET!", "123456"))
|
||||
|
||||
def test_caddyfile_uses_boundary_matchers_and_clears_identity_headers(self):
|
||||
caddyfile = build_caddyfile(
|
||||
apps=[
|
||||
|
||||
Reference in New Issue
Block a user