T09 · Insecure Skill Coding Practices
- Location
templates/design-picker.html:890- Finding
Generated and User-Influenced Data Is Inserted Through innerHTML Without Runtime Sanitization
- Content
View full analysis
' + t + ""; }) .join(""); card.innerHTML = '' + preview + '"; ``` The full-size preview repeats the same unsafe pattern: ```javascript var tokens = { "{{bg}}": bg, "{{fg}}": fg, "{{ac}}": ac, "{{mt}}": mt, "{{sf}}": al(fg, 0.06), "{{hf}}": t.headline.family, "{{hw}}": t.headline.weight, "{{bf}}": t.body. ...[truncated 3539 chars]' + mb.name + '' + mb.description + '' + tagHtml + "- Remediation
View remediation
`, ``, `<object>`, `<embed>`, and active metadata elements. - All attributes beginning with `on`. - `javascript:`, `vbscript:`, and unsafe `data:` URLs. - SVG and MathML unless a strict, separately reviewed allowlist is implemented. - Form controls or navigation elements that are unnecessary for previews. 3. Use `textContent` for names, descriptions, labels, tags, and prompt text rather than concatenating them into HTML. 4. Construct static picker controls with DOM APIs such as `createElement`, `setAttribute`, and `appendChild`. 5. Validate colors, font weights, dimensions, corner radii, spacing, and shadow values against strict schemas before using them in inline styles. 6. Treat generated JSON as untrusted. Perform deterministic schema and security validation after generation rather than relying on instructions given to the generating agent. 7. Consider rendering architecture previews in sandboxed iframes with a restrictive `sandbox` attribute and an explicit Content Security Policy. 8. Add a Content Security Policy that blocks inline event handlers, restricts scripts to approved origins, and limits outbound connections. 9. Add regression tests containing event handlers, malformed attributes, dangerous URL schemes, SVG payloads, and closing-tag injection. ]]>
