test(auth): cover lockout table full slot-0 eviction - #49
Conversation
Pin auth_pair's 16-token store cap (oldest eviction), reject non-6-digit codes, and reject length-mismatched bearer tokens to reduce auth DoS and bypass regression risk.
5a24ffd to
3ec8dda
Compare
PR SummaryLow Risk Overview Adds cJSON-backed helpers to seed and inspect the on-disk token JSON array, plus tests that Adds Reviewed by Cursor Bugbot for commit ce3211c. Bugbot is set up for automated code reviews on this repo. Configure here. |
Pin lockout_find_or_create's full-table policy: the 33rd IP reuses slot 0, dropping the first IP's lockout while later slots stay locked.
3ec8dda to
ce3211c
Compare
Summary
Adds unit coverage for
/pairbrute-force lockout when the in-memory IP table is full.Risky behavior now covered
Test files added/updated
tests/test_auth.c—test_pair_lockout_table_full_evicts_slot_zeroWhy this reduces regression risk
Lockout is the gateway's pairing brute-force control. Silent slot-0 eviction is easy to break in a refactor (LRU change, wrong free-slot scan) and would either drop protection for early attackers or fail to admit new IPs. This test pins the current policy without changing production code.
Validation
make GATEWAY=0 test_auth && ./build/test_authResult:
test_auth: all tests passedNotes
http_dispatch_body413,parse_memory_limit_arg.