T09 · Insecure Skill Coding Practices
Warning
- Location
- index.js:103
- Finding
- RTM API credentials exposed through command-line arguments<![CDATA[ ## Vulnerability Details **File Location**: `index.js:103-111`; documented usage at `SKILL.md:40-43` **Vulnerability Type**: Sensitive information exposure through process arguments and shell history **Risk Level**: Medium ### Complete Code Snippet ```js if (subcmd === 'config') { const newApiKey = argv[1]; const newSecret = argv[2]; if (!newApiKey || !newSecret) { throw new Error('Provide both API Key and Shared Secret: rtm config <api_key> <shared_secret>'); } fs.writeFileSync(CREDENTIALS_FILE, JSON.stringify({ API_KEY: newApiKey, SHARED_SECRET: newSecret }, null, 2), { mode: 0o600 }); ``` The corresponding documented command is: ```bash rtm config <your-api-key> <your-shared-secret> ``` ### Technical Analysis The recommended configuration mechanism accepts both the RTM API key and shared secret as ordinary command-line arguments. Although the destination file is created with restrictive `0600` permissions, those permissions only protect the resulting file. They do not protect credentials while they are present in the command line. Depending on the host environment, command arguments may be exposed through: - Interactive shell history. - Terminal session recording. - Process inspection while the command is running. - Endpoint monitoring and command-auditing software. - CI/CD logs or automation diagnostics. - Copy-and-paste records and support transcripts. The implementation does not redact, prompt securely for, or otherwise prevent retention of the shared secret. This is especially relevant because the documentation describes this command as the recommended setup method. ### Attack Path 1. A user follows the documentation and runs `rtm config` with the API key and shared secret directly in the command. 2. The shell, terminal recorder, process monitor, or command-auditing system records the complete invocation. 3. An attacker or lower-privileged operator with access to those records retrieves the API key and sh ...[truncated 1073 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace secret-bearing command arguments with an interactive prompt that reads the shared secret from standard input without echoing it. 2. Keep the API key as an argument only if it is explicitly considered non-secret; prompt separately for the shared secret. 3. Support loading credentials from a user-selected, permission-checked file or from standard input. 4. Prefer an operating-system credential store such as macOS Keychain, Windows Credential Manager, or a Linux secret service. 5. Update `SKILL.md` so the recommended setup procedure never places the shared secret directly in shell history. 6. Continue creating fallback credential files with `0600` permissions, and verify the file is owned by the current user before reading it. 7. Provide guidance for clearing historical commands and rotating credentials for users who previously used the vulnerable configuration method. ]]>
