T09 · Insecure Skill Coding Practices
- Location
scripts/linkedin_email_phone_pipeline.py:119- Finding
Apify API Token Exposed Through URL Query Parameters and Command-Line Arguments
- Content
View full analysis
List[Dict[str, Any]]: base_url = f"https://api.apify.com/v2/acts/{actor_id}/run-sync-get-dataset-items" params = {"token": token, "timeout": timeout_sec, "clean": "true"} url = f"{base_url}?{urllib.parse.urlencode(params)}" req = urllib.request.Request( url=url, data=json.dumps(actor_input).encode("utf-8"), headers={"Content-Type": "application/json"}, method="POST", ) ``` The command-line interface also accepts the credential directly: ```python run_cmd = sub.add_parser("run", help="Run combined pipeline") run_cmd.add_argument("--apify-token", help="Apify API token (fallback: APIFY_TOKEN env)") run_cmd.add_argument("--timeout-sec", type=int, default=DEFAULT_TIMEOUT_SEC) run_cmd.add_argument("--input-json", help="Inline JSON payload") run_cmd.add_argument("--input-file", help="Path to JSON payload file") ``` The unsafe command-line option is explicitly documented: ```bash python3 scripts/linkedin_email_phone_pipeline.py run \ --apify-token 'apify_api_xxx' \ --input-file references/sample_input.json ``` ### Technical Analysis The pipeline inserts the Apify API token into the query component of every actor request. HTTPS encrypts the complete request in transit, but it does not prevent credential disclosure through systems that process or record URLs. Query strings may be retained by HTTP diagnostics, application telemetry, reverse proxies, debugging tools, exception reports, or service-side access logs. The alternative `--apify-token` interface creates a separate local exposure channel. Command-line ...[truncated 1974 chars]- Remediation
View remediation
