T09 · Insecure Skill Coding Practices
- Location
scripts/generate_report.py:472- Finding
Stored HTML and JavaScript Injection in Generated Reports
- Content
View full analysis
简历-JD 匹配度评分报告 | {candidate} → {target_job} ``` JSON-derived report values are also inserted into generated markup without escaping: ```python def generate_score_hero(result: dict) -> str: """生成总分Hero区域HTML""" total = result["total_score"] grade = result["grade"] grade_text = result["grade_text"] oneliner = result["oneliner"] # 颜色映射 if grade == "A": color = "#16a34a" elif grade == "B": color = "#2563eb" elif grade == "C": color = "#ca8a04" else: color = "#dc2626" # 圆环角度 angle = total / 100 * 360 return f'''''' ``` Keyword evidence is similarly interpolated directly: ```python rows.append(f''' {i} {kw["keyword"]} {kw["category"]} {weight_label} {badge} {evidence} ''') ``` Recommendation cont ...[truncated 5225 chars]{total}/ 100匹配评级:{grade} 级 — {grade_text}{oneliner}- Remediation
View remediation
``` The report currently requires no JavaScript, so `script-src 'none'` is appropriate. 7. Add regression tests using payloads in every rendered field, including: ```html"><svg onload=alert(1)> ``` Tests should verify that the output contains encoded text such as `<script>` and no executable attacker ...[truncated 27 chars]
