T09 · Insecure Skill Coding Practices
Warning
- Location
- references/hansphere.md:123
- Finding
- Unrestricted Repository Staging and Push May Disclose Sensitive Files## Vulnerability Details **File Location**: `references/hansphere.md`, lines 123–127 **Vulnerability Type**: T09: Insecure Skill Coding Practices **Risk Level**: Medium ### Vulnerable Code ```bash cd D:\HanSphere git add . git commit -m "docs: 简要描述变更" git push ``` ### Technical Analysis The documented Git workflow uses `git add .`, which stages every modified and untracked file under the repository rather than limiting the commit to files changed for the requested knowledge-base operation. It then instructs the agent to commit and push the staged content without requiring review, secret scanning, or user confirmation. The skill's separate prohibition against writing sensitive information does not protect sensitive or unrelated files that already exist in the repository. Consequently, a routine note-management operation could unintentionally include preexisting credentials, local configuration, generated reports, private documents, or unrelated work. ### Attack Path 1. A sensitive or unrelated modified or untracked file exists anywhere under `D:\HanSphere`. 2. The agent performs a legitimate knowledge-base update. 3. The agent follows the documented Git workflow and executes `git add .`. 4. Git stages both the intended note and the unrelated file. 5. The agent commits all staged content without reviewing the staged diff. 6. `git push` transmits the resulting commit to the repository's configured remote. 7. Users with access to that remote can retrieve the unintentionally committed content, including through repository history even if it is later deleted. ### Impact Assessment An attacker does not gain local code execution or elevated operating-system privileges through this issue alone. However, the workflow can disclose any modified or untracked file located within the repository and readable by the account running Git. The affected scope includes the entire `D:\HanSphere` working tree and the configured remote repository. Potential consequences inclu ...[truncated 309 chars]
- Remediation
- ## Remediation Suggestions 1. Replace broad staging with explicit path-based staging: ```bash git add -- Notes/03-Concepts/CONCEPT-Domain-Topic.md ``` 2. Before committing, inspect the working tree and staged changes: ```bash git status --short git diff --cached --name-only git diff --cached ``` 3. Abort the commit if the staged set contains files outside the current operation. 4. Run an approved secret scanner against staged content before committing. 5. Maintain a restrictive `.gitignore` for credentials, local configuration, temporary files, generated output, and private artifacts. 6. Require explicit user confirmation before `git push`, and display the target remote, branch, and staged file list. 7. Consider separating commit creation from remote publication so that a normal knowledge-base update does not automatically push. 8. If sensitive data has already been pushed, revoke affected credentials, remove the data from repository history using an appropriate history-rewriting procedure, force-update the remote only after coordination, and notify affected repository users.
