T09 · Insecure Skill Coding Practices
- Location
scripts/change-pdf-permissions.py:207- Finding
Arbitrary API Endpoint Can Receive Sensitive PDFs and Bearer Tokens
- Content
View full analysis
Dict[str, Any]: url = base_url.rstrip("/") + CREATE_PATH headers = make_headers(api_key) data = {k: bool_to_api(bool(v)) for k, v in permissions.items()} with open(pdf_path, "rb") as f: files = {"file": (os.path.basename(pdf_path), f, "application/pdf")} resp = requests.post(url, headers=headers, files=files, data=data, timeout=timeout_s) ``` ```python def get_job( base_url: str, api_key: str, job_id: Any, timeout_s: int = 30, ) -> Dict[str, Any]: url = base_url.rstrip("/") + f"/api/{job_id}" headers = make_headers(api_key) resp = requests.get(url, headers=headers, timeout=timeout_s) ``` ```python ap.add_argument( "--base-url", default=os.getenv("SOLUTIONS_BASE_URL", DEFAULT_BASE_URL), help="Base URL override", ) ``` ### Technical Analysis The Skill's declared functionality requires uploading a user-selected PDF and an API bearer token to the documented Solutions API. That transfer is necessary for the remote-processing design and is disclosed in `SKILL.md`. However, the implementation permits the destination to be replaced through either the `--base-url` command-line argument or the `SOLUTIONS_BASE_URL` environment variable. It does not validate the URL scheme, hostname, port, or expected path before attaching the bearer token and PDF to the request. Consequently, an attacker who can influence the invocation arguments or process environment can redirect the request to an arbitrary server. An `http://` destination would also send the data without ...[truncated 1497 chars]- Remediation
View remediation
