T09 · Insecure Skill Coding Practices
Warning
- Location
- references/key-auth/references/examples.md:82
- Finding
- API Secret Exposed Through Command-Line Arguments<![CDATA[ ## Vulnerability Details **File Location**: `references/key-auth/references/examples.md:82-94` **Additional Location**: `references/key-auth/references/login-flow.md:90-101` **Vulnerability Type**: API secret disclosure through process arguments **Risk Level**: Medium ### Vulnerable Code Snippet ```bash dimens-cli auth api-key-login \ --api-key ak_xxx \ --api-secret sk_xxx ``` The documentation also recommends the equivalent argument form: ```bash dimens-cli auth api-key-login \ --api-key=ak_xxx \ --api-secret=sk_xxx ``` ### Technical Analysis The documented authentication procedure places the API secret directly in the command-line argument vector. When real credentials replace the placeholders, the secret may become visible through: - Shell history files. - Process inspection tools while the command is running. - Agent tool-call logs and execution transcripts. - Terminal recording and diagnostic telemetry. - CI/CD command logs. - Operating-system process accounting. The Skill does not document a masked prompt, standard-input mechanism, protected credential file, operating-system credential store, or mandatory redaction behavior. Because successful API-key authentication returns a bearer token inheriting the bound user's permissions, disclosure of the API secret can lead to account impersonation within that user's authorization scope. ### Attack Path 1. A user or Agent substitutes a real API key and secret into the documented command. 2. The shell, Agent runtime, process table, or logging system records the complete argument vector. 3. An attacker with access to local process metadata, history, or logs extracts the API secret. 4. The attacker submits the stolen key and secret to the platform authentication endpoint. 5. The platform returns an access token and potentially a refresh token. 6. The attacker uses those tokens to access or modify resources available to the bound user. ### Impact Assessment Successful exploitation may ...[truncated 454 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace command-line secret arguments with a masked interactive prompt or standard-input mechanism. 2. Support an operating-system credential store such as Keychain, Credential Manager, or Secret Service. 3. If environment-based input is necessary, prevent environment values from appearing in logs and document the residual exposure risk. 4. Automatically redact API keys, API secrets, access tokens, and refresh tokens from command previews, errors, telemetry, and Agent transcripts. 5. Disable shell history around sensitive authentication operations or provide a dedicated login command that never receives secrets through `argv`. 6. Add an explicit warning that production secrets must not be copied into literal command lines, scripts, tickets, or chat messages. 7. Rotate any credential that has already appeared in command history or execution logs. ]]>
