T09 · Insecure Skill Coding Practices
- Location
config/invoice-template.html:132- Finding
Unescaped Invoice Data Can Trigger Unauthorized Resource Loading During PDF Rendering
- Content
View full analysis
{{BUSINESS_NAME}}
``` ```html {{LINE_ITEMS_HTML}} ``` From `scripts/generate-invoice-pdf.py`: ```python # SECURITY: Disable JavaScript to prevent XSS from malicious invoice content page = browser.new_page( viewport={"width": 1200, "height": 1600}, java_script_enabled=False ) # Load the HTML file page.goto(f"file://{input_path}") # Brief pause for font rendering (no JS needed) page.wait_for_timeout(500) ``` ### Technical Analysis The invoice template contains raw placeholders in HTML element attributes and directly accepts a complete HTML fragment through `{{LINE_ITEMS_HTML}}`. The project does not provide a rendering implementation that guarantees contextual HTML escaping, URL validation, or construction of line-item rows from escaped text nodes. Disabling JavaScript reduces script-based XSS exposure, but it does not disable passive browser resource loading. Injected HTML elements such as images, stylesheets, frames, or other resource-bearing tags may still cause Chromium to access remote URLs while producing the PDF. A crafted `LOGO_PATH` can likewise cause an external resource request if URL schemes are not restricted. Because the renderer does not register a Playwright route handler or otherwi ...[truncated 2002 chars]- Remediation
View remediation
`, ``, stylesheet links, malformed attributes, and remote logo URLs. ]]>
