T09 · Insecure Skill Coding Practices
- Location
SKILL.md:23- Finding
Credential Inventory Commands May Expose Plaintext Secrets
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 23–31
Vulnerability Type: Plaintext sensitive-data disclosure
Risk Level: Highbash # Find hardcoded secrets (should be 0) rg -i "(api_key|apikey|secret_key|access_key|private_key|token)\s*[=:]\s*['\"][a-zA-Z0-9+/=_-]{16,}" \ --type-not binary -g '!node_modules' -g '!vendor' -g '!*.test.*' -g '!*.example*' 2>/dev/null # Find environment variable references for secrets rg -i "(API_KEY|SECRET|TOKEN|PASSWORD|PRIVATE_KEY|ACCESS_KEY|CLIENT_SECRET)" \ --type-not binary -g '!node_modules' -g '!vendor' 2>/dev/null | \ grep -v "test\|example\|mock\|fake\|dummy" | head -30Technical Analysis
The inventory procedure uses
rgto locate probable secrets but does not suppress or redact matching content. By default,rgprints the complete matching source line. If a configuration or source file contains a hardcoded API key, access token, password, private key, or client secret, the credential may consequently be copied into terminal output, the AI agent context, session transcripts, audit reports, or centralized execution logs.The first expression specifically seeks assignments containing secret-like values of at least 16 characters, making disclosure of actual credential material particularly likely when a match is found. The second expression is broader and may print configuration lines containing both a sensitive variable name and its value. Excluding some test and example files does not provide redaction and may also miss differently named fixtures.
This finding is limited to local disclosure: the reviewed file contains no command that explicitly transmits discovered values to an external system.
Attack Path
- A user invokes the documented
inventoryworkflow against a repository containing a plaintext credential. - The agent or operator executes one of the supplied recursive
rgcommands. rglocates a matching assignment an ...[truncated 1059 chars]
- A user invokes the documented
- Remediation
View remediation
Remediation Suggestions
- Replace content-printing searches with metadata-only output containing the file path, line number, and detected secret type. Do not include the matching line or value.
- Use a purpose-built secret scanner with verified redaction support, such as Gitleaks with redaction enabled or
detect-secrets, and validate that no raw value appears in stdout, stderr, reports, or debug logs. - Require explicit user authorization before scanning a repository and constrain every scan to the intended project root.
- Treat all discovered values as sensitive. Do not place them in prompts, reports, persistent memory, issue trackers, chat messages, or telemetry.
- Store findings using fingerprints or one-way hashes where correlation is necessary. Never record complete secrets.
- Restrict access to scan logs and configure short retention periods. Disable command tracing and other verbose logging while secret discovery is running.
- If a secret has already appeared in output, rotate or revoke it promptly, inspect access logs for misuse, and remove it from source history and retained transcripts where feasible.
- Add a documented output-safety test using synthetic credentials to ensure future versions reveal only redacted findings.
