T09 · Insecure Skill Coding Practices
- Location
scripts/extract_paper.py:239- Finding
Unrestricted Publisher PDF Retrieval Permits Server-Side Request Forgery
- Content
View full analysis
str: if not pdf_url or PdfReader is None: return "" try: r = requests.get(pdf_url, headers={"User-Agent": "paper-notion-summarizer/2.0"}, timeout=60, allow_redirects=True) except Exception: return "" if r.status_code != 200 or not r.content: return "" try: reader = PdfReader(BytesIO(r.content)) except Exception: return "" pages = [] for page in reader.pages: try: text = page.extract_text() or "" except Exception: text = "" if text: pages.append(text) return "\n".join(pages) ``` The unvalidated URL is passed into that retrieval function: ```python source = (paper.extra.get("pdf_url") or "").strip() if source: candidate_text = fetch_pdf_text(source) ``` ### Technical Analysis Crossref metadata is treated as trusted when selecting a publisher-provided PDF URL. The implementation does not validate: - The URL scheme - The destination hostname - Resolved IP addresses - Redire ...[truncated 2191 chars]- Remediation
View remediation
