T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/fetch_workouts.py:405
- Finding
- API Bearer Token Exposed Through Command-Line Arguments## Vulnerability Details **File Location**: `scripts/fetch_workouts.py:4`, `scripts/fetch_workouts.py:405`; `SKILL.md:15`, `SKILL.md:79-91` **Vulnerability Type**: Insecure credential handling through process arguments **Risk Level**: Medium ### Vulnerable Code `scripts/fetch_workouts.py:4` ```python Usage: python fetch_workouts.py --token <API_TOKEN> [options] ``` `scripts/fetch_workouts.py:405` ```python parser.add_argument("--token", required=True, help="API access token") ``` `SKILL.md:15` ```bash python3 scripts/fetch_workouts.py --token <API_TOKEN> --from-date 2026-03-01 --format table ``` `SKILL.md:79-91` ```bash # Auto-detect max HR from birthdate in profile python3 scripts/fetch_workouts.py --token <TOKEN> --from-date 2026-03-01 # Specify max HR manually python3 scripts/fetch_workouts.py --token <TOKEN> --max-hr 165 --from-date 2026-02-01 # Estimate max HR from age python3 scripts/fetch_workouts.py --token <TOKEN> --age 59 --from-date 2026-02-01 ``` ### Technical Analysis The Skill requires users to provide an OAuth2 bearer token directly through the `--token` command-line option. Command-line arguments are not an appropriate channel for long-lived or reusable secrets because they may be exposed through: - Shell history files. - Process-listing facilities such as `ps` or `/proc/<pid>/cmdline`. - Process monitoring and endpoint telemetry. - Terminal session recording. - Diagnostic logs, copied commands, and support transcripts. - Automation systems that retain executed command lines. The script subsequently sends the token only to the fixed HTTPS endpoint `https://log.concept2.com/api` in an Authorization header, which is necessary for its declared functionality. The vulnerability concerns how the secret enters the program, not the authenticated HTTPS request itself. ### Attack Path 1. A user follows the examples in `SKILL.md` and ...[truncated 1386 chars]
- Remediation
- ## Remediation Suggestions 1. Replace the required `--token` argument with a protected input mechanism: - Read from a dedicated environment variable such as `CONCEPT2_API_TOKEN`. - Prompt interactively with `getpass.getpass()` so the token is not echoed. - Integrate with an operating-system credential store for persistent use. 2. If backward compatibility requires retaining `--token`, mark it as deprecated and display a warning explaining that process arguments may be visible. 3. Update every command in `SKILL.md` so it does not place a token directly in the command line. 4. Avoid printing, logging, or including the token in exception messages. 5. Recommend short-lived, minimally scoped tokens where the Concept2 API supports them. 6. Document immediate token revocation and rotation procedures for suspected exposure. A safer invocation pattern would be: ```bash export CONCEPT2_API_TOKEN='...' python3 scripts/fetch_workouts.py --from-date 2026-03-01 ``` The implementation should retrieve the value through `os.environ` and fail safely without echoing it.
