T09 · Insecure Skill Coding Practices
- Location
assets/invoice-template.html:10- Finding
Unescaped Template Substitution Allows HTML and Script Injection
- Content
View full analysis
{{SENDER_NAME}}{{SENDER_ADDRESS}}
{{SENDER_EMAIL}}
{{SENDER_PHONE}}Invoice
#{{INVOICE_NUMBER}}
Date: {{INVOICE_DATE}}
Due: {{DUE_DATE}}
{{LINE_ITEMS}}Bill To{{CLIENT_NAME}}{{CLIENT_ADDRESS}}
{{CLIENT_EMAIL}}Description Qty Unit Price Amount Subtotal< ...[truncated 2972 chars]- Remediation
View remediation
`, `"`, and `'`. 2. Do not accept preformatted `LINE_ITEMS` or `NOTES_SECTION` HTML from user input. Represent these values as structured data and generate the necessary elements through a trusted renderer. 3. Validate `PRIMARY_COLOR` against a strict allowlist, such as: - Six-digit hexadecimal colors matching `^#[0-9A-Fa-f]{6}$`. - A small predefined set of approved color names. 4. Parse quantities, prices, tax rates, and totals as bounded numeric values. Format them only after performing calculations with an appropriate decimal currency type. 5. Validate dates and invoice numbers against documented schemas and length limits. 6. Add a restrictive Content Security Policy, preferably through a `` element for the standalone file. Disallow scripts and external resources unless explicitly required. 7. Add security tests containing payloads such as closing tags, event-handler attributes, `` sequences, SVG markup, and malformed line-item data. Verify that they are displayed as inert text. 8. Update `SKILL.md` to explicitly require escaping, structured rendering, and validation rather than generic placeholder replacement. ]]>
