T09 · Insecure Skill Coding Practices
- Location
templates/report-template.html:242- Finding
Unescaped Dynamic Content in Generated HTML Report
- Content
View full analysis
生成日期:{{生成日期}} 省份:{{省份}} 批次:{{批次}} ``` ```html{{一句话结论}}``` ```html``` Additional affected sinks include school names, descriptions, notes, risk descriptions, action items, and uploaded filenames. ### Technical Analysis The report-generation procedure treat ...[truncated 2808 chars]省份 / 年份{{省份}} / {{年份}}科类 / 选科{{科类}}分数{{分数}}位次{{位次}}批次{{批次}}风险偏好{{风险偏好}}城市偏好{{城市偏好}}专业偏好{{专业偏好}}限制条件{{限制条件}}- Remediation
View remediation
` as `>` - `"` as `"` - `'` as `'` 2. Replace unrestricted textual substitution with a maintained template engine that enables contextual auto-escaping by default. 3. Treat user input, uploaded-file values, and retrieved web content as untrusted data. Add an explicit instruction that such content must never be interpreted as HTML or executable instructions. 4. If limited rich formatting is required, sanitize it with a strict allowlist. Reject scripts, inline event handlers, dangerous URL schemes, forms, iframes, embedded objects, SVG content, and CSS capable of loading remote resources. 5. Add a restrictive Content Security Policy to the template, such as: ```html ``` 6. Avoid inserting dynamic values into raw HTML attributes. If this becomes necessary, apply context-specific attribute and URL encoding in addition to general HTML escaping. 7. Add regression tests that generate reports using payloads such as: ```html``` Verify that each payload appears only as inert visible text and that no outbound requests, event handlers, or scripts execute. ]]>
