T09 · Insecure Skill Coding Practices
- Location
SKILL.md:117- Finding
Apify API Token Exposed Through URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 117–136; vulnerable references at lines 120 and 136
Vulnerability Type: Credential exposure through URL query parameters
Risk Level: MediumVulnerable Code
bash curl -X POST \ "https://api.apify.com/v2/acts/apidojo~tweet-scraper/runs?token=$APIFY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "searchTerms": ["[BRAND_TERM]"], "maxItems": 500, "includeReplies": true, "since": "[YYYY-MM-DD]", "until": "[YYYY-MM-DD]" }'bash curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN"Technical Analysis
The documented commands expand the
APIFY_TOKENenvironment variable directly into request URLs. Although HTTPS encrypts the requests in transit, it does not prevent the fully expanded URLs from being exposed at either endpoint or on the local system.URLs containing credentials can be captured by process inspection tools, shell tracing, command diagnostics, proxy and gateway access logs, monitoring platforms, HTTP client debugging output, or copied terminal output. Consequently, URL query parameters are an unsafe mechanism for transmitting long-lived authentication credentials.
Authentication is necessary for the Skill's stated Twitter/X monitoring functionality, and sending search terms to the declared Apify service is consistent with that functionality. However, exposing the token in URLs exceeds the minimum disclosure required because Apify authentication can instead be supplied through an HTTP authorization header.
Attack Path
- A user exports a valid
APIFY_TOKENand executes one of the documentedcurlcommands. - The shell expands
$APIFY_TOKENinto the complete command-line URL. - A local process inspector, shell tracing mechanism, diagnostic collector, proxy, gateway, or URL logging system records the expanded URL.
- An attacker with a ...[truncated 1067 chars]
- A user exports a valid
- Remediation
View remediation
Remediation Suggestions
-
Remove the
tokenquery parameter from every documented Apify URL. -
Pass the token through an authorization header supported by Apify:
bash curl -X POST \ "https://api.apify.com/v2/acts/apidojo~tweet-scraper/runs" \ -H "Authorization: Bearer $APIFY_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "searchTerms": ["[BRAND_TERM]"], "maxItems": 500, "includeReplies": true, "since": "[YYYY-MM-DD]", "until": "[YYYY-MM-DD]" }'bash curl \ "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items" \ -H "Authorization: Bearer $APIFY_TOKEN" -
Verify the exact authorization-header syntax against current Apify documentation before publishing the revised commands.
-
Configure clients, proxies, and monitoring systems to redact authorization headers and sensitive environment variables.
-
Avoid shell tracing such as
set -xwhile handling credentials. -
Store the token in a restricted secret manager or protected environment configuration rather than command history or source files.
-
Use a least-privileged token limited to the actors, datasets, and operations required by the Skill.
-
Revoke and rotate any token that may previously have appeared in command output, process captures, or URL logs.
-
