T09 · Insecure Skill Coding Practices
- Location
references/hansphere.md:123- Finding
Unrestricted Repository Staging and Push May Disclose Sensitive Files
- Content
View full analysis
Vulnerability Details
File Location:
references/hansphere.md, lines 123–127
Vulnerability Type: T09: Insecure Skill Coding Practices
Risk Level: MediumVulnerable Code
bash cd D:\HanSphere git add . git commit -m "docs: 简要描述变更" git pushTechnical 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
- A sensitive or unrelated modified or untracked file exists anywhere under
D:\HanSphere. - The agent performs a legitimate knowledge-base update.
- The agent follows the documented Git workflow and executes
git add .. - Git stages both the intended note and the unrelated file.
- The agent commits all staged content without reviewing the staged diff.
git pushtransmits the resulting commit to the repository's configured remote.- 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:\HanSphereworking tree and the configured remote repository.Potential consequences inclu ...[truncated 309 chars]
- A sensitive or unrelated modified or untracked file exists anywhere under
- Remediation
View remediation
Remediation Suggestions
- Replace broad staging with explicit path-based staging:
bash git add -- Notes/03-Concepts/CONCEPT-Domain-Topic.md - Before committing, inspect the working tree and staged changes:
bash git status --short git diff --cached --name-only git diff --cached - Abort the commit if the staged set contains files outside the current operation.
- Run an approved secret scanner against staged content before committing.
- Maintain a restrictive
.gitignorefor credentials, local configuration, temporary files, generated output, and private artifacts. - Require explicit user confirmation before
git push, and display the target remote, branch, and staged file list. - Consider separating commit creation from remote publication so that a normal knowledge-base update does not automatically push.
- 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.
- Replace broad staging with explicit path-based staging:
