T09 · Insecure Skill Coding Practices
- Location
scripts/fetch_workouts.py:405- Finding
API Bearer Token Exposed Through Command-Line Arguments
- Content
View full analysis
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: MediumVulnerable Code
scripts/fetch_workouts.py:4python Usage: python fetch_workouts.py --token <API_TOKEN> [options]scripts/fetch_workouts.py:405python parser.add_argument("--token", required=True, help="API access token")SKILL.md:15bash python3 scripts/fetch_workouts.py --token <API_TOKEN> --from-date 2026-03-01 --format tableSKILL.md:79-91bash # 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-01Technical Analysis
The Skill requires users to provide an OAuth2 bearer token directly through the
--tokencommand-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
psor/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/apiin 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
- A user follows the examples in
SKILL.mdand ...[truncated 1386 chars]
- Remediation
View remediation
Remediation Suggestions
- Replace the required
--tokenargument 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.
- Read from a dedicated environment variable such as
- If backward compatibility requires retaining
--token, mark it as deprecated and display a warning explaining that process arguments may be visible. - Update every command in
SKILL.mdso it does not place a token directly in the command line. - Avoid printing, logging, or including the token in exception messages.
- Recommend short-lived, minimally scoped tokens where the Concept2 API supports them.
- 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-01The implementation should retrieve the value through
os.environand fail safely without echoing it.- Replace the required
