← Back to Damru Overview
04 / ZERO-LEAK CLI & HARDENED WEB SERVER

Security

Damru treats local developer machines and CI runners as untrusted boundaries: secrets are redacted before hitting disk, remote URLs are blocked by default, subprocesses avoid shells, and HTTP endpoints enforce strict headers and payload limits.

CLI GUARDRAILS — SP-01 & SP-02

Secret Redaction & Local-Only URL Gating

In damru/src/security.rs ↗, redact_secrets(input, known_secrets) scrubs known secret strings and any line containing token=, password=, secret=, or api_key=—replacing values with [REDACTED] before logs or atomic status.json reports are written.

validate_local_base_url(url, allow_remote) enforces that Flagsmith endpoints resolve strictly to loopback hosts (localhost, 127.0.0.1, ::1) unless --allow-remote is explicitly passed, preventing accidental credential exfiltration.

SUBPROCESS & FLAG HYGIENE

Argument-Array Execution & Guaranteed Cleanup

All external commands in damru/src/orchestrator.rs ↗ and damru/src/main.rs ↗ are invoked via Rust’s std::process::Command with explicit argument arrays rather than shell interpolation, eliminating command injection vectors from paths or environment values.

During live verification (damru verify and POST /api/doctor/verify), temporary test flags are deleted inside a guaranteed cleanup block (try / finally) and verified with a follow-up 404 check so test flags never linger in Flagsmith.

WEB SERVER HARDENING

CSP, Prototype Pollution & Payload Bounds

Every HTML and API response from plugin-1/server.js ↗ sends strict SECURITY_HEADERS, enforces a 16 KB request body cap (MAX_BODY_BYTES = 16 * 1024), uses null-prototype objects (Object.create(null)) for variant stats, and validates static asset paths against ASSETS_DIR to block directory traversal.

All HTTP security invariants are continuously verified by plugin-1/security_test.js ↗.

DefenseEnforcement in plugin-1/server.jsVerified By
Response Headersnosniff, X-Frame-Options: DENY, no-referrer, no-store, strict CSPsecurity_test.js
Body Size CapRejects POST bodies > 16 KB with HTTP 413 Payload too largesecurity_test.js
XSS & ID ValidationSAFE_ID_REGEX /^[a-zA-Z0-9_.-]{1,128}$/ on all userId inputssecurity_test.js
Prototype PollutionObject.create(null) for stats + Map for user assignmentsflagsmith-experiment-plugin.js
Path Traversalpath.resolve() prefix check against ASSETS_DIR + MIME allowlistserver.js