Changelog v1.9.1
Comprehensive security audit hardening (SECURITY.md, SSRF/path containment, HAR response scrubbing) and Docker detection in loki init.
v1.9.1Oct 3, 2026Syncing from GitHub…
Added
- Docker & Container Detection in
loki init(src/loki/engine/scanner.py): - Model Profile Registry Test Suite (
tests/test_config.py):
Security Hardening & Bug Fixes
This release completes a comprehensive security, concurrency, and stability overhaul across all core engine subsystems, resolving all 14 findings identified in the project security audit.
🔒 Security & Privacy Hardening
- SSRF & Authorization Bypass Prevention (
SEC-01,src/loki/safety.py):- Enforced POSIX forward-slash normalization on URLs before parsing to prevent backslash (
\) discrepancy vulnerabilities between Python'surllib.parseand underlying browser network engines. - Hardened host authorization checks against path-confusion and authority spoofing.
- Enforced POSIX forward-slash normalization on URLs before parsing to prevent backslash (
- Defensive Containment in Source Code Healing (
SEC-02,src/loki/engine/healer.py):- Enforced strict project repository root containment (
Path.is_relative_to(repo_root)) inresolve_source_file(),apply_patch(), androllback()to prevent arbitrary file read/write and path traversal attacks. - Corrected file extension regex alternation ordering (
(?:html|jsx|js|tsx|ts|...)with word boundaries) so.jsxand.tsxsource files are not prematurely truncated to.jsand.ts.
- Enforced strict project repository root containment (
- Sensitive Credential & PII Scrubbing in HAR Responses (
SEC-03,src/loki/engine/scrubber.py):- Extended
NetworkScrubberto sanitize sensitive authentication credentials, Bearer tokens, private keys, passwords, and PII from intercepted HTTP response bodies in addition to request headers.
- Extended
- Canonical Security Constitution (
SECURITY.md):- Created project-wide
SECURITY.mdestablishing non-negotiable security invariants, target authorization gates, journey credential masking, and private vulnerability reporting workflows.
- Created project-wide
⚡ Engine & Playwright Stability
- Route Hanging Elimination in API Chaos (
ENG-01,src/loki/engine/api_chaos.py):- Fixed an invalid Playwright route lifecycle bug where
route.continue_()was erroneously called afterroute.fetch(), which previously caused network requests to hang indefinitely.
- Fixed an invalid Playwright route lifecycle bug where
- Config Key Deserialization (
ENG-02,src/loki/config.py): - Network Tormentor Teardown & Offline Leak Prevention (
CHA-01,src/loki/personas/network_tormentor.py):- Ensured that network emulation routes and offline states are safely restored in a
finallyblock during chaos sessions, preventing persistent browser network blackouts on unhandled exceptions.
- Ensured that network emulation routes and offline states are safely restored in a
- Robust Status Handling in Visual HTML Reports (
REP-01,src/loki/engine/html_reporter.py): - Replayer Crash Classification Integrity (
REP-02,src/loki/engine/replayer.py):- Prevented internal Python syntax or runtime errors during
repro_test.pyreplay execution from being falsely reported as "Crash Reproduced".
- Prevented internal Python syntax or runtime errors during
- AST-Safe Snippet Alignment & Uniqueness in Code Healer (
HLA-01,src/loki/engine/healer.py):- Added strict occurrence count validation (
count == 1) for exact and fuzzy code replacements, preventing ambiguous patch applications that could corrupt source files. - Preserved internal blank line counts in fuzzy sliding window comparisons to eliminate slice index drift.
- Added strict occurrence count validation (
🖥️ CLI & Interactive REPL Resilience
- Chat REPL Process Survival on Sub-Command Exit (
CLI-01,src/loki/ai/chat.py):- Updated CLI action runner (
_run_cli_action) to intercept(typer.Exit, SystemExit), preventing interactive chat sessions from abruptly terminating when sub-commands exit.
- Updated CLI action runner (
- Chat Role Alternation Preservation (
CLI-02,src/loki/ai/chat.py): - Unix In-Memory Module Persistence Post-Update (
UPD-01,src/loki/engine/updater.py,src/loki/ai/chat.py):- Added explicit restart notices upon successful update on Unix platforms and added an interactive exit confirmation prompt in
loki chat's/updatecommand to ensure users do not continue running outdated in-memory bytecode.
- Added explicit restart notices upon successful update on Unix platforms and added an interactive exit confirmation prompt in
🌪️ Infrastructure Chaos Concurrency
- Atomic Worker PID Tracking & TOCTOU Elimination (
INF-01,src/loki/engine/infra_chaos.py):- Implemented thread and advisory cross-platform file locking (
msvcrt.lockingon Windows,fcntl.flockon Unix) on.loki/infra_stress_workers.lock. - Validated integer types during PID parsing and tracking (PR [#13](https://github.com/Elabsurdo984/loki-agent/pull/13) by @aipd506).
- Switched PID file writes to atomic temporary file replacement (
Path.replace()), preventing file corruption and untracked orphan stress workers under concurrent stress tasks.
- Implemented thread and advisory cross-platform file locking (
- Multi-Process Handling & Partial Kill Visibility (
INF-02,src/loki/engine/infra_chaos.py):- Enhanced
kill_process()to iterate through all processes listening on a shared socket port, returning granular success details and preventing partial kill masking. - Updated
pause_process()to suspend and safely resume all matching processes across shared ports using a guaranteedtry ... finally:lifecycle.
- Enhanced
Contributors
- @TheIrvin made their first contribution (PR [#11](https://github.com/Elabsurdo984/loki-agent/pull/11)).
- @aipd506 made their first contribution (PR [#12](https://github.com/Elabsurdo984/loki-agent/pull/12), PR [#13](https://github.com/Elabsurdo984/loki-agent/pull/13), PR [#14](https://github.com/Elabsurdo984/loki-agent/pull/14), PR [#15](https://github.com/Elabsurdo984/loki-agent/pull/15), PR [#17](https://github.com/Elabsurdo984/loki-agent/pull/17)).
Upgrade
bash
uv tool upgrade loki-chaos-agent# or directly from LOKI:loki update
