T09 · Insecure Skill Coding Practices
- Location
SKILL.md:67- Finding
Plaintext Secrets May Be Copied into Persistent Scan Reports
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:67-70,SKILL.md:92-95,SKILL.md:268-273,PRIVACY.md:13-16, andreferences/report-template.md:158-175
Vulnerability Type: Sensitive data exposure through unredacted report generation
Risk Level: MediumVulnerable Code Snippets
SKILL.md:67-70requires every reported issue to contain a source-code excerpt:markdown 输出结构化 Markdown 报告,包含: - 总体健康评分 (0-100) - 按严重度分组的 Issues - 每个 Issue 包含:文件位置、代码片段、风险说明、修复建议SKILL.md:92-95explicitly directs the scanner to detect plaintext secrets:markdown #### Security - **SQL Injection**: 字符串拼接构建 SQL → 使用 `#{param}` 替代 `${param}` - **Hardcoded Secrets**: 代码/配置中明文密钥 → 环境变量或配置中心 - **Insecure Deserialization**: 不可信数据反序列化 → 白名单校验SKILL.md:268-273persists generated reports inside the scanned project:markdown ## Workspace 扫描报告默认输出到 `{项目路径}/code-health-reports/`,命名格式:code-health-report-{YYYY-MM-DD_HHmm}.md
text PRIVACY.md:13-16confirms that the report remains stored until manually deleted:markdown | Data Category | What | Where | Stored For | |---------------|------|-------|------------| | Code analysis | Reads project source files | Your project directory | Duration of scan only | | Health report | Structured report with findings | `{project}/health-report.md` | Until you delete |references/report-template.md:158-175demonstrates reproducing a complete password value in a report:markdown ### CRIT-003: 硬编码密码 — `application-dev.properties:25` ```properties # ❌ 危险:明文密码硬编码 spring.datasource.password=admin123- 文件:
src/main/resources/application-dev.properties - 行号: 25
- 规则:
security/hardcoded-secret(严重度: critical)
✅ 修复建议:
properties # ✅ 安全:使用环境变量或密钥管理服务 spring.datasource.password=${DB_PASSWORD}text ### Technical Analysis The Skill combines three behaviors that create a sensitive-data handling flaw: 1. It searches source and configuration files for plaintext passwords, ...[truncated 2539 chars]- 文件:
- Remediation
View remediation
Remediation Suggestions
- Mandate deterministic redaction
- Never reproduce complete passwords, tokens, API keys, private keys, authorization headers, or credential-bearing URLs.
- Show only the configuration key and a masked value, for example:
properties spring.datasource.password=ad***23-
Report metadata instead of secret content
- Include the file path, line number, secret type, and configuration key.
- Replace the raw value with a fixed marker such as
[REDACTED]. - Avoid retaining secret length or recognizable prefixes unless required for safe identification.
-
Add explicit report-generation safeguards
- Require a final sanitization pass before writing a report.
- Detect common credential formats in all report fields, including snippets, logs, summaries, and suggested patches.
- Abort report creation or request confirmation if sanitization cannot be guaranteed.
-
Reduce persistence risk
- Add
code-health-reports/and any alternative report path to.gitignoreby default. - Store reports outside the source tree where practical.
- Apply restrictive file permissions to generated reports.
- Document a retention and secure-deletion policy.
- Add
-
Handle discovered credentials as compromised
- Advise users to rotate live credentials found in source code.
- Recommend reviewing Git history, CI logs, existing reports, backups, and shared artifacts for earlier copies.
- Remove sensitive values from repository history where organizational policy permits.
-
Correct the template
- Replace the complete password example with an explicitly synthetic and redacted value.
- Add a prominent rule stating that examples must never cause real secret values to appear in generated reports.
- Mandate deterministic redaction
