T09 · Insecure Skill Coding Practices
- Location
src/workspace_check.py:21- Finding
Overbroad Relocation of Root-Level Workspace Files
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This workspace maintenance skill is not clearly malicious, but its repair mode can broadly move files and auto-commit repository changes without enough user control.
Install only if you are comfortable with a `--fix` mode that may move root-level files into `tmp/`, rename memory files, change PowerShell script permissions, and automatically commit all current Git changes. Prefer running it only in a disposable or clean repository, inspect `git status` first, and avoid `--fix` unless the publisher adds dry-run, confirmation, and narrow file selection controls.
src/workspace_check.py:21Overbroad Relocation of Root-Level Workspace Files
src/workspace_check.py:105Unrestricted Git Staging and Automatic Commit of Workspace Content
Automatically staging and committing all Git changes without a prompt is a strong integrity and confidentiality risk. In practice, this can capture unrelated edits, secrets, or malicious modifications and persist them under the guise of routine maintenance, which is especially dangerous for an agent-executed skill.
The skill explicitly advertises automatic repair actions that modify the workspace, including archiving files, changing permissions, and automatically committing Git changes, but the documentation does not clearly warn about side effects, scope, rollback limitations, or consent requirements. In an agent-driven environment, such undocumented write operations can cause unintended data movement, permission changes, or source-control actions that the user did not fully anticipate.
The manifest explicitly advertises 'automatic repair' for a workspace maintenance skill but does not warn that it may make system- or workspace-affecting changes. This can mislead users into invoking the skill without understanding that it may modify files, configurations, or state, increasing the risk of unintended destructive or security-relevant changes.
The script is presented as a workspace check utility, but its documented --fix behavior performs file moves, renames, ACL changes, and Git commits. That mismatch is security-relevant because users may grant trust appropriate for diagnostics while the tool actually makes broad persistent changes.
The module docstring and user-facing strings indicate the script is designed to operate in Chinese, but there is no opt-in, language selection, or justification that this is a region-specific tool. This creates a natural-language locale policy concern because it imposes a specific language by default.
The auto-fix routine broadly moves root files into tmp/ and renames memory files based on heuristics, all without interactive confirmation or a preview of pending changes. This can disrupt expected workspace layout, break references, or hide important files, especially if the workspace contains files the heuristic incorrectly treats as non-essential.
The auto-fix path performs permission changes and Git operations that are not necessary for a simple local workspace health check. In an agent skill context, unnecessary write-capable subprocess behavior is more dangerous because it can alter trust boundaries, persist changes, and affect downstream execution without granular consent.
This subprocess changes ACLs on .ps1 files using icacls, which is a privileged filesystem modification not normally expected from a checker. Although the command arguments are fixed and non-shell, changing execution permissions can make scripts runnable that were previously restricted, expanding the attack surface of the workspace.
if file.suffix == '.ps1':
try:
import subprocess
subprocess.run(
['icacls', str(file), '/grant', f'{os.getlogin()}:RX'],
capture_output=True,
check=True
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
if git_dir.exists():
try:
import subprocess
status_result = subprocess.run(
['git', 'status', '--porcelain'],
capture_output=True,
text=True
subprocess module calls execute external commands. Without careful input validation, this enables command injection.
if git_dir.exists():
try:
import subprocess
status_result = subprocess.run(
['git', 'status', '--porcelain'],
capture_output=True,
text=True
This call stages all repository changes via git add ., which is a broad write action hidden inside an auto-fix path for a workspace checker. In this context, it can silently include unrelated, sensitive, or unintended files in version control, making accidental data exposure or integrity-impacting commits much more likely.
if status_result.stdout.strip():
# 添加所有更改
subprocess.run(['git', 'add', '.'], check=True, capture_output=True)
# 提交
commit_msg = f"Auto commit: 工作空间自动修复 {datetime.datetime.now().strftime('%Y-%m-%d %H:%M')}"
subprocess.run(['git', 'commit', '-m', commit_msg], check=True, capture_output=True)
This call automatically creates a Git commit without an interactive confirmation step, which exceeds the expected behavior of a health-check tool. In skill/agent contexts, silently persisting all current changes can conceal unauthorized modifications, commit secrets, or create an audit trail that misattributes changes to legitimate maintenance.
subprocess.run(['git', 'add', '.'], check=True, capture_output=True)
# 提交
commit_msg = f"Auto commit: 工作空间自动修复 {datetime.datetime.now().strftime('%Y-%m-%d %H:%M')}"
subprocess.run(['git', 'commit', '-m', commit_msg], check=True, capture_output=True)
print(f" [OK] 自动提交Git更改")
fixed_count += 1
except Exception as e:
The skill documentation switches into Chinese for its description and operational guidance, with no indication that this is optional or region-specific. This can violate language/locale policy when users are not given a choice or explanation for the enforced language.
The manifest description uses Chinese text exclusively, which can impose a language choice on users without opt-in. Under the language/locale policy, skills should not force a specific language unless they explicitly offer a choice or clearly justify a locale-specific scope.