T09 · Insecure Skill Coding Practices
- Location
scripts/sea_route.py:20- Finding
Persistent HTML Injection Through Unsanitized Port Names
- Content
View full analysis
{args.origin_name}
lon {args.origin_lon}°
lat {args.origin_lat}°", max_width=200, ), icon=folium.Icon(color="green", icon="anchor", prefix="fa"), tooltip=f"起点:{args.origin_name}", ).add_to(m) folium.Marker( [args.dest_lat, args.dest_lon], popup=folium.Popup( f"{args.dest_name}
lon {args.dest_lon}°
lat {args.dest_lat}°", max_width=200, ), icon=folium.Icon(color="red", icon="anchor", prefix="fa"), tooltip=f"终点:{args.dest_name}", ).add_to(m) info_html = f"""- Remediation
View remediation
{origin_name_html}
" f"lon {args.origin_lon}°
lat {args.origin_lat}°", max_width=200, ) ``` 3. Prefer text-only Folium APIs where available rather than constructing raw HTML. 4. Preserve the original unescaped strings only for non-HTML outputs such as JSON. 5. Consider validating display names with a reasonable length limit and rejecting control characters. Validation should supplement, not replace, output encoding. 6. Add tests using names containing characters such as `<`, `>`, `"`, `'`, and script-capable markup, then verify that the generated document contains encoded text rather than executable elements. 7. If rich formatting must be supported, sanitize input with a strict allowlist-based HTML sanitizer and prohibit scripts, event-handler attributes, dangerous URL schemes, and active embedded content. ]]>
