T09 · Insecure Skill Coding Practices
- Location
scripts/git_quick.sh:120- Finding
Unvalidated Environment Variables Permit Execution of Attacker-Controlled Programs
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This Git helper is not clearly malicious, but it needs review because it can mutate repositories and some quick-command safety boundaries are under-disclosed.
Install only if you are comfortable letting the skill run Git commands that can change local history and working-tree state. Use explicit commands, review diffs before commits, avoid using untrusted PAGER or GIT_QUICK_DIFF_* environment values, and require clear confirmation before push, amend, reset, clean, rebase, or conflict resolutions that keep only one side.
scripts/git_quick.sh:120Unvalidated Environment Variables Permit Execution of Attacker-Controlled Programs
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).
### Dangerous Operations
The following operations require user confirmation and risk explanation:
- `git push --force` / `git push -f`
- `git reset --hard`
- `git clean -fd`
- `git rebase` on shared branches
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).
git rebase origin/main
git push origin HEAD
### Hotfix Workflow
The description presents a comprehensive Git assistant covering many operational workflows and special command prefixes. The supplied code chunk instead implements a single-purpose conflict-analysis utility. It reads git repository state, detects unresolved conflicts, extracts conflict markers with context, and prints advice for manual resolution. While conflict analysis is related to Git, the primary purpose is materially narrower than the declared assistant, and key advertised capabilities/triggers are absent.
The description presents an intelligent workflow assistant with broad Git support and safety behaviors. The actual code is a straightforward command dispatcher for a subset of Git operations. While some overlap exists—branch listing/creation, status, diff, stash, fetch, and basic commit/amend—the code lacks the key advertised features: automatic change analysis, commit strategy recommendations (amend vs new commit), writing commit messages, project convention adherence, confirmation for dangerous commands, and support for push/rebase/merge. The quick-command style partially aligns conceptually, but the specific declared 'gq' trigger mechanism is not present in this code itself. Therefore the description materially overstates and mischaracterizes the implementation.
The description claims a comprehensive Git workflow assistant with command triggers, operational support across many git tasks, automatic analysis, and safety behaviors. The supplied code chunk instead performs one specific function: exporting current working-tree and staged diffs to files in .git/merge-diffs. While this is Git-related and could support merge/rebase workflows, it does not match the declared primary purpose or capabilities. The code also persists data in the .git directory, which is a concrete behavior absent from the description. This is a material description-behavior mismatch rather than a minor implementation detail.
The declared description presents a comprehensive interactive Git assistant with workflow analysis, quick-command triggers, and guidance across many git operations. The supplied code instead is a single-purpose utility for visualizing existing merge conflicts. While merge-related assistance is loosely within the broader Git domain, the primary purpose is materially narrower and different from the declared behavior. It also lacks the described trigger handling and automation features. Therefore, this is a description-behavior mismatch.
The skill instructs pushing with 'git push origin HEAD', which forwards whatever commit HEAD references to the remote branch. Even though it says to confirm first, using HEAD directly is a risky parameterization in an agent context because detached HEAD states or unexpected branch contexts can push unintended history to a remote, causing data exposure or integrity issues.
1. Confirm current branch: `git branch --show-current`
2. Show what will be pushed: `git log origin/$(git branch --show-current)..HEAD --oneline`
3. Ask user to confirm
4. Push: `git push origin HEAD`
Never use `git push --force` without explicit user confirmation.
The skill includes destructive commands like 'git reset --hard' and 'git clean -fd' as supported dangerous operations. In an agent skill, merely normalizing these commands without stronger safeguards can enable irreversible loss of uncommitted work if triggered by ambiguous requests or insufficient confirmation flows.
These require user confirmation before execution:
- `git push --force` or `git push -f`
- `git reset --hard`
- `git clean -fd`
- `git rebase` on shared/public branches
- `git branch -D` (force delete)
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).
- Delete merged branches: `git branch -d branch-name`
### Pushing Changes
- Always push to current branch: `git push origin HEAD`
- Never force push to shared branches without team agreement
- Use `git push --force-with-lease` instead of `--force` when needed
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).
### Dangerous Operations
These require extra caution and user confirmation:
- `git push --force` / `git push -f`
- `git reset --hard`
- `git clean -fd`
- `git rebase` on public branches
- `git branch -D` (force delete)
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).
### Dangerous Operations
These require extra caution and user confirmation:
- `git push --force` / `git push -f`
- `git reset --hard`
- `git clean -fd`
- `git rebase` on public branches
- `git branch -D` (force delete)
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).
### Dangerous Operations
These require extra caution and user confirmation:
- `git push --force` / `git push -f`
- `git reset --hard`
- `git clean -fd`
- `git rebase` on public branches
- `git branch -D` (force delete)
The README labels quick operations as read-only/low-risk, but the documented gq commands include state-changing actions such as branch switching, branch creation/deletion, stashing, and committing. This mismatch can cause an agent or user to trust a mode as safe when it can modify repository state, increasing the chance of unintended destructive actions.
The natural-language activation examples such as "help me commit code" are broad and resemble ordinary conversation, which increases the risk of accidental triggering in contexts where the user did not intend to authorize repository changes. In an agent skill that can commit, push, and rewrite history, ambiguous invocation expands the attack surface for unintended execution.
The conflict-resolution section first states the assistant must never automatically choose one side, then later lists Keep Ours and Keep Theirs as resolution strategies. That inconsistency can enable silent loss of incoming or local changes if an implementation follows the latter guidance without user review.
The examples for undoing changes include potentially destructive commands like git restore <file> and git reset HEAD~1 without nearby warnings about data loss scenarios, reversibility, or confirmation. In a skill README, examples often get copied directly into workflows, so missing guardrails can lead to accidental loss of uncommitted or unpublished work.
The manifest description uses very broad trigger language such as helping with many Git operations and natural-language requests. In agent environments, overbroad trigger conditions can cause unintended invocation and execution of repository-affecting scripts in contexts the user did not clearly intend, increasing the chance of unsafe state changes.
At L121 the documentation states 'DO NOT perform automatic merges' during conflict resolution, implying the skill should avoid directly carrying out merge/rebase operations on the user's behalf. However, later sections provide direct execution steps for git rebase and git merge commands, which contradicts that stated safety constraint and creates unclear operational intent.
The opening principle explicitly states the resolver must present both versions and never automatically choose one side when confidence is lacking. Later sections prescribe default resolutions such as 'Usually keep B's version' and 'Keep B's code' for conflict cases, which contradicts the earlier safety rule and can encourage automatic one-sided resolutions.
The 'Forbidden Actions' section says never automatically choose one side using git checkout --ours or --theirs without explicit user approval. The submodule handling section later presents those exact commands as concrete resolution steps, without reiterating the approval requirement, which contradicts the documented safety intent.
The quick-command reference exposes state-changing git operations without inline warnings about their effects, reversibility, or prerequisites. In an agent-driven workflow, terse commands like stash pop, branch delete, commit-all, and amend can be executed with little context, increasing the risk of accidental data loss, unintended commits, or history rewriting.
Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.
gq "b->" main # Switch to main
### Create Feature Branch
```bash
gq b:c # Confirm current branch
gq b:n feature-x # Create new branch
The documentation states that quick commands are 'read-only or low-risk', but the same reference includes commands that modify repository state, including branch deletion, stash pop, add-all-and-commit, and amend. This mismatch can mislead users or downstream agents into invoking destructive or irreversible actions with reduced scrutiny.
The script executes commands taken directly from environment-controlled variables (GIT_QUICK_DIFF_TERMINAL and GIT_QUICK_DIFF_PAGER) without constraining them to trusted binaries. In an agent or automation context, an attacker who can influence the environment can cause arbitrary command execution whenever a user runs a diff command, which goes beyond normal Git workflow behavior.
git stash pop modifies the working tree and removes the stash entry if successful, which can be difficult to undo and may create conflicts. The script exposes this as a short command but does not provide any confirmation or user-facing warning about the side effects.
No suspicious patterns detected.