T09 · Insecure Skill Coding Practices
- Location
templates/build-prompt.md:49- Finding
Unrestricted Git Staging May Commit Sensitive or Unrelated Files
- Content
View full analysis
Vulnerability Details
File Location:
templates/build-prompt.md:49-50
Vulnerability Type: Unrestricted repository-wide Git staging
Risk Level: MediumVulnerable Code
sh git add . git commit -m "[TASK_TITLE]: Complete [brief description]"Technical Analysis
The build template directs the agent to execute
git add ., which stages every modified or untracked file beneath the current working directory. It does not restrict staging to files intentionally changed for the selected task.This behavior violates least-change principles and conflicts with the workflow's stated requirement to perform only one task per iteration. Before this command runs, unrelated user work, generated configuration, local environment files, credentials, or attacker-planted artifacts may be present in the working tree. All such files can be incorporated into the task's commit without an explicit review or allowlist.
The issue does not independently grant new operating-system privileges. Exploitation depends on the presence or creation of unintended files within the repository and on a later action that publishes or otherwise shares the resulting commit.
Attack Path
- A user, another process, or a malicious project task creates or modifies an unrelated file within the repository.
- The file contains sensitive information or content that should not be included in the current task, such as credentials, local configuration, private data, or attacker-controlled artifacts.
- During Phase 3, the agent follows the build template and executes
git add .. - Git stages both the intended task changes and the unrelated file.
- The agent creates a legitimate-looking task commit containing all staged content.
- If that commit is subsequently pushed, exported, reviewed, or shared, the unintended content is disclosed or introduced into the repository history.
Impact Assessment
The affected scope includes all modified and untracked files under the Gi ...[truncated 671 chars]
- Remediation
View remediation
Remediation Suggestions
Replace repository-wide staging with an explicit review and allowlisted staging process:
-
Inspect the working tree before staging:
sh git status --short git diff -- . -
Stage only files intentionally modified for the current task:
sh git add -- path/to/intended-file path/to/another-intended-file -
Review the staged patch before committing:
sh git diff --cached git status --short -
Abort and request user confirmation if unexpected files or unrelated modifications are detected.
-
Explicitly reject likely secret-bearing files, including
.envfiles, private keys, credential exports, local configuration, and generated authentication data. -
Run an appropriate secret scanner against staged content before committing.
-
Consider using
git add -pwhere interactive review is available, and require each staged hunk to correspond to the current task. -
Update the template to prohibit
git add .,git add -A, and equivalent unrestricted staging commands.
-
