T09 · Insecure Skill Coding Practices
- Location
scripts/apify_runner.py:44- Finding
Apify API Token Exposure Through URL Query Parameters and Command-Line Arguments
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Apify scraping skill is mostly purpose-aligned, but it handles Apify credentials unsafely and can send user targets to third-party actors with limited disclosure and confirmation.
Review this before installing if you will use real Apify account tokens or sensitive target lists. Prefer a limited-scope Apify token, avoid the documented --token command-line form, keep config files out of version control with restrictive permissions, and confirm which actor will receive your targets before running full jobs.
scripts/apify_runner.py:44Apify API Token Exposure Through URL Query Parameters and Command-Line Arguments
The code does support core Apify Actor execution behavior: starting actor runs, probe testing, batch splitting, polling/waiting, and collecting dataset results. However, it does not implement Actor discovery or any quality filtering/ranking of candidate Actors. Instead, it requires the caller to provide an explicit actor_id and simply executes that actor. So the description overstates important capabilities, making it a description-behavior mismatch.
The declared description promises an end-to-end capability to run Apify Actors for scraping, including discovery, quality filtering, probe testing, batched execution, and result collection. The supplied code chunk implements only the discovery/filtering portion: it queries the Apify Store API, applies quality thresholds, scores actors, and returns ranked candidates. There is no code to invoke actors, pass inputs, monitor runs, test outputs, batch executions, or retrieve scraping results. So the actual behavior is a narrower subset and materially different from the declared primary purpose.
The skill instructs use of environment variables, local config files, network fetches, and writing results to disk, but it declares no explicit tool scope or permission boundaries. In an agent setting, that omission makes the skill harder to sandbox and review, increasing the risk of unintended access to secrets, local files, and outbound data transmission.
The trigger is broad enough to activate for many generic requests to extract website or social-media data, which can cause the agent to invoke third-party scraping workflows without a clear user expectation of external transmission. In context, this is more dangerous because the skill can target many platforms and automate actor selection and execution, expanding chances of over-collection or unintended use.
The skill does not warn users that their targets, URLs, usernames, keywords, and filters may be transmitted to a third-party service during actor discovery, documentation fetches, probe runs, and full execution. In a scraping skill, that missing disclosure materially affects privacy and data-handling expectations, especially when users may provide sensitive investigative or proprietary target lists.
Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.
- The user's targets and filters
- Sensible defaults from the documentation
**Do NOT ask the user to write JSON.** Build it from their natural language request.
### Step 5: Probe Test (Top 1 → Top 2 → Top 3 fallback)
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
def start_run(actor_id, run_input, token):
"""启动 Actor Run"""
url = f"{API_BASE}/acts/{actor_id.replace('/', '~')}/runs"
resp = requests.post(
url,
json=run_input,
headers={"Content-Type": "application/json"},
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
import argparse
import requests
STORE_API = "https://api.apify.com/v2/store"
# 质量筛选阈值
MIN_SUCCESS_RATE = 0.95
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.
import argparse
import requests
STORE_API = "https://api.apify.com/v2/store"
# 质量筛选阈值
MIN_SUCCESS_RATE = 0.95
The workflow supports saving raw JSON results to an output path but does not warn that collected data may be written to local disk. That omission can lead to unintentional persistence of scraped content, including potentially sensitive data, in shared or insecure locations.
The module docstring and CLI help text are written in Chinese, which constitutes a language-specific instruction surface for users. Under the policy rule, locale or language constraints should either be optional for the user or clearly justified as region-specific; this file provides neither.
No suspicious patterns detected.