T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/reminder-client.mjs:16
- Finding
- Bearer Token and Reminder Data May Be Sent Over an Untrusted Plaintext Connection## Vulnerability Details **File Location**: `scripts/reminder-client.mjs:16-25, 92-102` **Vulnerability Type**: Insufficient API endpoint and transport validation **Risk Level**: High ### Vulnerable Code ```js const baseUrl = process.env.REMINDER_API_BASE_URL?.trim(); const token = process.env.REMINDER_API_TOKEN?.trim(); if (!baseUrl) { fail("Missing REMINDER_API_BASE_URL."); } if (!token) { fail("Missing REMINDER_API_TOKEN."); } ``` ```js async function requestJson(pathname, init) { const url = new URL(pathname, ensureTrailingSlash(baseUrl)); const response = await fetch(url, { ...init, headers: { authorization: `Bearer ${token}`, accept: "application/json", ...init?.headers, }, }); const bodyText = await response.text(); if (!response.ok) { const message = bodyText ? `Request failed with ${response.status}: ${bodyText}` : `Request failed with ${response.status}.`; fail(message); } printBody(bodyText); } ``` ### Technical Analysis The client verifies only that `REMINDER_API_BASE_URL` is present. It does not enforce HTTPS, restrict plaintext HTTP to loopback development endpoints, reject embedded URL credentials, or establish that the destination belongs to the intended reminder service. Every request adds `REMINDER_API_TOKEN` as a bearer credential. Create operations also transmit the complete caller-supplied JSON body, which may contain private fields such as `title`, `notes`, `location`, `url`, `start_at`, and raw `source_text`. Network transmission is necessary for the Skill's declared remote reminder functionality. The vulnerability is therefore not the transmission itself, but the absence of minimum transport and destination controls around sensitive transmissions. The configuration guidance permits HTTP for local development, but the implementation does not constrain HTTP to loopback destinations. ...[truncated 1258 chars]
- Remediation
- ## Remediation Suggestions 1. Parse and validate `REMINDER_API_BASE_URL` before processing any command. 2. Require the `https:` scheme for every non-loopback destination. 3. Allow `http:` only for explicitly recognized loopback hosts such as `localhost`, `127.0.0.1`, and `[::1]`. 4. Reject unsupported schemes, malformed ports, fragments, query strings, and URLs containing embedded usernames or passwords. 5. Consider a trusted-origin allowlist or require explicit confirmation when the configured API origin changes. 6. Prevent credential leakage through redirects by disabling automatic redirects or manually validating every redirect destination before resending the authorization header. 7. Document that the bearer token must only be sent to a trusted reminder worker over authenticated TLS. 8. Minimize transmitted personal data by omitting optional fields such as `source_text`, `notes`, or `location` unless required by the user. 9. Add automated tests confirming rejection of remote HTTP endpoints, non-HTTP schemes, embedded credentials, and redirects to untrusted origins.
