T09 · Insecure Skill Coding Practices
Warning
- Location
- SKILL.md:267
- Finding
- API Token Disclosure Through Troubleshooting Command<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:267-271` **Vulnerability Type**: API credential exposure through terminal output **Risk Level**: Medium ### Vulnerable Code ```markdown **Q7. Command exits immediately without producing data?** > Troubleshooting: In most cases, `GUAIKEI_API_TOKEN` did not pass validation (see Q1). Before running, execute `echo $GUAIKEI_API_TOKEN` to confirm that the variable has been injected. ``` The original command in the Skill documentation is: ```bash echo $GUAIKEI_API_TOKEN ``` ### Technical Analysis The troubleshooting procedure instructs users or an AI agent to print the complete `GUAIKEI_API_TOKEN` value to standard output. Environment variables commonly contain API credentials and should be treated as secrets. Although the project code transmits this token only to the fixed HTTPS endpoint `www.guaikei.com`, the documented diagnostic command creates an unnecessary secondary disclosure channel. The resulting plaintext token may be retained in: - Agent tool-call output and conversation records - CI/CD job logs - Terminal recording or shell-session capture systems - Remote support sessions and screen sharing - Command output copied into issue reports or support messages Checking whether an environment variable exists does not require revealing its value. Therefore, this instruction exceeds the minimum access and disclosure necessary for troubleshooting. ### Attack Path 1. A user encounters a token-validation or startup error. 2. The user or executing agent follows the FAQ in `SKILL.md`. 3. The command `echo $GUAIKEI_API_TOKEN` writes the complete credential to stdout. 4. A terminal logger, CI system, agent transcript, screen observer, or support artifact captures the output. 5. An unauthorized party obtains the captured token. 6. The party reuses the token to submit requests to the Guaikei API within the permissions and quotas assigned to that credential. This finding does not provide local sys ...[truncated 931 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the secret-printing command with a presence-only check: ```bash if [ -n "${GUAIKEI_API_TOKEN:-}" ]; then echo "GUAIKEI_API_TOKEN is configured" else echo "GUAIKEI_API_TOKEN is missing" fi ``` 2. If format diagnostics are required, validate the token without displaying it: ```bash case "${GUAIKEI_API_TOKEN:-}" in "") echo "GUAIKEI_API_TOKEN is missing" ;; *[!0-9A-Za-z_-]*) echo "GUAIKEI_API_TOKEN contains unsupported characters" ;; *) echo "GUAIKEI_API_TOKEN is present and has an accepted character format" ;; esac ``` 3. Do not include full tokens in terminal output, structured JSON, log files, issue reports, screenshots, or support communications. 4. Add an explicit warning to the documentation that API credentials must be redacted before sharing diagnostic output. 5. If a token has already been printed into a retained or shared log, revoke and rotate it through the service provider, then remove the exposed value from logs where feasible. 6. Consider server-side protections such as short token lifetimes, scoped permissions, quotas, anomaly detection, and rapid revocation. ]]>
