T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:13
- Finding
- Secret Values Are Passed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 13–16; additional examples at lines 53–55 and 62–65 **Vulnerability Type**: T09: Insecure Skill Coding Practices **Risk Level**: Medium ### Vulnerable Code ```bash # Store a secret ravi secrets set OPENAI_API_KEY "sk-abc123..." ``` Additional documented examples use the same insecure pattern: ```bash # Store a key ravi secrets set OPENAI_API_KEY "sk-abc123..." ``` ```bash ravi secrets set ANTHROPIC_API_KEY "sk-ant-..." ravi secrets set GITHUB_TOKEN "ghp_..." ``` ### Technical Analysis The documented interface passes secret values directly as command-line arguments. Although quoting prevents ordinary shell word splitting, it does not protect the value from exposure through mechanisms that record or inspect command invocations. Depending on the operating system, shell configuration, and surrounding infrastructure, plaintext arguments may be exposed through: - Shell history files. - Process-listing and process-inspection interfaces while the command runs. - Operating-system audit facilities. - Terminal session recording. - Endpoint monitoring and command telemetry. - CI/CD job logs or debugging output. The skill is specifically intended to handle API keys, environment variables, and access tokens. Exposure through command arguments can therefore compromise credentials even if the destination service encrypts their values at rest. Server-side encryption does not protect secrets before transmission or while they are present in local process arguments. ### Attack Path 1. A user follows the documented example and runs `ravi secrets set` with a real token as the second argument. 2. The plaintext token becomes part of the shell command and process argument vector. 3. The command is retained by shell history, process monitoring, audit telemetry, terminal recording, or CI/CD logging. 4. A local user, administrator, monitoring-system operator, or attacker with access to those records retriev ...[truncated 608 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Change the CLI to accept secret values through standard input rather than command-line arguments, for example: ```bash printf '%s' "$OPENAI_API_KEY" | ravi secrets set OPENAI_API_KEY --stdin ``` - Provide an interactive, no-echo prompt when standard input is attached to a terminal. - Support protected file descriptors or restricted-permission input files for automation. - Ensure the CLI never logs, echoes, or includes the submitted value in error messages. - Redact secret values from tracing, telemetry, and debug output. - Replace every documented command that embeds a secret directly in the argument list. - Warn users not to place literal credentials in shell commands, shell history, CI configuration, or terminal recordings. - Where practical, recommend short-lived, narrowly scoped credentials and credential rotation after suspected disclosure. ]]>
