T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/scrape_fb.py:11
- Finding
- Apify credentials are exposed through command-line arguments<![CDATA[ ## Vulnerability Details **File Location**: `scripts/scrape_fb.py:11-12` and `SKILL.md:28-31` **Vulnerability Type**: Credential exposure through process arguments **Risk Level**: Medium ### Vulnerable Code ```python APIFY_TOKEN = sys.argv[2] if len(sys.argv) > 2 else None FB_URL = sys.argv[1] if len(sys.argv) > 1 else None ``` The documented invocation explicitly places the credential on the command line: ```bash python3 scripts/scrape_fb.py "<FB_POST_URL>" "<APIFY_TOKEN>" ``` ### Technical Analysis The Apify API token is supplied through `argv`. Command-line arguments can be retained in shell history, captured by process-monitoring or observability systems, and exposed to other local users who have permission to inspect processes. Although sending an Apify token to Apify is necessary for the declared scraping functionality, accepting that token through a command-line argument is not necessary and creates avoidable local exposure. ### Attack Path 1. A user follows the documented command and supplies an Apify token as the second argument. 2. The complete command is saved in shell history or observed through process inspection. 3. A local attacker or log reader extracts the token. 4. The attacker reuses the token against Apify APIs until it is revoked or expires. ### Impact Assessment A compromised token may permit unauthorized actor runs, access to account-associated Apify resources subject to the token's permissions, consumption of paid platform resources, and exposure of datasets accessible with that token. This does not directly grant local code execution or Facebook Page access. ]]>
- Remediation
- <![CDATA[ ## Remediation Suggestions - Read `APIFY_TOKEN` from a protected environment variable or secret manager instead of `sys.argv`. - Permit only the non-sensitive Facebook URL as a command-line argument. - If environment variables are unsuitable, read the secret from stdin without echoing it. - Update `SKILL.md` so that examples never place real tokens in shell commands. - Redact credentials from process telemetry, exception reporting, and debug logs. - Rotate any token that has already been used through the documented command interface. ]]>
