T09 · Insecure Skill Coding Practices
- Location
SKILL.md:84- Finding
Apify API Token Exposed Through URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 84–93
Vulnerability Type: Credential exposure through URL query parameters
Risk Level: Mediumbash curl -X POST \ "https://api.apify.com/v2/acts/apidojo~twitter-user-scraper/runs?token=$APIFY_TOKEN" \ -H "Content-Type: application/json" \ -d '{"searchTerms": ["founder [SECTOR]", "building [SECTOR] startup", "CEO [SECTOR]", "#buildinpublic [SECTOR]"], "maxItems": 100}'Wait for
SUCCEEDED. Fetch dataset:bash curl "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items?token=$APIFY_TOKEN"Technical Analysis
The documented REST fallback expands the sensitive
APIFY_TOKENenvironment variable directly into request URLs. Authentication with Apify is necessary for the Skill's declared Twitter-scraping functionality, and the destination is consistent with that purpose. However, transmitting the credential as a query parameter is not the minimum-risk authentication method.URL query strings can be captured in shell tracing output, process command-line inspection, command histories, HTTP client diagnostics, monitoring systems, reverse-proxy logs, server access logs, and copied URLs. HTTPS encrypts the request while it is in transit but does not prevent exposure at either endpoint or through local process and logging facilities.
Attack Path
- A user exports a valid
APIFY_TOKENand executes one of the documentedcurlcommands. - The shell substitutes the token into the URL before starting
curl. - The resulting command line or request URL is observed or retained by a local process inspector, shell debugging facility, monitoring agent, proxy, or server-side log.
- An attacker with access to that source extracts the token.
- The attacker submits authenticated requests to Apify using the exposed credential.
- The attacker can perform operations allowed by the token until it is revoked, expires, or is otherwise ...[truncated 737 chars]
- A user exports a valid
- Remediation
View remediation
Remediation Suggestions
-
Remove the token from both request URLs and use an authorization header supported by Apify:
bash curl -X POST \ "https://api.apify.com/v2/acts/apidojo~twitter-user-scraper/runs" \ -H "Authorization: Bearer $APIFY_TOKEN" \ -H "Content-Type: application/json" \ -d '{"searchTerms": ["founder [SECTOR]", "building [SECTOR] startup", "CEO [SECTOR]", "#buildinpublic [SECTOR]"], "maxItems": 100}'bash curl \ "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items" \ -H "Authorization: Bearer $APIFY_TOKEN" -
Verify the precise authorization-header syntax against the current Apify API documentation before publishing the replacement examples.
-
Use a narrowly scoped token with only the permissions required to run the designated actor and read its resulting dataset.
-
Ensure
.envfiles are excluded from version control and readable only by the owning account. -
Disable shell tracing around credential-bearing operations and configure clients, proxies, and monitoring systems to redact authorization values.
-
Rotate any token that may already have appeared in command output, process telemetry, logs, or copied URLs.
-
