T09 · Insecure Skill Coding Practices
- Location
SKILL.md:103- Finding
Broad Git staging can expose unrelated sensitive files through remote push
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:103-106
Vulnerability Type: Insecure repository mutation and unintended data disclosure
Risk Level: HighComplete Code Snippet:
bash git add . git commit -m "fix: resolve CI failures" git pushTechnical Analysis
The Skill instructs the agent to stage the entire working tree with
git add ., commit it, and push the commit to the configured remote repository. This stages all changed and untracked files in scope rather than limiting the commit to files deliberately modified while repairing the CI failure.A code-review or CI-repair workflow does not require indiscriminate access to every working-tree change. The instruction therefore violates least-privilege principles at the data-selection level. Sensitive
.envfiles, private configuration, credentials, generated artifacts, unrelated user work, or attacker-planted files could be included in the commit.The subsequent
git pushturns unsafe local staging into a network disclosure risk. Although pushing a repair may be legitimate for a user-owned pull request, doing so without an explicit file allowlist, staged-diff review, secret scan, and user confirmation exceeds the minimum privileges necessary for the declared code-review functionality.Attack Path
- A sensitive, unrelated, or attacker-controlled file exists as a changed or untracked file in the repository working tree.
- The Skill is invoked to diagnose and repair a CI failure on the user's pull request.
- The agent follows
git add ., staging both the intended repair and all other changes in scope. - The broad staged set is committed without an explicit staged-diff or secret review.
git pushtransmits the commit to the configured Git remote.- Anyone with suitable repository access may retrieve the unintentionally committed data; secrets may remain recoverable from Git history even after a later deletion.
Impa
...[truncated 672 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
git add .from the workflow. - Record the exact files intentionally modified by the repair and stage only those explicit paths, for example:
bash git add -- src/affected-file.ts tests/affected-file.test.ts - Run
git status --shortbefore staging and identify unrelated or untracked files. - Review the staged patch with:
bash git diff --cached --stat git diff --cached - Run a secret scanner against the staged content before committing.
- Reject sensitive filenames such as
.env, private keys, credential files, and generated secrets by default. - Require explicit user confirmation before both
git commitandgit push. - Prefer generating a patch for user review instead of directly mutating and pushing the repository.
- If exposure has already occurred, remove the data from repository history where appropriate, revoke and rotate affected secrets, and review remote access logs.
- Remove
