T09 · Insecure Skill Coding Practices
- Location
scripts/get_tempest_weather.py:511- Finding
API Token Exposure Through Command-Line Arguments
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:40-45;scripts/get_tempest_weather.py:511-515
Vulnerability Type: Sensitive credential exposure through process arguments
Risk Level: MediumVulnerable Code
markdown # Explicit station/token (current observations) python3 scripts/get_tempest_weather.py --station-id 12345 --token "$TEMPEST_API_TOKEN" # Explicit device/token (current observations) python3 scripts/get_tempest_weather.py --device-id 67890 --token "$TEMPEST_API_TOKEN"python ap = argparse.ArgumentParser(description="Fetch current or historical weather from a Tempest station/device") ap.add_argument("--station-id", default=os.getenv("TEMPEST_STATION_ID")) ap.add_argument("--device-id", default=os.getenv("TEMPEST_DEVICE_ID")) ap.add_argument("--token", default=os.getenv("TEMPEST_API_TOKEN")) ap.add_argument("--units", default=os.getenv("TEMPEST_UNITS", "us"), choices=["us", "metric"])Technical Analysis
The script accepts the Tempest API token through the
--tokencommand-line option, and the Skill documentation explicitly recommends invoking it this way. Although the shell expression references an environment variable, the shell expands it before process creation. The resulting token is therefore placed in the process argument vector.Depending on host configuration, process arguments may be visible to other local users, process-monitoring services, diagnostic collectors, shell tracing, audit systems, or orchestration telemetry. This exposure is unnecessary because the script already supports reading
TEMPEST_API_TOKENdirectly from the environment.The script does redact the token from successful JSON output, but that redaction does not protect the process argument vector.
Attack Path
- A user follows the documented command and passes
--token "$TEMPEST_API_TOKEN". - The shell expands the environment variable to the actual credential.
- Python st ...[truncated 929 chars]
- A user follows the documented command and passes
- Remediation
View remediation
Remediation Suggestions
- Remove the
--tokenoption and read the credential only fromTEMPEST_API_TOKENor a dedicated permission-restricted credential source. - Remove the command-line token examples from
SKILL.md. - If an explicit runtime override is required, accept the token through standard input or a protected file descriptor rather than the argument vector.
- Avoid printing credentials in validation errors, debug logs, exception messages, and telemetry.
- Add an automated test that verifies documented invocations do not place the token in command-line arguments.
- Rotate the API token if it has previously been used in environments that collect process command lines.
- Remove the
