Back to skill

Security audit

代码一键提交

Security checks for vulnerabilities and agentic risk

Overview

This Git commit helper is transparent about its goal, but it can automatically stage all repository changes and commit them without confirmation.

Install only if you are comfortable with an agent making local Git commits automatically. Before using it, stage files yourself, run `git status`, and avoid invoking it in repositories that may contain untracked secrets or unrelated work. Prefer a version that asks for confirmation after showing the exact staged files and proposed commit message.

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:32
Finding
Automatic Broad Staging and Commit Without User Confirmation## Vulnerability Details **File Location**: `SKILL.md:32-47`; supporting implementation guidance in `references/safety-errors.md:19-24` and `references/workflow-examples.md:14-18` **Vulnerability Type**: Unrestricted staging of repository contents followed by an unconfirmed commit **Risk Level**: Medium ### Vulnerable Code `SKILL.md:32-34`: ```markdown 2. **暂存区为空**(`git diff --cached --stat` 无输出) - 先执行 `git add .` 添加所有变更 - 再分析变更内容,生成 commit message 并提交 ``` `SKILL.md:42-47`: ```markdown 所有操作都会: 1. 确认工作目录是 Git 仓库(非 Git 目录直接报错退出) 2. 检查暂存区状态(有内容→直接提交;无内容→先 git add .) 3. 分析代码变更 4. 生成符合规范的 commit message 5. 直接执行 `git commit -m "<message>"`(不需要用户确认) ``` `references/safety-errors.md:19-24`: ```bash # 3. 检查暂存区状态 if [ -z "$(git diff --cached --name-only)" ]; then echo "i️ 暂存区为空,自动执行 git add ." git add . fi ``` ### Technical Analysis When the staging area is empty, the Skill instructs the agent to execute `git add .`. This broadly stages all tracked modifications and all non-ignored, untracked files beneath the current repository path. The Skill then executes `git commit` without requesting user confirmation. This violates least-change principles for source-control automation. A request to commit intended code changes does not necessarily authorize the inclusion of every file in the working tree. The project mentions checking for sensitive information in `references/best-practices.md`, but it defines no concrete secret-detection procedure, sensitive-path denylist, staged-file review, or blocking control before the commit. An attacker does not need command execution to exploit this behavior. It is sufficient to place a sensitive or unrelated non-ignored file inside a repository and induce a user to invoke the Skill while the staging area is empty. The file can then become part of permanent Git history. ### Attack Path 1. A repository contains an untracked or modified file that th ...[truncated 1530 chars]
Remediation
## Remediation Suggestions 1. Do not run `git add .` automatically. Preserve existing user staging decisions whenever possible. 2. If the staging area is empty, display `git status --short` and require the user to select or approve the exact paths to stage. 3. Prefer explicit commands such as `git add -- path/to/file` for approved files. If only modifications to already tracked files should be included, consider `git add -u` after clearly explaining its scope. 4. Before committing, display the final output of `git diff --cached --name-status` and require explicit confirmation. 5. Add blocking checks for common sensitive files and patterns, including environment files, private keys, credential exports, tokens, database dumps, and local configuration files. 6. Integrate a recognized secret scanner where available, while treating scanner success as an additional safeguard rather than a replacement for user review. 7. Abort when no files are approved, when unresolved conflicts exist, or when secret detection reports a possible credential. 8. Avoid committing automatically. Present the proposed commit message and staged-file summary, then execute `git commit` only after informed user approval.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (26)

Missing User Warnings

High
Confidence
99% confidence
Finding
The skill explicitly states that if the staging area is empty it will run `git add .`, then generate a message and execute `git commit -m ...` without user confirmation. This is dangerous because it can stage and permanently record unrelated, sensitive, or accidental changes, especially when defaulting to the current working directory and acting automatically.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
git log --oneline -5                # 查看最近5次提交

# === 推送相关 ===
git push origin main                # 推送到远程
git push origin main --force        # 强制推送(慎用)

# === 撤销相关 ===
Confidence
88% confidence
Finding
The command reference includes `git push origin main` and `git push origin main --force`, extending the skill beyond local commit assistance into remote state modification. In a commit-helper context, especially with a force-push example, this can normalize or enable dangerous repository-wide changes if the agent later suggests or performs these commands.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
# === 撤销相关 ===
git reset --soft HEAD~1             # 撤销提交,保留修改
git reset --hard HEAD~1             # 撤销提交,丢弃修改
git commit --amend -m "new message" # 修改最后一次提交

# === 查看相关 ===
Confidence
94% confidence
Finding
`git reset --hard HEAD~1` is a destructive command that discards uncommitted changes and rewrites local history. Including it in a commit-helper reference materially increases risk because the skill context is adjacent to automated Git operations, making misuse or unsafe recommendation more likely.

Vague Triggers

Medium
Confidence
95% confidence
Finding
The trigger phrases are broad enough to activate on common requests like 'git 提交' or '自动提交', increasing the chance the skill runs in situations where the user did not intend fully automated staging and committing. In this skill's context, broad activation is more dangerous because the skill performs write operations to a repository and may commit unintended changes without an explicit, scoped confirmation step.

Natural-Language Policy Violations

Medium
Confidence
98% confidence
Finding
The commit format rules require the description to be in English (“英文、动词开头、小写”), which imposes a language policy on users. The file does not indicate this is optional, user-selected, or justified by a documented repository policy.

Description-Behavior Mismatch

