From ef4da654ce55c2a39563fb610465f3345ab8f8c7 Mon Sep 17 00:00:00 2001 From: jedarden Date: Tue, 26 May 2026 20:38:21 -0400 Subject: [PATCH] feat(pdftract-3b1mk): implement TH-09 inspector XSS test with CSP headers MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit implements the TH-09 XSS mitigation for the inspector mode: 1. **CSP Middleware** (`crates/pdftract-cli/src/middleware/csp.rs`) - Adds Content-Security-Policy header to all inspector responses - Policy: `default-src 'self'; script-src 'self'` per TH-09 - Defense-in-depth for XSS prevention (primary defense is SVG rendering) 2. **Inspector Integration** - Updated `create_router_with_audit()` to apply CSP middleware - CSP headers now present on index page and all API endpoints 3. **XSS Payload Fixture** (`tests/fixtures/security/xss-payload.pdf`) - Minimal PDF containing four XSS payload variants: - `` - `` - `javascript:alert(3)` - `