T09 · Insecure Skill Coding Practices
- Location
SKILL.md:77- Finding
Apify API Token Exposed in URL Query Strings and Process Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 77–89
Vulnerability Type: Credential exposure through URL query parameters and command-line arguments
Risk Level: MediumVulnerable Code
bash curl -X POST \ "https://api.apify.com/v2/acts/apidojo~instagram-location-scraper/runs?token=$APIFY_TOKEN" \ -H "Content-Type: application/json" \ -d '{"locationIds": ["<LOCATION_ID>"], "maxItems": 100}'bash curl "https://api.apify.com/v2/actor-runs/$RUN_ID?token=$APIFY_TOKEN" | grep '"status"'bash curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN&format=json"Technical Analysis
The REST fallback embeds
APIFY_TOKENdirectly in URL query strings. Although the requests use HTTPS and target the expected Apify API domain, the shell expands the environment variable before launchingcurl. Consequently, the secret may appear in process command-line arguments and can also be retained in shell tracing, terminal recordings, diagnostic output, proxy telemetry, server access logs, or copied command output.Authentication is necessary for the Skill's declared cloud-scraping operation, but placing the credential in the URL is not the least-exposure mechanism. An authorization header can authenticate the same requests without placing the secret in the URL.
Attack Path
- A user or Agent follows the documented REST fallback with
APIFY_TOKENset. - The shell expands
$APIFY_TOKENinto each request URL. - A local user, process-monitoring system, shell tracer, logging intermediary, or other telemetry component records the command line or complete URL.
- An attacker with access to that record extracts the token.
- The attacker reuses the token against Apify APIs until it is revoked or expires.
This path depends on an attacker having access to process metadata or relevant logs; the document does not itself transmit the to ...[truncated 684 chars]
- A user or Agent follows the documented REST fallback with
- Remediation
View remediation
Remediation Suggestions
-
Send the token through Apify's supported authorization header instead of a query parameter:
bash curl -X POST \ "https://api.apify.com/v2/acts/apidojo~instagram-location-scraper/runs" \ -H "Authorization: Bearer $APIFY_TOKEN" \ -H "Content-Type: application/json" \ -d '{"locationIds": ["<LOCATION_ID>"], "maxItems": 100}' -
Apply the same header-based authentication to polling and dataset retrieval requests.
-
Never print, log, or echo the token or a complete authenticated request.
-
Disable shell tracing such as
set -xwhile processing credentials. -
Use a narrowly scoped token where Apify supports applicable permission restrictions.
-
Rotate the token immediately if commands containing it may have been captured in process telemetry or URL logs.
-
Redact credentials from application, proxy, CI/CD, and support logs.
-
Keep the token in a protected secret store or environment variable and avoid storing it in source files or command history.
-
