T09 · Insecure Skill Coding Practices
- Location
SKILL.md:31- Finding
API Key Exposure Through Secret Printing and Unvalidated Authentication Endpoint
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 31-46
Vulnerability Type: Sensitive credential exposure and unsafe endpoint configuration
Risk Level: MediumVulnerable Code
markdown 1. `echo $YINO_API_KEY` — must be set. Get one at https://yino.ai/settings (API Keys section). 2. `echo ${YINO_API_BASE_URL:-https://yino.ai}` — defaults to production. Set `YINO_API_BASE_URL=http://localhost:3000` for local dev. If either fails, stop and tell the user. ## Auth Every request needs: `Authorization: Bearer $YINO_API_KEY` ## Step 1: Discover Capabilities **Always start here.** Don't assume model names or parameters — discover them: ```bash curl "${YINO_API_BASE_URL:-https://yino.ai}/api/agent/capabilities" \ -H "Authorization: Bearer $YINO_API_KEY"text ### Technical Analysis The preflight procedure prints `YINO_API_KEY` directly. This unnecessarily exposes the credential in shell output, agent tool results, execution transcripts, terminal scrollback, and any logs that capture command output. Verifying that a secret exists does not require disclosing its value. Authenticated requests also derive their destination directly from the environment-controlled `YINO_API_BASE_URL`. The instructions do not validate the URL scheme, hostname, port, or resolved destination before attaching the bearer credential. Consequently, a modified environment can redirect the mandatory capability-discovery request to an attacker-controlled server. The documented local-development configuration permits plaintext HTTP. Although loopback HTTP may be acceptable in a controlled development environment, the Skill does not enforce a loopback destination. A value using `http://` with a non-loopback host could transmit the bearer token without transport encryption. Network access and bearer authentication are necessary for the declared hosted media-generation functionality. Printing the secret and allowing unres ...[truncated 1627 chars]- Remediation
View remediation
Remediation Suggestions
-
Do not print the API key. Check only whether it is present:
bash if [ -z "${YINO_API_KEY:-}" ]; then echo "YINO_API_KEY is not configured" >&2 exit 1 fi -
Restrict authenticated production requests to an approved HTTPS origin. Default to
https://yino.aiand reject unexpected schemes, hosts, embedded credentials, fragments, and ports before adding the authorization header. -
Separate local development from production behavior. Require an explicit development-mode opt-in. If plaintext HTTP is necessary, permit it only for validated loopback destinations such as
localhost,127.0.0.1, or[::1]. -
Prevent cross-origin credential forwarding. Disable redirects for authenticated requests or verify that every redirect remains on the approved origin before resending credentials.
-
Redact sensitive values. Ensure command tracing, verbose HTTP output, errors, transcripts, and logs never include bearer tokens or authorization headers.
-
Confirm the upload destination. Before uploading user images or audio, display the validated destination host and obtain user confirmation when the content may be private or sensitive.
-
Rotate exposed credentials. Any key previously printed to retained logs or sent to an untrusted endpoint should be revoked and replaced.
-
