Back to skill

Security audit

Code Health Scanner

Security checks for vulnerabilities and agentic risk

Overview

This is a local Spring Boot code scanner, but its report format can persist unredacted secrets found in source code into project report files.

Use this only on projects you are authorized to inspect. Before committing, sharing, or archiving generated reports, review them for passwords, tokens, keys, connection strings, and local paths; add the report directory to .gitignore or store reports outside the source tree. Treat any real credential reproduced in a report as exposed and rotate it.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
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, and references/report-template.md:158-175
Vulnerability Type: Sensitive data exposure through unredacted report generation
Risk Level: Medium

Vulnerable Code Snippets

SKILL.md:67-70 requires every reported issue to contain a source-code excerpt:

markdown
输出结构化 Markdown 报告,包含:
- 总体健康评分 (0-100)
- 按严重度分组的 Issues
- 每个 Issue 包含:文件位置、代码片段、风险说明、修复建议

SKILL.md:92-95 explicitly directs the scanner to detect plaintext secrets:

markdown
#### Security
- **SQL Injection**: 字符串拼接构建 SQL → 使用 `#{param}` 替代 `${param}`
- **Hardcoded Secrets**: 代码/配置中明文密钥 → 环境变量或配置中心
- **Insecure Deserialization**: 不可信数据反序列化 → 白名单校验

SKILL.md:268-273 persists generated reports inside the scanned project:

markdown
## Workspace

扫描报告默认输出到 `{项目路径}/code-health-reports/`,命名格式:

code-health-report-{YYYY-MM-DD_HHmm}.md

text

PRIVACY.md:13-16 confirms 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-175 demonstrates 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

  1. 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
  1. 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.
  2. 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.
  3. Reduce persistence risk

    • Add code-health-reports/ and any alternative report path to .gitignore by default.
    • Store reports outside the source tree where practical.
    • Apply restrictive file permissions to generated reports.
    • Document a retention and secure-deletion policy.
  4. 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.
  5. 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.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (9)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 62)May include surrounding context.

md
按 4 大类逐文件扫描。详细规则见 [references/rules/java-spring.md](references/rules/java-spring.md)。

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

Scanner excerpt · SKILL.md (reported line 281)May include surrounding context.

md
按 4 大类逐文件扫描。详细规则见 [references/rules/java-spring.md](references/rules/java-spring.md)。

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/rules/java-spring.md (reported line 22)May include surrounding context.

User findByName(@Param("name") String name);

text
```xml
<!-- ❌ 危险:XML 中的 ${} 拼接 -->
<select id="findByName" resultType="User">
    SELECT * FROM user WHERE name LIKE '%${name}%'
</select>

Hidden Instructions

High
Category
Prompt Injection
Confidence
70% confidence
Finding

Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Content

Scanner excerpt · references/rules/java-spring.md (reported line 22)May include surrounding context.

User findByName(@Param("name") String name);

text
```xml
<!-- ❌ 危险:XML 中的 ${} 拼接 -->
<select id="findByName" resultType="User">
    SELECT * FROM user WHERE name LIKE '%${name}%'
</select>

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The title and core one-line description are presented in Chinese, and much of the operational guidance throughout the file is written as Chinese instructions without any stated user opt-in or language-selection mechanism. This creates a locale/language policy concern because the skill implicitly assumes a specific language rather than explicitly letting the user choose.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

This markdown template is written almost entirely in Chinese, including metadata labels, score explanations, issue descriptions, recommendations, and rendering guidance, which signals a fixed output locale for generated reports. The file does not indicate that language is configurable or limited to a China-specific context, so it appears to impose a specific language without user opt-in.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
96% confidence
Finding

The template embeds a developer/workstation-specific absolute Windows path for warning report output. In a privacy-first scanner, exposing local filesystem structure and user environment details is unnecessary and can leak sensitive host information into generated artifacts, especially if reports are shared externally or committed to repositories.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The appendix includes additional absolute local paths to full and incremental reports, again disclosing developer environment details unrelated to the report's diagnostic purpose. This increases privacy leakage risk and may reveal filesystem conventions, usernames, drive mappings, or internal workspace organization to anyone receiving the report.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
78% confidence
Finding

该 markdown 文档标题与全文内容均固定为中文表述,未说明这是仅面向中文使用者的区域性规则库,也没有提供语言选择。根据语言/locale 政策,若技能或规则说明默认强制单一语言而未取得用户选择,可能构成自然语言层面的政策问题。

Content

No source excerpt is available for this finding.