LOKI LogoLOKIv1.10.0

API & Auth Chaos

Inject semantic HTTP faults, corrupt JSON payloads, and disrupt auth tokens mid-flight via ApiChaosEngine.

Usage

bash
loki run http://localhost:8000 --persona network-tormentor --api-chaos --fault-rate 0.5 --auth-chaos
loki run http://localhost:8000 --swarm --no-auth-chaos

Active personas

ApiChaosEngine attaches during network-tormentor, swarm (--swarm), and all runs when --api-chaos is enabled (on by default).

API fault types (`--api-chaos`, `--fault-rate`)

FlagTypeDefaultDescription
status_codefault_type500, 502, 503, 504Fulfills the intercepted request with a synthetic 5xx JSON error payload.
corrupt_jsonfault_typeonFetches the real response and recursively mutates JSON values (null, "NaN", -999999, boolean inversion, empty arrays, and monster strings).
delayfault_type1500–3500 msInjects random latency (delay_range_ms) before fulfilling the real response.
empty_responsefault_type200 {}Fulfills the request with HTTP 200 and an empty {} JSON object.
schema_stripfault_type1–2 keysStrips 1–2 keys from the real JSON response (or empties arrays) to expose missing optional chaining (?.).

Auth & session faults (`--auth-chaos`)

FlagTypeDefaultDescription
token_invalidationauth_fault_typein-flightStrips sensitive authentication headers (Authorization, X-API-Key, etc.) from outgoing requests in-flight.
token_corruptionauth_fault_typein-flightReplaces sensitive auth headers in-flight with Bearer loki_corrupted_expired_token_signature_invalid.
401_unauthorizedauth_fault_typeHTTP 401Fulfills authenticated requests with a synthetic 401 Unauthorized JSON payload (AUTH_TOKEN_EXPIRED).
403_forbiddenauth_fault_typeHTTP 403Fulfills authenticated requests with a synthetic 403 Forbidden JSON payload.
cookie_evictionsessionmid-runClears all browser context cookies mid-session (evict_session_cookies) and checks for blank screens, infinite spinners, or unmounted #root/#app containers.