T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:27
- Finding
- Broad Stripe Credential Exposed Through Environment and Command-Line Expansion## Vulnerability Details **File Location**: `SKILL.md:27-43`; repeated command-line expansion at `SKILL.md:47-49`, `SKILL.md:53-55`, and `SKILL.md:98-110` **Vulnerability Type**: Credential exposure and excessive credential scope **Risk Level**: Medium ### Vulnerable Code ```bash export STRIPE_API_KEY="$(cat /home/clawd/.config/stripe/api_key)" ``` ```bash curl -sS https://api.stripe.com/v1/account \ -H "Authorization: Bearer $(cat /home/clawd/.config/stripe/api_key)" ``` The same command-line authorization pattern is also used for connected-account, balance, application-fee, payout, and charge requests. The Python pagination example similarly reads the platform credential and attaches it to outgoing Stripe requests: ```python key = Path('/home/clawd/.config/stripe/api_key').read_text().strip() count = 0 starting_after = None while True: params = {'limit': 100} if starting_after: params['starting_after'] = starting_after req = urllib.request.Request('https://api.stripe.com/v1/accounts?' + urllib.parse.urlencode(params)) req.add_header('Authorization', f'Bearer {key}') with urllib.request.urlopen(req, timeout=60) as r: data = json.load(r) ``` ### Technical Analysis The Skill instructs the Agent to read a locally stored Stripe API key and either export it to the process environment or substitute it directly into a `curl` command argument. Direct command-line expansion can make the bearer credential visible through process inspection, shell tracing, command telemetry, debugging output, terminal capture, or improperly configured logging. Exporting the key also propagates it to subsequently launched child processes. Sending the credential to `https://api.stripe.com` is necessary for the declared direct Stripe API functionality and is not evidence of transmission to an unrelated party. However, the documentation recommends a platform-level key for broad Connect report ...[truncated 1685 chars]
- Remediation
- ## Remediation Suggestions 1. Require a Stripe restricted API key configured with only the read permissions necessary for the requested reporting endpoints. 2. Explicitly prohibit unrestricted platform secret keys and write-capable credentials for this Skill. 3. Avoid exporting the credential globally. Limit credential availability to the single process that performs the request. 4. Avoid placing bearer credentials directly in command-line arguments. Prefer an official Stripe SDK or a protected credential-loading mechanism that keeps secrets out of process arguments and ordinary logs. 5. Ensure shell tracing is disabled while credentials are loaded or used, and redact authorization headers from command, proxy, and diagnostic logs. 6. Apply restrictive filesystem permissions to the key file, such as owner-only read access, and validate ownership before use. 7. Use separate restricted keys for distinct reporting workloads or environments to reduce blast radius. 8. Rotate any key suspected of appearing in process telemetry, shell history, terminal recordings, or logs. 9. Add explicit endpoint allowlisting and reject write operations unless a separate, clearly authorized workflow is invoked with an appropriately scoped credential.
