T09 · Insecure Skill Coding Practices
- Location
SKILL.md:40- Finding
Server-Side Request Forgery Through Unrestricted Website Audit URLs
- Content
View full analysis
dict: try: r = requests.get(url, headers=HEADERS, timeout=10, allow_redirects=True) return { "status_code": r.status_code, "is_live": r.status_code < 400, "final_url": r.url, "raw_html": r.text if r.status_code < 400 else "", "response_headers": dict(r.headers) } except requests.exceptions.SSLError: return {"status_code": "SSL_ERROR", "is_live": False, "raw_html": "", "has_ssl": False} except requests.exceptions.ConnectionError: return {"status_code": "DEAD", "is_live": False, "raw_html": ""} except requests.exceptions.Timeout: return {"status_code": "TIMEOUT", "is_live": False, "raw_html": ""} ``` ```python def audit_website(url: str) -> dict: """Run all 8 signals. Returns complete audit dict.""" result = {"url": url, "audit_timestamp": datetime.now().isoformat()} ext = tldextract.extract(url) result["domain"] = f"{ext.domain}.{ext.suffix}" # Signal 1: Status + HTML status = check_status(url) result.update(status) if not result.get("is_live"): result["has_ssl"] = False return result # Dead site — score it and move on html = result.get("raw_html", "") headers = result.get("response_headers", {}) ``` ```python async def audit_website_async(session: aiohttp.ClientSession, url: str) -> dict: """Async version — fetch HTML only. Run other checks synchronously after.""" try: async with session.get(url, timeout=aiohttp.ClientTimeout(total=10)) as resp: html = await resp.text() headers = dict(resp.headers) status = resp.status except Exception as e: retu ...[truncated 2667 chars]- Remediation
View remediation
