T09 · Insecure Skill Coding Practices
- Location
miniapp/app.js:424- Finding
Stored Active-Content Injection Executes Arbitrary JavaScript
- Content
View full analysis
{ const s = document.createElement('script'); if (oldScript.src) s.src = oldScript.src; s.type = oldScript.type || 'text/javascript'; s.text = oldScript.textContent || ''; oldScript.replaceWith(s); }); } ``` ### Technical Analysis The `/push` endpoint accepts arbitrary HTML and stores it in the global canvas state. The frontend inserts that content through `innerHTML` and then deliberately recreates every embedded `- Remediation
View remediation
` elements. - Sanitize HTML with a maintained strict allowlist before storage and again before rendering. - Reject scripts, event-handler attributes, `javascript:` URLs, unsafe SVG content, iframes, and active embedded objects. - Prefer rendering untrusted HTML in a sandboxed iframe on a separate origin without `allow-scripts` or `allow-same-origin`. - Add a restrictive Content Security Policy that disallows inline scripts and limits script sources. - Separate content-publishing authorization from general server secrets and rotate `PUSH_TOKEN` after any suspected exposure. - Consider supporting only Markdown, text, and a constrained declarative UI format. ]]>
