T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/acestep.sh:287
- Finding
- Plaintext API Key Disclosure Through the Default Configuration Command<![CDATA[ ## Vulnerability Details **File Location**: `scripts/acestep.sh`, lines 287-292 **Vulnerability Type**: Sensitive credential exposure **Risk Level**: Medium ### Vulnerable Code ```bash *) echo "Config file: $CONFIG_FILE" echo "Output dir: $OUTPUT_DIR" echo "----------------------------------------" cat "$CONFIG_FILE" echo "----------------------------------------" ``` ### Technical Analysis The default branch of `cmd_config` prints the configuration file without masking sensitive fields. Because `config.json` stores `api_key` as plaintext, invoking `acestep.sh config` without an explicit action discloses the complete credential. This behavior is inconsistent with the safer `config --list` implementation, which masks populated API keys before displaying the configuration. It also contradicts the guidance in `SKILL.md`, which says that API keys must not be printed and recommends `config --check-key`. The disclosure does not require bypassing file permissions: it occurs through an ordinary documented command path and can therefore be triggered accidentally by a user, an AI agent, an automation script, or a troubleshooting workflow. ### Attack Path 1. A user configures a valid API key using `config --set api_key`. 2. The key is stored in `scripts/config.json`. 3. A user or agent invokes `./scripts/acestep.sh config` without `--list`, `--get`, or another action. 4. The default branch executes `cat "$CONFIG_FILE"`. 5. The plaintext key is written to standard output. 6. The credential may be retained in an AI transcript, CI log, terminal history capture, support record, or screen recording accessible to another party. ### Impact Assessment An attacker who gains access to the exposed output may obtain the privileges associated with the API key. Depending on the remote service's authorization model, this could permit unauthorized music-generation requests, consumption of account quota ...[truncated 299 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the raw `cat "$CONFIG_FILE"` call with the same masking filter used by `config --list`: ```bash jq 'walk( if type == "object" and has("api_key") and (.api_key | length) > 0 then .api_key = "***" else . end )' "$CONFIG_FILE" ``` 2. Make `config --list` the default behavior instead of maintaining a separate, unsafe display path. 3. Explicitly reject `config --get api_key`; direct users to `config --check-key`. 4. Prefer reading the API key from an environment variable or operating-system credential store rather than persisting it in project-local plaintext. 5. If file-based storage remains necessary, create `config.json` with restrictive permissions, such as mode `0600`, and verify ownership before reading it. 6. Add regression tests confirming that no invocation of the configuration command emits a configured API key. ]]>
