fix: implement 22 security pentest remediation fixes

Server-side session management with SHA-256 hashed tokens and HttpOnly
cookies. Auth middleware gating all RPC/WS/proxy routes with method
allowlist. Login rate limiting (5/60s per IP). CORS restricted to
config origin. Docker registry allowlist. App ID and path validation.
P2P message sanitization (HTML + log injection). Onion address and
known-peer validation. Nginx security headers (CSP, X-Frame-Options,
etc.) and AIUI proxy auth. Systemd hardening (non-root, NoNewPrivileges,
ProtectSystem).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Dorian
2026-03-06 03:26:56 +00:00
co-authored by Claude Opus 4.6
parent 6623dbc4ab
commit 6656d2f1d9
12 changed files with 503 additions and 77 deletions
+16
View File
@@ -17,6 +17,22 @@ impl RpcHandler {
.and_then(|v| v.as_str())
.ok_or_else(|| anyhow::anyhow!("Missing manifest_path"))?;
// Validate manifest path: reject path traversal and paths outside apps/
if manifest_path.contains("..") {
return Err(anyhow::anyhow!(
"Invalid manifest_path: path traversal not allowed"
));
}
let path = std::path::Path::new(manifest_path);
if path.is_absolute() {
let apps_dir = self.config.data_dir.join("apps");
if !path.starts_with(&apps_dir) {
return Err(anyhow::anyhow!(
"Invalid manifest_path: must be under the apps directory"
));
}
}
// Load manifest
let manifest_content = tokio::fs::read_to_string(manifest_path)
.await