T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:53
- Finding
- User API Token Exposed Through Command-Line Arguments## Vulnerability Details **File Location**: `SKILL.md:53`, `SKILL.md:60`, and `SKILL.md:66` **Vulnerability Type**: Credential exposure through command-line arguments **Risk Level**: Medium ### Vulnerable Code ```bash npm run cli -- auth login --token <your-token> --base-url https://www.sportfolio.market ``` ```bash npm run cli -- auth login --token <your-token> --base-url http://127.0.0.1:5000 ``` ```bash node packages/sportfolio-cli/bin/sportfolio.mjs auth login --token <your-token> --base-url https://www.sportfolio.market ``` ### Technical Analysis The documented authentication workflow instructs users to place a user API token directly in a command-line argument. Sensitive command-line arguments may be retained in shell history, terminal-session logs, command auditing systems, or diagnostic output. Depending on the operating system and process configuration, they may also be temporarily visible through process-inspection interfaces while the command is running. This practice conflicts with the instruction at `SKILL.md:23` to avoid placing tokens in shell history or logs. The placeholder itself is not a hardcoded secret, but users following the examples would replace it with a live bearer token. ### Attack Path 1. A user creates a user-scoped Sportfolio API token. 2. The user follows one of the documented commands and substitutes the live token for `<your-token>`. 3. The shell records the command in history, or another local monitoring or diagnostic mechanism captures the process arguments. 4. An attacker with access to the affected local account, history files, terminal logs, process telemetry, or command-auditing records extracts the token. 5. The attacker submits the token to the documented Sportfolio MCP endpoint or uses it through the repository-local CLI. 6. The attacker accesses capabilities available within the compromised user's account boundary, including immediate reads and any exposed account operations. Gameplay mutations remain subject ...[truncated 1001 chars]
- Remediation
- ## Remediation Suggestions 1. Replace the `--token` examples with an interactive authentication command that reads the token from a hidden, non-echoing prompt. 2. Add support for reading the token from standard input or a protected credential store, ensuring that the value is never printed or logged. 3. If environment-variable authentication is supported, document it only as a secondary option and warn that environment variables can also leak through child processes, diagnostics, crash reports, or misconfigured telemetry. 4. Ensure the CLI redacts authorization headers and token values from normal output, errors, debug logs, exception traces, and telemetry. 5. Store persistent credentials using operating-system credential facilities or a configuration file with restrictive permissions rather than plaintext command history. 6. Document token revocation and rotation steps for users who previously entered tokens directly on the command line. 7. Add automated documentation checks that reject examples containing sensitive options such as `--token <value>`. A safer interface would resemble: ```bash npm run cli -- auth login --base-url https://www.sportfolio.market # The CLI then obtains the token through a hidden interactive prompt. ```
