[TEST-1] Coverage gaps: RateLimiter unit tests, revoke-endpoint 401 tests, SubjectValidator direct tests, untested public OpenAPI/Swagger endpoints #43

Closed
opened 2026-11-14 18:29:03 +01:00 by amiryahaya · 1 comment
Owner

Finding

RateLimiter has no direct unit tests (lockout expiry, 10-min window rollover, per-IP separation untested — only happy-path 429+reset via controllers). The most destructive endpoints (/revoke, /revoke-by-ic) have no missing/invalid-token tests. SubjectValidator only indirectly exercised. /api/v1/openapi + /swaggerui are public, unauthenticated, and completely untested.

Evidence

  • test/mdid_ws_web/controllers/cert_management_controller_test.exs (revoke describes lack 401 cases); no test/mdid_ws/auth/rate_limiter_test.exs; coverage table in audit

Impact

The authz contract of destructive operations and the rate-limiter's security boundaries are unverified.

Fix

  • Add RateLimiter unit tests (window, lockout expiry, identifier isolation, concurrency)
  • Add 401/invalid-token tests for both revoke endpoints
  • Add SubjectValidator property/table tests; smoke-test the OpenAPI endpoints

Line numbers refer to the initial import commit 282cb11. Source: comprehensive audit, 2026-11-12 (first review of this codebase).

## Finding RateLimiter has no direct unit tests (lockout expiry, 10-min window rollover, per-IP separation untested — only happy-path 429+reset via controllers). The most destructive endpoints (`/revoke`, `/revoke-by-ic`) have no missing/invalid-token tests. SubjectValidator only indirectly exercised. `/api/v1/openapi` + `/swaggerui` are public, unauthenticated, and completely untested. ## Evidence - `test/mdid_ws_web/controllers/cert_management_controller_test.exs` (revoke describes lack 401 cases); no test/mdid_ws/auth/rate_limiter_test.exs; coverage table in audit ## Impact The authz contract of destructive operations and the rate-limiter's security boundaries are unverified. ## Fix - [ ] Add RateLimiter unit tests (window, lockout expiry, identifier isolation, concurrency) - [ ] Add 401/invalid-token tests for both revoke endpoints - [ ] Add SubjectValidator property/table tests; smoke-test the OpenAPI endpoints _Line numbers refer to the initial import commit `282cb11`. Source: comprehensive audit, 2026-11-12 (first review of this codebase)._
Author
Owner

Verified fixed on main (1b6216b): RateLimiter, SubjectValidator and revoke-auth/OpenAPI tests exist (B5).

Verified fixed on main (1b6216b): RateLimiter, SubjectValidator and revoke-auth/OpenAPI tests exist (B5).
Sign in to join this conversation.
No description provided.