T09 · Insecure Skill Coding Practices
- Location
scripts/render_report.py:311- Finding
Untrusted Product Image URLs Trigger Automatic Third-Party Network Requests
- Content
View full analysis
dict: title = first_nonempty(item, ["text", "title", "sku_name", "name", "poi_name", "query"]) card_id = first_nonempty(item, ["pid", "item_id", "sku", "id", "poi_id", "wx_app_id", "source_seq_id"]) url = first_nonempty(item, ["jump_url", "auctionURL", "pc_url", "webURL", "poi_url"]) image = first_nonempty(item, ["image_url", "pic_path", "verticalPic", "photos", "icon"]) shop = first_nonempty(item, ["seller_name", "shop_name", "venueName", "source"]) price = first_nonempty(item, ["price", "priceShowText", "priceLow", "minPrice", "priceStr"]) return { "kind": kind, "position": position, "id": str(card_id) if card_id is not None else None, "title": str(title) if title is not None else None, "shop": str(shop) if shop is not None else None, "price": price, "image_url": str(image) if image is not None else None, "url": str(url) if url is not None else None, "raw": item, } ``` The renderer considers every HTTP or HTTPS host safe: ```python def safe_url(value: Any) -> Optional[str]: if not isinstance(value, str): return None value = value.strip() try: parsed = urlsplit(value) except ValueError: return None return value if parsed.scheme in {"http", "https"} and parsed.netloc else None ``` It then embeds the untrusted URL as an automatically loaded image: ```python def render_product_cards(block: dict) -> str: output = [] for item in block.get("i ...[truncated 3443 chars]- Remediation
View remediation
