T09 · Insecure Skill Coding Practices
- Location
scripts/generate_report.py:59- Finding
Stored HTML Injection in Generated Reports
- Content
View full analysis
{tier} {ind['name']} {value_str} {mom_str} {dir_arrow} {ind['direction_label']} {ind['weight']*100:.0f}% {ind.get('data_date', '')} """ ``` Signal names are also inserted without escaping: ```python for s in signals: items += f"""{arrow} {s['name']} 权重 {s['weight']*100:.0f}%""" ``` Direct template replacement exposes additional injection sinks: ```python report = template report = report.replace("{{INDUSTRY_NAME}}", scored_data.get("industry_name", "")) report = r ...[truncated 3299 chars]- Remediation
View remediation
``` 6. Validate custom stock codes with a six-digit allowlist and impose reasonable length and character limits on stock and sector names. 7. Add regression tests containing characters such as `<`, `>`, `"`, `'`, and `&`, and verify that they appear only as encoded text in the output. ]]>
