- Document implementation status of TH-01 through TH-10 - Identify tests that need to be created - Verify existing security implementations Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2.8 KiB
2.8 KiB
Security Hardening Epic (pdftract-e9lz) - Verification Notes
Overview
This epic implements security controls TH-01 through TH-10 from the Threat Model (plan lines 831-967).
Implementation Status Summary
Already Implemented (Need Tests)
- TH-01 (Stream Bomb):
max_decompress_byteslimit enforced incrates/pdftract-core/src/parser/stream.rswithSTREAM_BOMBdiagnostic. - TH-02 (Path Traversal):
resolve_path()incrates/pdftract-cli/src/mcp/root.rsvalidates paths against--root DIR. - TH-03 (MCP Authentication):
check_bind_security()incrates/pdftract-cli/src/mcp/bind.rsrequires auth token for non-loopback binds. - TH-05 (SSRF Protection):
validate_url()incrates/pdftract-core/src/url_validation.rsblocks private networks. - TH-07 (Password Protection):
resolve_password()incrates/pdftract-cli/src/password.rswraps secrets insecrecy::SecretString. - TH-10 (Cache Integrity): HMAC-SHA-256 in
crates/pdftract-core/src/cache/integrity.rssigns each cache entry.
Already Implemented (Partial)
- TH-09 (Inspector XSS): CSP middleware in
crates/pdftract-cli/src/middleware/csp.rssets headers, but inspector JS usesinnerHTMLin some places.
Infrastructure Already in Place
- Audit Logging:
AuditLogWriterincrates/pdftract-core/src/audit.rsemits NDJSON records. - Supply Chain:
cargo-deny.tomlconfigured;cargo auditandcargo denyintegrated in CI (.ci/argo-workflows/pdftract-ci.yaml).
NOT Yet Implemented
- TH-04 (JavaScript Presence): No detection of
/AA,/OpenAction,/JSentries. NeedJAVASCRIPT_PRESENTdiagnostic. - TH-08 (Log Audit): Test exists at
tests/security/TH-08-log-audit.rsbut needs verification. - TH-09 XSS Test: Need test against
tests/fixtures/security/xss-payload.pdf.
Tests to Create
High Priority (Blocking v1.0.0)
tests/security/TH-01-stream-bomb.rs- Test againsttests/fixtures/malformed/bomb-10k-2g.pdftests/security/TH-03-mcp-no-auth.rs- Verify exit code 78 onmcp --bind 0.0.0.0:0without tokentests/security/TH-05-ssrf-block.rs- Test RFC1918, IPv6 ULA, localhost, metadata endpointstests/security/TH-10-cache-poison.rs- Write forged entry, verify rejection
Medium Priority
tests/security/TH-02-path-traversal.rs- 10 traversal payloadstests/security/TH-07-ps-leak.rs- Verify--password VALUErejected without opt-in- Run and fix
tests/security/TH-08-log-audit.rsif failing tests/security/TH-09-inspector-xss.rs- Headless browser test
Lower Priority (TH-04 needs implementation first)
- Implement JavaScript detection in core, then create
tests/security/TH-04-js-presence.rs
References
- Plan lines 831-967 (Threat Model)
crates/pdftract-core/src/diagnostics.rs-DiagCodedefinitionstests/fixtures/security/- Security fixtures