T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:30
- Finding
- APIFY_TOKEN Exposed Through URL Query Parameters<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 30-42 **Vulnerability Type**: Credential exposure through command-line URL parameters **Risk Level**: Medium ### Vulnerable Code ```bash RESULT=$(curl -s -X POST "https://api.apify.com/v2/acts/0UDODOnpTkxY3Oc90/run-sync-get-dataset-items?token=$APIFY_TOKEN" \ -H "Content-Type: application/json" \ -d '{"searchTerms": ["TERM"], "maxResults": 30}') echo "$RESULT" | jq '.' ``` ```bash RUN_ID=$(curl -s -X POST "https://api.apify.com/v2/acts/0UDODOnpTkxY3Oc90/runs?token=$APIFY_TOKEN" \ -H "Content-Type: application/json" \ -d '{"searchTerms": ["TERM"], "maxResults": 100}' | jq -r '.data.id') curl -s "https://api.apify.com/v2/actor-runs/$RUN_ID?token=$APIFY_TOKEN" | jq -r '.data.status' curl -s "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN" | jq '.' ``` ### Technical Analysis The Skill places the `APIFY_TOKEN` secret directly in URL query parameters. The token is sent to the declared Apify API over HTTPS, so the inspected content does not demonstrate intentional transmission to an unrelated host. Network access to Apify is also necessary for the Skill's stated scraping functionality. Nevertheless, URL-based credentials are vulnerable to incidental disclosure. Complete URLs may be recorded in process arguments, shell tracing output, command histories, diagnostic reports, HTTP proxy logs, server access logs, monitoring systems, or copied error messages. HTTPS protects the URL while it is in transit but does not prevent exposure at either endpoint or through local process observation. The same credential is repeatedly included in Actor creation, status, and dataset requests, increasing its potential exposure surface. ### Attack Path 1. A user invokes the Skill with a valid `APIFY_TOKEN` in the environment. 2. The Agent executes one of the documented `curl` commands and expands the token inside the command-line URL. 3. A local process observer, shell tra ...[truncated 828 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Use Apify's supported authorization header instead of a URL query parameter: ```bash curl --fail-with-body --silent --show-error \ -X POST \ -H "Authorization: Bearer $APIFY_TOKEN" \ -H "Content-Type: application/json" \ --data-binary "$payload" \ "https://api.apify.com/v2/acts/0UDODOnpTkxY3Oc90/run-sync-get-dataset-items" ``` 2. Apply the same header-based authentication to Actor creation, status, and dataset requests. 3. Never print authenticated URLs, authorization headers, or environment-variable values in normal or error output. 4. Disable shell tracing while secrets are present and redact authorization data from diagnostics and logs. 5. Use a narrowly scoped Apify token where supported, rotate it periodically, and revoke it immediately if URL logs may have exposed it. 6. Add `--fail-with-body`, `--silent`, and `--show-error` so failures are handled without encouraging operators to print complete authenticated requests. ]]>
