T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:45
- Finding
- API-Key Profile Data Is Exposed to the Agent Through Mandatory Configuration Enumeration< Step 2 and remembered for the session. ```bash okx config show --json # reveals API-key profiles (TOML config) okx auth status --json # reveals OAuth session state (auth-binary state) ``` Apply **in this order** — first match wins: - `config show --json` has any profile with a non-empty `api_key` field → **API Key mode**. Proceed. ``` ### Technical Analysis The Skill requires `okx config show --json` before every authenticated operation and explicitly examines whether a profile contains a non-empty `api_key` field. This command exposes API-key profile configuration from `~/.okx/config.toml` to the command-output channel observed by the Agent. The Skill only needs to determine whether a usable API-key profile exists. Returning the complete profile configuration, including a sensitive `api_key` field, exceeds that minimum requirement. Even if the command masks some portions in a particular CLI version, the Skill does not require masking and relies on the sensitive field itself. Once credential-related output enters the Agent context, it may be retained in conversation logs, tool traces, telemetry, or downstream model-processing systems. The audited files do not establish that the value is intentionally transmitted to a non-OKX endpoint, so this finding is an exposure and data-minimization failure rather than confirmed credential exfiltration. ### Attack ...[truncated 1161 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Add or use a status-only CLI operation that returns non-sensitive booleans, such as: ```json { "hasApiKeyProfile": true, "oauthStatus": "not_logged_in" } ``` 2. Never return `api_key`, secret-key, passphrase, token, cookie, or refresh-token fields to the Agent. 3. Perform credential detection inside a trusted local component and expose only the selected authentication mode. 4. If `config show` cannot be avoided, pipe its output through a strict allowlist filter before it reaches the Agent. Do not rely on a denylist of secret field names. 5. Redact sensitive fields at the CLI serialization layer and add automated tests confirming that configuration and authentication commands cannot emit secrets. 6. Run the profile check once per session where possible instead of before every authenticated command. 7. Review the external `../_shared/preflight.md` dependency to ensure it does not independently disclose or transmit credential data. ]]>
