T09 · Insecure Skill Coding Practices
- Location
scripts/browse_page.py:230- Finding
Unrestricted URL Fetching Enables Server-Side Request Forgery
- Content
View full analysis
tuple: """Returns (status_code, raw_html_str).""" ua = ( "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) " "AppleWebKit/537.36 (KHTML, like Gecko) " "Chrome/122.0.0.0 Safari/537.36" ) req = urllib.request.Request(url, headers={ "User-Agent": ua, "Accept": "text/html,application/xhtml+xml,*/*;q=0.8", "Accept-Language": "en-US,en;q=0.9", "Referer": "https://www.google.com/", }) with urllib.request.urlopen(req, timeout=timeout) as r: ct = r.headers.get("Content-Type", "utf-8") ``` From `scripts/browse_page.py:248-264`: ```python def _browser_worker_fetch(url: str, mode: str, timeout: int) -> dict: payload = { "url": url, "mode": mode, "extract": "text", "timeout_ms": timeout * 1000, } req = urllib.request.Request( f"{BROWSER_WORKER_URL.rstrip('/')}/render", data=json.dumps(payload).encode("utf-8"), headers={"Content-Type": "application/json"}, ) request_timeout = max(timeout + 10, timeout * 3) if mode in ("auto", "stealth", "dynamic"): request_timeout = max(request_timeout, 75) with urllib.request.urlopen(req, timeout=request_timeout) as resp: body = json.loads(resp.read().decode("utf-8")) ``` From `scripts/browse_page.py:430-489`: ```python if BROWSER_WORKER_URL and mode in ("auto", "stealth", "dynamic"): try: return _browser_worker_fetch(url, mode, timeout) except (urllib.error.URLError, urllib.error.HTTPError, TimeoutError, j ...[truncated 7988 chars]- Remediation
View remediation
