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.
- Secret redaction & URL validation:
damru/src/security.rs↗ - Safe
.envtemplate creation without clobbering secrets:damru/src/envfile.rs↗ - Supply-chain & dependency audit policy:
damru/deny.toml↗ andSECURITY.md↗
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.
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 ↗.
| Defense | Enforcement in plugin-1/server.js | Verified By |
|---|---|---|
| Response Headers | nosniff, X-Frame-Options: DENY, no-referrer, no-store, strict CSP | security_test.js |
| Body Size Cap | Rejects POST bodies > 16 KB with HTTP 413 Payload too large | security_test.js |
| XSS & ID Validation | SAFE_ID_REGEX /^[a-zA-Z0-9_.-]{1,128}$/ on all userId inputs | security_test.js |
| Prototype Pollution | Object.create(null) for stats + Map for user assignments | flagsmith-experiment-plugin.js |
| Path Traversal | path.resolve() prefix check against ASSETS_DIR + MIME allowlist | server.js |