Back to skill

Security audit

git-commit-ai

Security checks for vulnerabilities and agentic risk

Overview

This skill is a plausible AI commit-message helper, but it feeds raw staged diffs into the agent prompt and can leave secrets exposed while also offering an optional persistent Git hook.

Install only if you are comfortable with staged code diffs being processed by the AI agent. Review staged changes for secrets before running it, and avoid --install --force unless you have checked and backed up any existing prepare-commit-msg hook.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (2)

T01 · Skill Instruction Hijacking

Error
Location
index.js:456
Finding

Untrusted Git Diff Content Can Inject Instructions into the AI Prompt

Content
View full analysis
0) { output = `⚠️ 警告:\n${warnings.map(w => ` - ${w}`).join('\n')}\n\n---\n\n`; } output += `请根据以下 Git diff 生成 commit message: --- ## Git Diff 内容: \`\`\`diff ${diff} \`\`\` --- ## 分析要求: ${systemPrompt} --- 请生成符合规范的 commit message,只输出 message 本身,不要其他解释。`; return output; ``` ### Technical Analysis The skill inserts the complete staged Git diff into an AI prompt without treating it as untrusted input. A Git diff may contain attacker-controlled text from source files, comments, documentation, test fixtures, filenames, or configuration files. Markdown code fences do not create a security boundary for a language model. An attacker can stage text that instructs the model to ignore the commit-message task, disclose available context, generate unrelated content, or attempt to invoke tools. The generated prompt does not explicitly prohibit following instructions found inside the diff, and it does not use a structured or isolated data channel. The effective severity depends on the host agent. If the receiving model only returns text and has no tool access, the likely consequence is manipulation of the generated commit message. If the host processes the returned prompt in a tool-enabled agent context, the injection could attempt broader actions subject to that host's permissions and safety controls. ### Attack Path 1. An attacker contributes a tracked file containing instructions directed at an AI agent. 2. A user reviews or receives the repository changes and stages the malicious file with `git add`. 3. The skill executes `git diff --cached` and reads the attacker-controlled instructions. 4. The skill interpolates the diff verbatim into th ...[truncated 802 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
index.js:461
Finding

Detected Secrets Remain Exposed in the AI Prompt

Content
View full analysis
0) { output = `⚠️ 警告:\n${warnings.map(w => ` - ${w}`).join('\n')}\n\n---\n\n`; } output += `请根据以下 Git diff 生成 commit message: --- ## Git Diff 内容: \`\`\`diff ${diff} \`\`\` ``` ### Technical Analysis The skill scans the staged diff for passwords, API keys, tokens, private keys, and database connection strings. Detection only adds a warning; it neither blocks processing nor redacts the matched value. The original `${diff}` is subsequently inserted into the AI prompt in plaintext. Consequently, a secret that the skill successfully detects is still exposed to the model-processing environment. Depending on the host architecture, the prompt may also be retained in conversation history, telemetry, diagnostic logs, or downstream model-provider records. The detector additionally stops after the first matching secret category. This limits warning completeness when a diff contains multiple kinds of credentials, although the principal vulnerability is that none of the detected values are removed. No direct network request or hard-coded exfiltration endpoint was found in the package. The finding concerns unsafe handling and disclosure of staged sensitive data to the host AI processing path. ### Attack Path 1. A user accidentally stages a file or code change containing a credential. 2. `getStagedDiff()` reads the credential through `git diff --cached`. 3. A sensitive-data regular expression matches the credential. 4. The skill adds a warning but retains the original diff unchan ...[truncated 1022 chars]
Remediation
View remediation
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (8)

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · README.md (reported line 186)May include surrounding context.

卸载 Hook

bash
rm .git/hooks/prepare-commit-msg

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The README explicitly promotes installing a Git hook and mentions a force-overwrite option, but it does not clearly warn that this modifies executable repository hook files and may replace an existing local workflow or security control. In an agent skill context, instructions that alter .git/hooks are more sensitive because users may run them with limited review, increasing the chance of unintended persistence or workflow tampering.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The natural-language instruction says that in auto mode, if no comments are present, the commit message should default to Chinese. This imposes a specific language choice without explicit user opt-in, which matches the language/locale policy violation criteria.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The documented purpose is to automatically generate规范化 commit messages based on git diff, which is a content-generation function. The code additionally creates, overwrites, backs up, and chmods a prepare-commit-msg hook inside .git/hooks, which is a separate repository-modification capability not implied by simple commit message generation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill states it uses AI to analyze staged git diff content, but it does not clearly warn users that potentially sensitive code, comments, file paths, or secrets in the staged diff may be transmitted to an external AI service. This creates a real privacy and data-handling risk because users may invoke the skill assuming analysis is local and unintentionally disclose proprietary or confidential material.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
75% confidence
Finding

The inline comments describe the hook as a simple reminder mechanism, but the implementation installs a prepare-commit-msg hook, which actively modifies commit workflow by executing during commit message preparation. While the script currently only prints reminders, the documentation understates that it injects an always-running Git hook into repository operations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The package description states in Chinese that it automatically generates commit messages conforming to a standard, which implies a language-specific behavior without any indication that users can choose their preferred language or locale. Under the policy, forcing a specific language without opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
87% confidence
Finding

Defaulting to automatic language detection based on code comments means the tool analyzes comment text without explicit user opt-in, which can include sensitive natural-language notes, internal context, or developer annotations. While this is lower severity than undisclosed external transmission, it still expands processing of potentially sensitive content beyond what some users may reasonably expect.

Content

No source excerpt is available for this finding.