T09 · Insecure Skill Coding Practices
- Location
SKILL.md:88- Finding
Partial API Credential Disclosure Through Console Logging
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 88–102 and 240–241
Vulnerability Type: Partial secret exposure through terminal and agent logs
Risk Level: MediumVulnerable Code
bash # 1. Check current env var if [ -n "$MESHY_API_KEY" ]; then echo "ENV_VAR: FOUND (${MESHY_API_KEY:0:8}...)" else echo "ENV_VAR: NOT_FOUND" fi # 2. Check .env in current working directory only if [ -f ".env" ] && grep -q "MESHY_API_KEY" ".env" 2>/dev/null; then echo "DOTENV(.env): FOUND" export MESHY_API_KEY=$(grep "^MESHY_API_KEY=" ".env" | head -1 | cut -d'=' -f2- | tr -d '"'"'" ) fi # 3. Final status if [ -n "$MESHY_API_KEY" ]; then echo "READY: key=${MESHY_API_KEY:0:8}..." else echo "READY: NO_KEY_FOUND" fiThe reusable Python template also exposes the same token prefix:
python # Never log the full key — only first 8 chars for traceability print(f"API key loaded: {API_KEY[:8]}...")Technical Analysis
The Skill intentionally prints the first eight characters of
MESHY_API_KEYafter reading it from either the process environment or the current directory's.envfile. This contradicts the security manifest's assertion that the credential is never logged.Terminal output generated by an agent may be retained in conversation transcripts, CI logs, shell histories, observability systems, or debugging records. Although the full bearer token is not exposed, revealing a stable prefix unnecessarily discloses credential material and allows an observer to identify or correlate a particular token across systems and sessions.
The disclosure is not necessary to verify that the key was loaded. A boolean result provides the same operational value without exposing any part of the secret.
Attack Path
- A user or automation environment supplies
MESHY_API_KEYthrough the environment or.env. - The Skill executes its mandatory API-key detection ...[truncated 1190 chars]
- A user or automation environment supplies
- Remediation
View remediation
Remediation Suggestions
-
Never print any substring of an API key, including prefixes intended for traceability.
-
Replace both shell messages with non-sensitive status output:
bash if [ -n "$MESHY_API_KEY" ]; then echo "ENV_VAR: FOUND" else echo "ENV_VAR: NOT_FOUND" fi if [ -n "$MESHY_API_KEY" ]; then echo "READY: API_KEY_LOADED" else echo "READY: NO_KEY_FOUND" fi -
Replace the Python log statement with:
python print("API key loaded") -
Ensure exception messages, HTTP debugging, and request tracing do not serialize the
Authorizationheader. -
Add automated secret-redaction tests that fail if output contains any portion of a configured test token.
-
Update the security manifest only after all token-prefix logging has been removed.
-
