T09 · Insecure Skill Coding Practices
- Location
scripts/generate_report.py:132- Finding
Stored HTML and JavaScript Injection in Generated Reports
- Content
View full analysis
{icon} {platform}' ``` ```python return f'''''' ``` ```python watch_items = "" for w in advice.get("watch_out", []): watch_items += f"{platform_badge(plat)} {f'🏆 最推荐' if is_highlight else ''}{p.get("title", "未知商品")}{price_html}{stars}📝 {fmt_count(reviews)} 评价 🏪 {shop}{f'📌 {note}' if note else ''} {f'🔗 查看商品' if url else ''}- {w}
" advice_html = f'''''' ``` ```python💡 购买建议{advice.get("buy_recommendation", "")}{f'{advice.get("reason", "")}
⚠️ 注意事项:' if watch_items else ''} {f'- {watch_items}
📈 {advice.get("price_trend_note", "")}' if advice.get("price_trend_note") else ''}🎯 {src.get("title", "未知商品")}``` # ...[truncated 2681 chars]- Remediation
View remediation
``` 6. Prefer a template engine with automatic escaping, such as Jinja2 with autoescape enabled, rather than assembling HTML through f-strings. 7. Add a restrictive Content Security Policy. Avoid enabling inline scripts if the report can be restructured to load only trusted local resources. 8. Add regression tests using payloads containing `
