T09 · Insecure Skill Coding Practices
- Location
scripts/generate_roadbook_html.py:238- Finding
Unescaped Roadbook Content and Filenames Allow HTML Injection
- Content
View full analysis
' for p in d['photos']) else: photos_html = '暂无照片' spots = d.get('spots', []) via_items = [] for s in spots[:8]: via_items.append(f"{s[0]} ({s[1]}m)") via_html = "".join(via_items) if via_items else "—" stories_html = "" for st in d['stories']: stories_html += f'{st["emoji"]}' ``` Additional unescaped roadbook fields are inserted directly into the generated page: ```python return f'''{st["text"]}``` ```python{d['day']:02d}DAY{d['start']} → {d['end']}
{d['date']} · {weekday_str}{route_str}{stories_html}🏔️ 途经景点
{via_html}🏨 住宿
{d['hotel'] or '—'}💰 消费
{d['cost']}{photos_html}``` ### Technical Analysis The generator treats values parsed from the Markdown roadbook and names read from the photo directory as trusted HTML. These values are interpolated into both element content and quoted attributes without contextual HTML escaping. A crafted field such as a hotel name, route component, sto ...[truncated 1684 chars]- Remediation
View remediation
` and removes event handlers, scripts, embedded resources, and unsafe URL schemes. 6. Add regression tests using payloads in every parsed field and filename, including quotation marks, angle brackets, event handlers, and `javascript:` URLs. ]]>
