T09 · Insecure Skill Coding Practices
- Location
SKILL.md:209- Finding
Raw credentials are exposed in generated scan reports
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, lines 209-225; related scanning and output logic at lines 315-383
Vulnerability Type: Plaintext sensitive-data exposure
Risk Level: HighVulnerable Code
python def scan_file(self, filepath): """Scan a file for secrets.""" findings = [] with open(filepath, 'r', encoding='utf-8', errors='ignore') as f: content = f.read() lines = content.split('\n') for line_num, line in enumerate(lines, 1): for pattern, name, severity in self.SECRET_PATTERNS: matches = re.finditer(pattern, line, re.IGNORECASE) for match in matches: { "file": filepath, "line": line_num, "type": name, "severity": severity, "evidence": match.group()[:50] }) return findingsThe scanner explicitly includes sensitive configuration files and subsequently prints its report:
python SCAN_EXTENSIONS = { ".js", ".ts", ".jsx", ".tsx", ".py", ".java", ".go", ".php", ".rb", ".json", ".yaml", ".yml", ".env" }python if args.output == "json": print(json.dumps(report, indent=2, ensure_ascii=False)) else: print(json.dumps(report, indent=2, ensure_ascii=False, default=str))Technical Analysis
The secret detector copies up to the first 50 characters of every matched credential into the
evidencefield. Many supported credential formats, including AWS access-key IDs, GitHub tokens, API keys, passwords, and JWTs, fit entirely or substantially within this limit.Because
.envfiles are included in the recursive scan set, files commonly used to store operational credentials are processed automatically. The resulting findings are incorporated into the report and printed as JSON. Conseque ...[truncated 1636 chars]- Remediation
View remediation
Remediation Suggestions
- Remove raw matches from findings. Reports should contain only the secret type, file path, line number, severity, and remediation guidance.
- If limited identification is necessary, apply irreversible or strongly redacted representations, such as a keyed fingerprint or a value showing no more than the final four characters.
- Do not use fixed-length prefix disclosure such as
match.group()[:50], because many credentials are shorter than 50 characters. - Exclude
.envand similar sensitive files by default. Require explicit authorization before scanning them. - Add a safe-output function that sanitizes every finding before serialization or console output.
- Prevent reports from being written to world-readable files and document appropriate filesystem permissions and retention policies.
- Configure CI and agent environments to suppress or redact scanner output from persistent logs.
- Add automated tests using synthetic credentials to verify that complete or reconstructable secret values never appear in JSON, summary, console, or error output.
- Advise users to rotate any real credentials that have already appeared in scanner reports or execution logs.
