T09 · Insecure Skill Coding Practices
- Location
SKILL.md:187- Finding
Stored HTML and JavaScript Injection in Generated Dashboard
- Content
View full analysis
block (palette, cards, charts grid, table) - stat cards row - two 2-column chart rows (doughnut, tags bar / by-month bar, funnel bar) - filterable table (search input + status/company dropdowns, client-side JS) ... - `link` column renders as a hyperlink (`target="_blank" rel="noopener"`) if present; otherwise `—`. ... `Date` (`applied_on`) · `Company` · `Role` · `Status` · `Next action` · `Tags` · `Interview date` · `Notes` (truncate to 80 chars, full text in a `title` tooltip) · `Link` (hyperlink or `—`) ``` ### Technical Analysis The skill instructs the agent to read tracker-controlled database fields and interpolate them into a self-contained HTML document. These values are used in several distinct output contexts: - HTML text nodes, such as company, role, tags, and notes - HTML attributes, including the notes `title` tooltip - Hyperlink attributes generated from the `link` field - Inline client-side JavaScript or chart data The specification does not require context-sensitive output encoding or safe DOM construction. Generic replacement is insufficient because HTML text, HTML attributes, URLs, and inline JavaScript each require different handling. For example, a malicious tracker value containing HTML such as an image element with an event handler could execute if inserted using `innerHTML ...[truncated 1896 chars]- Remediation
View remediation
` or place the data in a non-executable JSON element and parse it safely. 4. Parse links with the browser `URL` API and allow only explicit `https:` and, if necessary, `http:` protocols. Reject malformed URLs and all other protocols. Do not rely on a case-sensitive `startsWith("http")` check. 5. Add a restrictive Content Security Policy that blocks inline event handlers and limits outbound connections. Prefer external or nonce-authorized local scripts instead of unrestricted inline JavaScript. 6. Add regression tests using payloads in every rendered field, including: - HTML elements with event handlers - Quotes that escape attributes - `` sequences - Mixed-case and malformed URL schemes - Unicode and encoded delimiter variants ]]>
