T09 · Insecure Skill Coding Practices
- Location
fde-agent-skill-designer/scripts/scaffold-poc.js:42- Finding
Unescaped Scaffold Metadata Enables Generated JavaScript Injection and Stored Cross-Site Scripting
- Content
View full analysis
{{POC_NAME}}FDE MINIMUM POC · v0.1.0
{{POC_NAME}}
{{SCENARIO}}
``` ### Technical Analysis The scaffold generat ...[truncated 3576 chars]- Remediation
View remediation
`, `"`, and `'` before inserting names or scenarios into HTML text or attribute contexts. Prefer setting dynamic text through `textContent` rather than generating markup. 5. **Remove metadata from executable code where possible.** The server startup message can read a validated manifest at runtime instead of embedding `POC_NAME` directly into `server.js`. 6. **Validate command-line metadata.** Apply reasonable length limits, reject control characters, and reject unexpected line breaks. Validation should supplement, not replace, output encoding. 7. **Use distinct placeholders for distinct contexts.** A single token must not be reused in JavaScript, HTML, and JSON unless every destination receives format-specific encoding. 8. **Add adversarial regression tests.** Test names, scenarios, and project identifiers containing: - Backticks and template interpolation syntax. - Single and double quotation marks. - Backslashes and newlines. - HTML tags and closing script sequences. - JSON structural characters. - Unicode control and directionality characters. 9. **Validate generated artifacts before reporting success.** Parse generated JSON, syntax-check generated JavaScript, and inspect generated HTML to ensure metadata remains inert text. 10. **Docum ...[truncated 181 chars]
