T09 · Insecure Skill Coding Practices
- Location
scripts/billing.py:58- Finding
Billing API Key Exposed Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
scripts/billing.py, lines 58-70
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: MediumVulnerable 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-keycommand-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_KEYenvironment 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 theX-API-Keyheader for requests to SkillPay.Attack Path
- A user or Agent invokes
billing.pywith--api-keycontaining a valid SkillPay credential. - The operating system or execution environment exposes or records the complete process command line.
- An attacker with access to process metadata, shell history, Agent logs, or execution telemetry extracts the credential.
- The attacker submits requests to the documented SkillPay billing endpoints using the st ...[truncated 645 chars]
- A user or Agent invokes
- Remediation
View remediation
Remediation Suggestions
- Remove the
--api-keycommand-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-Keyand 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.
- Remove the
