T09 · Insecure Skill Coding Practices
Error
- Location
- scripts/bolt.sh:29
- Finding
- API token and project data can be transmitted over untrusted or plaintext HTTP endpoints<![CDATA[ ## Vulnerability Details **File Location**: `scripts/bolt.sh:29-70`; related insecure examples in `SKILL.md:21-30`, `README.md:57-61`, and `references/api-reference.md:3-5` **Vulnerability Type**: Unvalidated destination and insecure transport for sensitive API requests **Risk Level**: High ### Complete Code Snippet ```bash BASE="${BOLT_BASE_URL:?BOLT_BASE_URL is required}" BASE="${BASE%/}" # Strip trailing slash # Build auth header args AUTH_ARGS=() if [[ -n "${BOLT_API_TOKEN:-}" ]]; then AUTH_ARGS=(-H "x-bolt-token: $BOLT_API_TOKEN") fi # Wrapper: GET request bolt_get() { curl -sf \ "${AUTH_ARGS[@]}" \ "$BASE$1" } # Wrapper: POST request with JSON body bolt_post() { local path="$1" local body="${2:-{}}" local idem_key idem_key=$(cat /proc/sys/kernel/random/uuid 2>/dev/null || uuidgen 2>/dev/null || date +%s%N) curl -sf -X POST \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $idem_key" \ "${AUTH_ARGS[@]}" \ -d "$body" \ "$BASE$path" } # Wrapper: PATCH request with JSON body bolt_patch() { local path="$1" local body="$2" local idem_key idem_key=$(cat /proc/sys/kernel/random/uuid 2>/dev/null || uuidgen 2>/dev/null || date +%s%N) curl -sf -X PATCH \ -H "Content-Type: application/json" \ -H "Idempotency-Key: $idem_key" \ "${AUTH_ARGS[@]}" \ -d "$body" \ "$BASE$path" } ``` The documentation explicitly recommends plaintext examples: ```bash export BOLT_BASE_URL="http://localhost:4000" export BOLT_API_TOKEN="your-token-here" ``` ### Technical Analysis `BOLT_BASE_URL` is accepted without parsing or validating its scheme, hostname, or trust boundary. When `BOLT_API_TOKEN` is present, the script forwards it in the `x-bolt-token` header to every constructed destination. Request bodies can additionally contain project details, story descriptions, notes, assignee identities, and agent activity. Network communication is necessary for the declared Bolt management functio ...[truncated 1544 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Parse `BOLT_BASE_URL` and require `https://` for all non-loopback destinations. 2. Permit plaintext HTTP only when the parsed host is exactly an approved loopback address such as `localhost`, `127.0.0.1`, or `[::1]`. 3. Reject malformed URLs, embedded credentials, unexpected schemes, and ambiguous host representations. 4. Add an optional explicit host allowlist for managed deployments. 5. Clearly document that `BOLT_BASE_URL` defines a trusted credential recipient and must not be derived from untrusted task content. 6. Recommend narrowly scoped, short-lived API tokens where supported. 7. Avoid exposing the token through command tracing or diagnostics, and ensure any future redirect support does not forward authentication to a different origin. 8. Replace remote plaintext examples with HTTPS examples while retaining a clearly labeled loopback-only development example. ]]>
