T09 · Insecure Skill Coding Practices
Warning
- Location
- scripts/fetch_tempest.py:145
- Finding
- Tempest API token may be exposed through command-line arguments and URL query strings<![CDATA[ ## Vulnerability Details **File Location**: `scripts/fetch_tempest.py:5-11, 55-58, 145-146`; `README.md:27-30`; `SKILL.md:43-49, 61-64` **Vulnerability Type**: Credential exposure through process arguments, shell history, and URL-bearing telemetry **Risk Level**: Medium ### Complete Code Snippets `scripts/fetch_tempest.py:5-11`: ```python Usage: python3 fetch_tempest.py --token YOUR_TOKEN --station 12345 python3 fetch_tempest.py --token YOUR_TOKEN --station 12345 --pretty Environment variables (alternative to flags): TEMPEST_TOKEN TEMPEST_STATION_ID ``` `scripts/fetch_tempest.py:55-58`: ```python def fetch_observation(token, station_id): url = f"{BASE_URL}/observations/station/{station_id}" resp = requests.get(url, params={"token": token}, timeout=10) ``` `scripts/fetch_tempest.py:145-146`: ```python parser.add_argument("--token", default=os.environ.get("TEMPEST_TOKEN"), help="API token") parser.add_argument("--station", default=os.environ.get("TEMPEST_STATION_ID"), help="Station ID") ``` `README.md:27-30`: ```bash Find your Station ID: ```bash curl -s "https://swd.weatherflow.com/swd/rest/stations?token=YOUR_TOKEN" | python3 -m json.tool ``` ``` `SKILL.md:43-49`: ```text GET https://swd.weatherflow.com/swd/rest/observations/station/{STATION_ID}?token={TEMPEST_TOKEN} ``` Fallback (by device): `GET https://swd.weatherflow.com/swd/rest/observations/?device_id={DEVICE_ID}&token={TEMPEST_TOKEN}` To list available stations/devices: `GET https://swd.weatherflow.com/swd/rest/stations?token={TEMPEST_TOKEN}` ``` `SKILL.md:61-64`: ```bash curl -s "https://swd.weatherflow.com/swd/rest/observations/station/${STATION_ID}?token=${TEMPEST_TOKEN}" ``` ### Technical Analysis The WeatherFlow API requires the personal access token as a query parameter, so transmitting the token to the fixed official HTTPS endpoint is necessary for the declared functionality and is not unauthorized exfiltration. However, the Skill also encourages ...[truncated 1859 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove or deprecate the `--token` option so credentials are not accepted directly through process arguments. 2. Prefer `TEMPEST_TOKEN` or a permission-restricted configuration file. Document that the environment variable is the recommended method. 3. If interactive operation is required, read the token with `getpass.getpass()` rather than from a visible command-line argument. 4. Warn users not to replace `YOUR_TOKEN` with a literal credential in commands retained by shell history. 5. Where curl must be used, obtain credentials from protected configuration and ensure command tracing such as `set -x` is disabled. 6. Ensure application, proxy, and diagnostic logging redacts the `token` query parameter. 7. Use narrowly scoped tokens where supported and document immediate token rotation after suspected exposure. 8. Retain HTTPS certificate verification and the fixed WeatherFlow origin; both are already provided by the current implementation. ]]>
