T09 · Insecure Skill Coding Practices
- Location
generate.sh:11- Finding
Unvalidated API Base Override Can Disclose Bearer Credentials
- Content
View full analysis
Vulnerability Details
File Location:
generate.sh:11,98-101;models.sh:6-14;status.sh:7,22-23;scripts/generate-nano-banana.py:10-11,18-26,50-52,75-78
Vulnerability Type: Unvalidated service endpoint override and credential disclosure
Risk Level: MediumVulnerable Code
generate.sh:11,98-101:bash API_BASE="${PIXELDOJO_API_BASE:-https://pixeldojo.ai/api/v1}" SUBMIT_RESPONSE=$(curl -sS -X POST "${API_BASE}/models/${MODEL}/run" \ -H "Authorization: Bearer ${API_KEY}" \ -H "Content-Type: application/json" \ -d "$(build_payload)")models.sh:6-14:bash API_BASE="${PIXELDOJO_API_BASE:-https://pixeldojo.ai/api/v1}" API_KEY="${PIXELDOJO_API_KEY:-}" CURL_ARGS=(-sS "${API_BASE}/models") if [[ -n "$API_KEY" ]]; then CURL_ARGS+=( -H "Authorization: Bearer ${API_KEY}" ) fi RESPONSE=$(curl "${CURL_ARGS[@]}")status.sh:7,22-23:bash API_BASE="${PIXELDOJO_API_BASE:-https://pixeldojo.ai/api/v1}" curl -sS "${API_BASE}/jobs/${JOB_ID}" \ -H "Authorization: Bearer ${API_KEY}" | jq .scripts/generate-nano-banana.py:10-11,18-26:python API_KEY = os.environ.get("PIXELDOJO_API_KEY") API_BASE = os.environ.get("PIXELDOJO_API_BASE", "https://pixeldojo.ai/api/v1") def http_json(method, url, payload=None, timeout=60): data = None headers = {"Authorization": f"Bearer {API_KEY}"} if payload is not None: data = json.dumps(payload).encode("utf-8") headers["Content-Type"] = "application/json" request = urllib.request.Request(url, data=data, headers=headers, method=method) try: with urllib.request.urlopen(request, timeout=timeout) as response:Technical Analysis
PIXELDOJO_API_BASEis treated as a trusted destination even though it is supplied through the process environment. The code does not validate its scheme, hostname, port, or embedded user-information before att ...[truncated 1845 chars]- Remediation
View remediation
Remediation Suggestions
- Permit only
httpsAPI endpoints. - Allowlist the expected PixelDojo hostname, such as
pixeldojo.ai, and any separately documented trusted API hosts. - Reject embedded credentials, fragments, unexpected ports, malformed URLs, and hosts that resolve to loopback, private, link-local, or reserved addresses.
- Validate the destination before constructing or attaching the authorization header.
- If custom endpoints are needed for development, require an explicit opt-in flag and a separate test credential rather than silently honoring an unrestricted environment variable.
- Configure redirect handling so credentials cannot be forwarded to a different host.
- Avoid printing sensitive response bodies where API errors could contain confidential account information.
- Permit only
