T09 · Insecure Skill Coding Practices
- Location
SKILL.md:98- Finding
Apify API Token Exposed in URL Query Parameters
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 98–107
Vulnerability Type: API credential exposure through URL query parameters
Risk Level: Mediumbash curl -X POST \ "https://api.apify.com/v2/acts/apidojo~tweet-scraper/runs?token=$APIFY_TOKEN" \ -H "Content-Type: application/json" \ -d '{"searchTerms": ["call for speakers [TOPIC]", "looking for speakers [TOPIC]", "CFP [TOPIC]", "speaker applications [TOPIC]"], "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 interpolates
APIFY_TOKENdirectly into the request URL. Sending a credential to the declared Apify service is necessary for this Skill's functionality, but placing it in a query parameter is not the minimum-risk authentication method.Query strings are commonly recorded by HTTP access logs, reverse proxies, observability platforms, command tracing, diagnostic output, and process-monitoring tools. The expanded URL may also be exposed to other local users through process inspection while
curlis running. Consequently, infrastructure or users that do not require access to the credential may receive it.This is a credential-handling weakness rather than evidence of intentional exfiltration: the destination is the expected
api.apify.comservice, and the audited file contains no hidden secondary recipient.Attack Path
- A user or Agent follows the documented REST fallback with a valid
APIFY_TOKEN. - The shell expands the environment variable into the
curlURL. - The complete URL, including the token, becomes visible through process inspection, verbose command telemetry, proxy logs, server access logs, or diagnostic records.
- An attacker or unauthorized operator with access to one of those sources extracts the token.
- The attacker submits authenticated r ...[truncated 709 chars]
- A user or Agent follows the documented REST fallback with a valid
- Remediation
View remediation
Remediation Suggestions
-
Replace query-string authentication with Apify's supported authorization-header mechanism, 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": ["call for speakers [TOPIC]", "looking for speakers [TOPIC]", "CFP [TOPIC]", "speaker applications [TOPIC]"], "maxItems": 100}'Fetch datasets using the same header-based approach:
bash curl \ "https://api.apify.com/v2/actor-runs/$RUN_ID/dataset/items" \ -H "Authorization: Bearer $APIFY_TOKEN" -
Confirm the exact header syntax against the current official Apify API documentation before publishing the revised commands.
-
Use a narrowly scoped token with only the permissions required to run the specified Actor and retrieve its resulting dataset.
-
Avoid printing, tracing, or logging commands and headers containing credentials. Configure CI, proxy, and observability systems to redact authorization values.
-
Load the token from a protected secret store or environment variable and never place it in generated output files.
-
Rotate any token previously used in query parameters if logs or telemetry may have retained the complete URLs.
-
Set conservative usage limits and monitor Actor execution for unexpected requests or quota consumption.
-