Medium
Confidence
92% confidence
Finding
The document states that when the staging area is empty, the workflow will run `git add .` before committing. For a skill whose purpose is to generate commit messages, automatically expanding scope to stage all working-tree changes can unintentionally include secrets, unrelated files, or partial work, causing integrity and confidentiality issues.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The markdown explicitly documents auto-staging all changes with `git add .` when nothing is staged, but does not provide a prominent warning about the risk of capturing unintended files. In agentic contexts, users may trust the skill to perform a narrow action, so this behavior can silently broaden the commit to include sensitive or unrelated data.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The guidance requires descriptions to '使用英文' and later says '不要使用中文' / '描述必须是英文'. This is a natural-language policy constraint that forces a specific language without indicating user opt-in or a documented, justified business or compliance reason.

Natural-Language Policy Violations

Medium
Confidence
98% confidence
Finding
The 'DON'T' section states not to use Chinese and that descriptions must be English. This is a direct locale/language restriction in natural language and qualifies as a policy violation because it does not offer a choice or explain a necessary, narrow justification.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The document includes `git reset --hard HEAD~1`, which irreversibly discards local modifications, without an explicit warning in the command reference section about data loss. Even as documentation, surfacing destructive commands in an agent skill increases the chance they are copied, suggested, or automated without adequate safeguards.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
The document says the skill generates a Git commit, but the described behavior also mutates repository state by automatically running `git add .` and then proceeding to commit. This can cause unintended files, secrets, or unrelated work-in-progress to be staged and included without explicit user approval, which is a meaningful safety issue for a commit helper.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
Documenting automatic execution of `git add .` without a prominent warning or consent step normalizes a dangerous default in a source-control workflow. In the context of a commit helper, this is especially risky because users may expect message generation only, while the skill silently expands the commit to all local changes.

Description-Behavior Mismatch

Medium
Confidence
96% confidence
Finding
The skill is presented as helping analyze changes and generate a commit message, but the documented workflow performs modifying actions by auto-staging and then committing. This creates a mismatch between expected read/assist behavior and actual write behavior, increasing the chance of unintended repository changes without explicit user confirmation.

Context-Inappropriate Capability

Medium
Confidence
98% confidence
Finding
Automatically running `git add .` can sweep in unrelated, sensitive, or accidental files such as secrets, build artifacts, and local configs. Because this action exceeds the narrow purpose of analyzing changes and generating a commit message, it meaningfully raises the risk of unintended data inclusion and history pollution.

Missing User Warnings

Medium
Confidence
99% confidence
Finding
The documentation explicitly instructs staging all changes with `git add .` and gives no warning that this may include every modified or untracked file in the working tree. In a commit-helper context, that makes accidental inclusion of secrets or unrelated work especially plausible.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The instruction '使用英文' requires commit descriptions to be in English. This is a natural-language policy concern because it forces a specific language without user opt-in or an explicitly documented business/compliance justification.

Skill Enumeration

Medium
Category
Agent Snooping
Content
git status:
  new file:   skills/k8s-troubleshoot/README.md
  new file:   skills/k8s-troubleshoot/SKILL.md
```

**分析**:
Confidence
80% confidence
Finding
Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Skill Enumeration

Medium
Category
Agent Snooping
Content
git status:
  new file:   skills/k8s-troubleshoot/README.md
  new file:   skills/k8s-troubleshoot/SKILL.md
```

**分析**:
Confidence
80% confidence
Finding
Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Skill Enumeration

Medium
Category
Agent Snooping
Content
git status:
  new file:   skills/k8s-troubleshoot/README.md
  new file:   skills/k8s-troubleshoot/SKILL.md
```

**分析**:
Confidence
80% confidence
Finding
Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Skill Enumeration

Medium
Category
Agent Snooping
Content
git status:
  new file:   skills/k8s-troubleshoot/README.md
  new file:   skills/k8s-troubleshoot/SKILL.md
```

**分析**:
Confidence
80% confidence
Finding
Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Skill Enumeration

Medium
Category
Agent Snooping
Content
git status:
  new file:   skills/k8s-troubleshoot/README.md
  new file:   skills/k8s-troubleshoot/SKILL.md
```

**分析**:
Confidence
80% confidence
Finding
Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Skill Enumeration

Medium
Category
Agent Snooping
Content
git status:
  new file:   skills/k8s-troubleshoot/README.md
  new file:   skills/k8s-troubleshoot/SKILL.md
```

**分析**:
Confidence
80% confidence
Finding
Skill enumerates or reads other installed skills. Access to other skills' SKILL.md files or the skills directory reveals prompt instructions, capabilities, and secrets that should be invisible to peer skills.

Natural-Language Policy Violations

Low
Confidence
93% confidence
Finding
Line L012 states that the commit description must be in English, which is a language policy constraint expressed in natural language. The file does not provide an opt-in choice or a documented justification for enforcing English, so this appears to violate the language/locale policy criteria.

Natural-Language Policy Violations

Low
Confidence
83% confidence
Finding
The natural-language content forces a specific language for instructions and warnings, which can violate language/locale policy when no user opt-in or justification is provided. Nothing in the file indicates that the skill is intentionally region-specific or that users can choose another language.

Intent-Code Divergence

Low
Confidence
92% confidence
Finding
The 'empty staging area' handling is framed like harmless recovery, but it actually broadens the commit scope by staging all modified files. That mismatch can mislead users into thinking the tool is only fixing a minor precondition when it is in fact changing what will be committed.

Static analysis

No suspicious patterns detected.