Back to skill

Security audit

Git助手专业版

Security checks for vulnerabilities and agentic risk

Overview

This Git helper is mostly purpose-aligned, but it teaches an agent to automatically run repository-changing recovery steps, including hard resets labeled as safe.

Review before installing. Use this only in repositories where you are comfortable with an agent editing files and running Git commands. Do not allow automatic recovery or hard reset steps without first creating a backup branch or stash, reviewing the exact commands, and confirming the intended repository path.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (11)

Intent-Code Divergence

High
Confidence
96% confidence
Finding
`auto_recover()` executes predefined recovery steps automatically, and those steps can include destructive commands such as `git reset --hard`. Marking scenarios as `safe` creates a misleading trust boundary and can cause irreversible loss of uncommitted work or force repository state changes without explicit user review. In a tool meant to operate on user repositories, automatic execution makes the danger more acute.

Vague Triggers

Medium
Confidence
76% confidence
Finding
The trigger condition is broad enough to activate on generic productivity or automation requests, increasing the chance that the skill is invoked outside the user's intended Git-specific scope. In an agent environment with exec/write permissions, over-broad routing can cause unnecessary repository inspection or modification in contexts where the user did not clearly consent.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The documented auto-resolve flow rewrites conflicted files in place when it decides content is auto-resolvable, but the surrounding skill text does not prominently warn the user that repository contents will be modified. In an agent with write and exec tools, silent or weakly disclosed file mutation can lead to unintended code changes, data loss, or unsafe merges being committed.

Missing User Warnings

Medium
Confidence
90% confidence
Finding
The automatic recovery capability is described as detecting and recovering from Git issues, but it does not clearly warn that recovery actions may alter working tree state, reset history, or discard uncommitted changes. In this skill's context, that omission is dangerous because the tool advertises automated remediation and has execution capability, which can normalize destructive actions without informed consent.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The recovery scenarios present commands like `git reset --hard` as `safe` without prominent warnings about irreversible data loss. Users or downstream agents may treat these steps as harmless and execute them inappropriately, causing loss of local changes or repository corruption from an operational perspective.

Missing User Warnings

Medium
Confidence
97% confidence
Finding
The function automatically runs recovery commands in the user's repository without an upfront warning that repository state will be modified. Because the same mechanism can execute destructive steps, the absence of an interactive warning and confirmation materially increases the risk of unintended data loss.

Unvalidated Output Injection

High
Category
Output Handling
Content
@staticmethod
    def batch_auto_resolve(cwd=None):
        """批量自动解决冲突"""
        result = subprocess.run(
            ["git", "diff", "--name-only", "--diff-filter=U"],
            capture_output=True, text=True, cwd=cwd
        )
Confidence
84% confidence
Finding
The code collects file paths from `git diff --name-only` and then passes each path into file-opening and file-writing logic without validating that the paths remain within the intended repository root. A malicious repository can contain unusual path structures or symlink-based setups that cause the agent to read or overwrite unintended files when auto-resolution runs.

Unvalidated Output Injection

High
Category
Output Handling
Content
continue

            cmd = step.split()
            result = subprocess.run(cmd, capture_output=True, text=True, cwd=cwd)
            results.append({
                "step": step,
                "status": "success" if result.returncode == 0 else "failed",
Confidence
72% confidence
Finding
Although not a classic output-injection case, this location is genuinely dangerous because `auto_recover()` converts plan strings into commands and executes them against the repository. The risk is amplified by using loosely parsed strings (`step.split()`) and by trusting scenario metadata labeled as `safe`, enabling state-changing and destructive git operations to run automatically.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
"safe": True
        },
        "accidental_reset": {
            "description": "误执行了git reset --hard",
            "steps": [
                "git reflog                 # 查找reset前的提交",
                "git reset --hard <sha>     # 恢复到该提交"
Confidence
93% confidence
Finding
The skill recommends `git reset --hard` in a recovery scenario and labels the scenario as safe, despite the command irreversibly discarding working tree and index changes. In the context of an automation-oriented Git helper, this is especially dangerous because users may rely on the tool's safety labeling instead of understanding the destructive semantics.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
"description": "误执行了git reset --hard",
            "steps": [
                "git reflog                 # 查找reset前的提交",
                "git reset --hard <sha>     # 恢复到该提交"
            ],
            "safe": True
        },
Confidence
93% confidence
Finding
This instance continues the same recovery flow by marking a `git reset --hard <sha>` restoration path as safe. Even when used for recovery, forcing a hard reset can discard current work and move repository state unexpectedly, making misuse costly and difficult to undo.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
"description": "合并冲突中无法继续",
            "steps": [
                "git merge --abort          # 取消合并",
                "git reset --hard HEAD       # 重置到合并前状态"
            ],
            "safe": True
        },
Confidence
95% confidence
Finding
The merge-conflict recovery plan includes `git reset --hard HEAD` and still labels the scenario as safe. During conflict resolution this can silently discard local edits made while attempting a merge, causing direct data loss in exactly the workflow where users are already at risk of mistakes.

Static analysis

No suspicious patterns detected.