T09 · Insecure Skill Coding Practices
- Location
examples.md:56- Finding
Bearer Credential May Be Transmitted to an Unvalidated Environment-Controlled Endpoint
- Content
View full analysis
Vulnerability Details
File Location:
examples.md:19-27, 56-72
Vulnerability Type: Unvalidated destination for bearer-token transmission
Risk Level: HighThe documented CI script verifies only that
CLAWDEALS_API_BASEandCLAWDEALS_API_KEYare non-empty:bash if [ -z "${CLAWDEALS_API_BASE:-}" ]; then echo "Missing CLAWDEALS_API_BASE" exit 1 fi if [ -z "${CLAWDEALS_API_KEY:-}" ]; then echo "Missing CLAWDEALS_API_KEY" exit 1 fiIt subsequently attaches the bearer credential to requests sent to URLs derived from the environment-controlled base URL:
bash curl_json() { local method="$1" local url="$2" local json_body="${3:-}" local expected_csv="$4" local idempotency_key="${5:-}" local headers=(-H "Authorization: Bearer $CLAWDEALS_API_KEY" -H "Content-Type: application/json") if [ -n "$idempotency_key" ]; then headers+=(-H "Idempotency-Key: $idempotency_key") fi local out if [ -n "$json_body" ]; then out="$(curl -sS -X "$method" "$url" "${headers[@]}" -d "$json_body" -w "\n__HTTP_STATUS:%{http_code}\n")" else out="$(curl -sS -X "$method" "$url" "${headers[@]}" -w "\n__HTTP_STATUS:%{http_code}\n")" fiTechnical Analysis
CLAWDEALS_API_BASEis trusted without validation of its URL scheme, hostname, port, or canonical path. Every request made throughcurl_jsonincludesAuthorization: Bearer $CLAWDEALS_API_KEY.Although
SKILL.mddeclares a runtime network allowlist and identifieshttps://app.clawdeals.com/apias the canonical production endpoint, that metadata does not protect the shell block when copied into an ordinary CI environment. A compromised workflow variable, repository environment, CI secret configuration, or operator shell can redirect requests to an attacker-controlled server.The absence of redirect restrictions also increases exposure if an allowed endpoint returns an HTTP redirect an ...[truncated 1405 chars]
- Remediation
View remediation
Remediation Suggestions
-
Validate
CLAWDEALS_API_BASEbefore making any authenticated request:- Require HTTPS.
- Require an exact approved hostname.
- Reject embedded credentials, fragments, unexpected ports, and malformed paths.
- Permit localhost only behind an explicit development flag.
-
Hard-code the production API origin where practical instead of accepting an arbitrary environment-controlled URL.
-
Use a separate, short-lived, minimally scoped smoke-test credential that cannot access production resources.
-
Add a preflight assertion similar to:
bash case "$CLAWDEALS_API_BASE" in "https://app.clawdeals.com/api") ;; *) echo "Refusing unapproved CLAWDEALS_API_BASE" >&2 exit 1 ;; esac -
Explicitly disable redirects for authenticated requests or validate every redirect destination before forwarding credentials.
-
Protect CI environment variables from untrusted pull requests and restrict who can modify workflow, environment, and secret configuration.
-
Document immediate credential revocation and rotation procedures for suspected endpoint misconfiguration.
-
