T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:39
- Finding
- Sensitive API-Key Profile Data May Be Exposed to Agent Context and Logs< Step 2 and remembered for the session. ### Step A — Verify credentials Run **both** commands — the `apiKey` field from `okx auth status --json` is the auth-binary's internal state and is always `false` regardless of whether `~/.okx/config.toml` has an API-key profile. `okx config show --json` is the only authoritative source for API-key presence. ```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 to Step B. ``` ### Technical Analysis The Skill instructs the Agent to execute `okx config show --json` before every authenticated command and inspect whether an `api_key` field is non-empty. The document explicitly states that this command reveals API-key profiles. Using complete configuration output for a credential-presence check violates data-minimization principles. If the command does not comprehensively redact sensitive fields, API keys or related account configuration can enter the Agent's tool context, command logs, transcripts, telemetry, or debugging output. Repeating this operation before every authenticated command unnecessarily increases the number of opportunities for disclosure. The Skill appropriately tells users not to submit credentials in chat, but that protection does not address credentials exposed by local command output. ### Attack Path 1. A user invokes an authenticated Grid or DCA bot operation. 2. The Agent follows the Skill and runs `okx config show ...[truncated 1083 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace complete configuration output with a purpose-built status operation that returns only: - Profile name - Live or demo mode - A boolean indicating whether credentials are configured 2. Ensure the CLI redacts API keys, secrets, passphrases, OAuth tokens, and other sensitive fields by default. 3. Do not place raw configuration objects in model context. 4. If no safer command exists, filter the output locally before it is returned to the Agent. The filter should use an allowlist rather than attempting to enumerate sensitive field names. 5. Perform the credential-mode check once per session unless authentication state changes, rather than before every command. 6. Add explicit instructions never to reproduce configuration output in user-facing responses or persistent logs. 7. Add automated tests confirming that all credential-status commands remain redacted across both API-key and OAuth authentication modes. ]]>
