T09 · Insecure Skill Coding Practices
- Location
scripts/anysearch_cli.sh:38- Finding
API Key Exposure Through Process Command-Line Arguments
- Content
View full analysis
/dev/null) ``` The shell command handlers also accept the secret directly through a command-line option: ```bash --api_key) API_KEY="$2"; shift 2 ;; ``` The Python implementation exposes the same user-facing option: ```python parser.add_argument("--api_key", default=os.environ.get("ANYSEARCH_API_KEY", ""), help="API key (optional)") ``` ### Technical Analysis The Bash implementation constructs an `Authorization` header containing the AnySearch API key and passes that header to `curl` as a command-line argument. As a result, even a key originally loaded from a protected environment file is copied into the argument vector of the spawned `curl` process. Depending on operating-system settings, process arguments can be visible through process inspection utilities, process accounting, endpoint monitoring, diagnostic collection, crash reports, or command execution logs. The explicitly supported `--api_key` option introduces an additional exposure route because the secret may also be recorded in shell history and appears in the parent CLI process arguments. This network authent ...[truncated 1304 chars]- Remediation
View remediation
