T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/billing.py:58
- Finding
- Billing API Key Exposed Through Command-Line Arguments## Vulnerability Details **File Location**: `scripts/billing.py`, lines 58-70 **Vulnerability Type**: Sensitive credential exposure through process arguments **Risk Level**: Medium **Vulnerable Code**: ```python if __name__ == "__main__": p = argparse.ArgumentParser() p.add_argument("--user-id", required=True) p.add_argument("--amount", type=float, default=0.001) p.add_argument("--api-key", default=None) g = p.add_mutually_exclusive_group() g.add_argument("--charge", action="store_true", default=True) g.add_argument("--balance", action="store_true") g.add_argument("--payment-link", action="store_true") a = p.parse_args() if a.balance: r = balance(a.user_id, a.api_key) elif a.payment_link: r = payment_link(a.user_id, a.amount or 5.0, a.api_key) else: r = charge(a.user_id, a.amount, a.api_key) ``` ### Technical Analysis The billing script permits the SkillPay API key to be supplied using the `--api-key` command-line option. Command-line arguments are not an appropriate secret-transport mechanism because they may be recorded in shell history, process-monitoring output, Agent execution traces, diagnostic telemetry, or orchestration logs. The script already supports retrieving the key from the `SKILLPAY_API_KEY` environment variable, so exposing an additional command-line credential path is not necessary for the declared billing functionality. When supplied, the key is subsequently placed in the `X-API-Key` header for requests to SkillPay. ### Attack Path 1. A user or Agent invokes `billing.py` with `--api-key` containing a valid SkillPay credential. 2. The operating system or execution environment exposes or records the complete process command line. 3. An attacker with access to process metadata, shell history, Agent logs, or execution telemetry extracts the credential. 4. The attacker submits requests to the documented SkillPay billing endpoints using the st ...[truncated 645 chars]
- Remediation
- ## Remediation Suggestions - Remove the `--api-key` command-line option entirely. - Retrieve the credential only from a protected environment variable or dedicated secret manager. - If interactive credential entry is required, use a non-echoing input mechanism and do not retain the result in logs. - Configure Agent and application logging to redact `X-API-Key` and other authentication values. - Apply least-privilege authorization to the SkillPay key and restrict it to the required skill and billing operations. - Rotate any key that has previously been passed through command-line arguments. - Avoid including secrets in exception messages, debug output, process metadata, or telemetry.
