T09 · Insecure Skill Coding Practices
Error
- Location
- SKILL.md:7
- Finding
- Gitea API Token Can Be Transmitted over Plaintext HTTP<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:5-8`; `index.js:21-22, 30, 39-40, 56, 63` **Vulnerability Type**: Sensitive credential transmission over an unencrypted channel **Risk Level**: High ### Vulnerable Code `SKILL.md:5-8`: ```markdown ## Environment Variables - `GITEA_URL` - Gitea API URL (e.g., `http://8.137.50.76:10000`) - `GITEA_TOKEN` - Gitea API token ``` `index.js:21-22`: ```js const GITEA_URL = mustGetEnv("GITEA_URL").replace(/\/+$/, ""); const GITEA_TOKEN = mustGetEnv("GITEA_TOKEN"); ``` `index.js:30`: ```js const baseUrl = `${GITEA_URL}/api/v1/repos/${encodeURIComponent(owner)}/${encodeURIComponent(repo)}`; ``` `index.js:39-40`: ```js "-H", `Authorization: token ${GITEA_TOKEN}`, "-H", "Content-Type: application/json", ``` The same authorization header pattern is used for the remaining API operations at `index.js:56` and `index.js:63`. ### Technical Analysis The documentation explicitly presents a plaintext `http://` Gitea URL as its configuration example. The implementation accepts the configured URL without validating its scheme and passes the API token in the HTTP `Authorization` header. When `GITEA_URL` uses HTTP, neither the credential nor the response has transport-layer confidentiality or integrity. A network-positioned attacker can read the API token, observe repository and workflow information, or alter API traffic. URL encoding of repository parameters does not mitigate transport interception. ### Attack Path 1. An operator configures `GITEA_URL` with an `http://` endpoint, potentially by following the documented example. 2. The operator invokes the skill to dispatch a workflow, list runs, or retrieve a run. 3. The skill sends `Authorization: token <GITEA_TOKEN>` to the endpoint without TLS. 4. An attacker with access to the network path captures the request and extracts the token. 5. The attacker reuses the token directly against the Gitea API. 6. The attacker obtains whatever repository and workflow ...[truncated 741 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Parse `GITEA_URL` with the standard `URL` class and require the `https:` protocol before sending credentials. 2. Reject `http:` endpoints by default with an explicit security error. 3. If plaintext HTTP is required for isolated local development, place it behind an explicit opt-in setting, restrict it to loopback addresses, and display a prominent warning. 4. Replace the documentation example with an HTTPS URL, such as `https://gitea.example.com`. 5. Configure strict TLS certificate validation and do not introduce options that bypass certificate verification. 6. Scope the Gitea token to only the repositories and workflow permissions required by the skill. 7. Rotate any token that may already have been used over an untrusted plaintext connection. ]]>
