This document defines the security architecture, vulnerability disclosure guidelines, and strict security invariants for anyone using or contributing to LOKI (Synthetic Chaos & Exploratory AI Testing Agent).
Security fixes and patches are applied to the active development branch (main) and the latest release. Older releases do not receive fixes; upgrade to the latest version (loki update).
| Version | Supported |
|---|---|
Latest release / main |
✅ Supported |
| Any older release | ❌ End of Life |
We take the security of LOKI and the applications it tests very seriously. If you discover a security vulnerability (such as an authorization bypass, SSRF flaw, sensitive data exposure, or sandbox escape):
- Do NOT report security vulnerabilities via public GitHub issues, discussions, or pull requests.
- Use GitHub Private Vulnerability Reporting to submit your report confidentially.
- If Private Vulnerability Reporting is unavailable, reach out directly to the maintainer via GitHub profile contact.
- Please provide:
- A clear description of the vulnerability.
- Step-by-step reproduction instructions or a minimal proof of concept (PoC).
- Potential impact and affected modules.
- We will acknowledge receipt within 48 hours and coordinate a fix and release disclosure timeline.
LOKI executes real, chaotic browser interactions (fuzzing, burst clicks, network throttling, request mutation, and process stress). Consequently, the codebase enforces non-negotiable security boundaries that all contributors must preserve.
- Policy:
localhost,127.0.0.1,[::1], and loopback targets are unrestricted for development. Any other external domain or IP strictly requires explicit user authorization before any testing or recording session can start. - SSRF Prevention: All target URLs are sanitized by normalizing backslashes (
\) to forward slashes (/) prior to parsing (extract_host()). - Contributor Invariant ("What NOT to do"):
- ❌ NEVER add flags, parameters, or hidden options that bypass or weaken target authorization checks.
- ❌ NEVER automatically approve non-local targets without user confirmation or the
--authorizedflag in CI. - ❌ NEVER alter URL normalization in a way that allows RFC bypasses (e.g.
user@hostor backslash confusion).
- Policy: Network archives (
network.har), HTTP traces, and telemetry bundles must NEVER store unredacted credentials, API keys, or personally identifiable information (PII) on disk. - Scrubbing Scope:
- Headers:
Authorization,Cookie,Set-Cookie,X-Api-Key,X-Auth-Token,Proxy-Authorizationare masked with[REDACTED_BY_LOKI]. - Query Parameters:
token,secret,password,key,auth,access_token,refresh_tokenare redacted. - Response Bodies: JSON payloads in HTTP responses are recursively scrubbed to sanitize passwords, tokens, credit card numbers, and PII.
- Headers:
- Contributor Invariant ("What NOT to do"):
- ❌ NEVER write raw
network.haror network logs to disk without passing throughNetworkScrubber.scrub_har_file(). - ❌ NEVER log raw HTTP request/response payloads to the console or incident reports.
- ❌ NEVER disable response body or header scrubbing.
- ❌ NEVER write raw
- Policy: When users record workflows (
loki record), user-typed values in sensitive input fields must be replaced with********. - Contributor Invariant ("What NOT to do"):
- ❌ NEVER persist plain text values from
input[type="password"]or fields containingsecret,token,key, orpasswordin their identifiers or autocomplete attributes.
- ❌ NEVER persist plain text values from
- Policy: Each test session runs inside a fresh, isolated browser context (
browser.new_context()). State (cookies, local storage, indexedDB) is wiped between runs. - Contributor Invariant ("What NOT to do"):
- ❌ NEVER share stateful browser contexts between runs.
- ❌ NEVER omit
finally:cleanup blocks around Playwrightcontextandbrowserinstances. Stray browser processes waste system memory and leave listening sockets open.
- Policy: The automated code repair system must guarantee safety and idempotency.
- Guardrails:
- Mandatory Backup: Before modifying any source file, create a
.loki.bakbackup. - Deterministic Verification: Run
repro_test.pyto confirm the fix actually cures the crash without introducing harness errors. - Automatic Rollback: If verification fails or raises syntax errors, immediately restore the file from
.loki.bak. - Path Traversal Containment: All target file paths must be strictly contained within the active project root.
- Mandatory Backup: Before modifying any source file, create a
- Contributor Invariant ("What NOT to do"):
- ❌ NEVER apply in-place modifications to user code without an active backup file.
- ❌ NEVER resolve or edit files outside the project root directory.
- Policy:
loki infraonly targets processes and containers located on the local machine. It intentionally does NOT support remote SSH, cloud APIs, or remote Docker daemons. - Contributor Invariant ("What NOT to do"):
- ❌ NEVER add remote execution or remote host dispatching without dedicated host authorization.
- ❌ NEVER allow targeting protected operating system processes (PID 0, PID 1, System init) or LOKI's own process tree.
- ❌ NEVER drop the
status == LISTENfilter when resolving processes by port. - ❌ NEVER spawn stress workers without registering their PIDs in
.loki/infra_stress_workers.jsonfor deterministic cleanup.
- Policy: API keys are strictly read from environment variables (
os.environ). Missing keys result in graceful offline degradation (SKIPPED), never a crash. - Contributor Invariant ("What NOT to do"):
- ❌ NEVER hardcode, commit, or print API keys in source code, documentation, or CLI output.
- ❌ NEVER silently redirect AI prompts or project code to an unconfigured provider if the user configured a specific model or provider.
- ❌ NEVER break chat multi-turn role alternation (
userfollowed byassistant) upon provider failures.
Before opening a Pull Request:
- No hardcoded secrets, tokens, or personal paths exist in your code.
- Any network logging or storage goes through
NetworkScrubber. - External target authorization in
src/loki/safety.pyremains strictly enforced. - Path resolutions remain contained within the repository root.
- All 144+ unit and integration tests pass cleanly with
python -m pytest.