T09 · Insecure Skill Coding Practices
- Location
SKILL.md:88- Finding
Apify API Token Exposed in URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 88–91 and 105–108
Vulnerability Type: API credential exposure through URL query strings
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": ["freelance [SKILL]", "[SKILL] for hire", "available for contract [SKILL]"], "maxItems": 300}'The same insecure pattern is repeated for profile enrichment:
bash curl -X POST \ "https://api.apify.com/v2/acts/apidojo~twitter-user-scraper/runs?token=$APIFY_TOKEN" \ -H "Content-Type: application/json" \ -d '{"usernames": ["handle1", "handle2"]}'Technical Analysis
The REST fallback embeds
APIFY_TOKENin the request URL. Although HTTPS protects the URL while it is in transit, query strings may still be recorded by local process inspection, shell tracing, command diagnostics, HTTP infrastructure, server access logs, monitoring platforms, and error-reporting systems.Expanding the environment variable directly in a
curlcommand-line argument can also expose the complete URL to users or processes capable of observing command-line arguments. This broadens access to the credential beyond the intended API client and service.Attack Path
- A user configures
APIFY_TOKENand executes one of the documented REST fallback commands. - The shell expands
$APIFY_TOKENinto the URL passed as a command-line argument tocurl. - A local process observer, diagnostic collector, proxy, API access log, or monitoring service records the URL.
- An attacker with access to that record extracts the token from the
tokenquery parameter. - The attacker replays the token against Apify endpoints within the token's assigned permissions.
Exploitation depends on an attacker having access to process information or a system that records the U ...[truncated 501 chars]
- A user configures
- Remediation
View remediation
Remediation Suggestions
-
Pass the API token through an authorization header supported by Apify instead of a URL query parameter. For example:
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": ["freelance [SKILL]", "[SKILL] for hire", "available for contract [SKILL]"], "maxItems": 300}' -
Apply the same change to the
twitter-user-scraperexample. -
Ensure scripts and troubleshooting instructions never print expanded credentials.
-
Disable shell tracing when commands involving secrets are executed.
-
Store the token in a protected secret manager or environment variable with appropriately restricted access.
-
Use a least-privilege token restricted to only the required Apify operations.
-
Redact query strings and authorization data from application, proxy, and monitoring logs.
-
Rotate any token that may previously have appeared in command histories, process captures, diagnostics, or logs.
-
