T09 · Insecure Skill Coding Practices
- Location
scripts/clean.py:84- Finding
Unvalidated cleanup and restore paths permit unintended file modification
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This token cleanup skill is not obviously malicious, but it needs review because its scripts can modify persistent OpenClaw workspace memory and instruction files with imperfect safeguards.
Install only if you are comfortable with a Chinese-language tool that reads OpenClaw workspace memory/instruction files and, after confirmation, modifies DREAMS.md and restores backup files. Review dry-run output carefully, avoid using custom --workspace or --restore paths, keep auto_replace_agents false, and make an independent backup before forced cleanup or restore.
scripts/clean.py:84Unvalidated cleanup and restore paths permit unintended file modification
scripts/clean.py:27DREAMS.md reconstruction can silently discard unrelated content
scripts/clean.py:14Date-only backup naming permits recovery copies to be overwritten
The skill metadata says AGENTS files are 'never auto-replaced', but this code will automatically replace a workspace AGENTS.md when it matches a pattern and the config flag auto_replace_agents is enabled. That creates a trust-boundary violation: operational behavior is less safe than advertised, and important agent instructions or security constraints in workspace-specific AGENTS.md files could be silently overwritten.
The skill describes and encourages execution of local scripts that can modify and restore workspace files, but it does not declare an explicit tool scope such as allowed-tools or permissions. That mismatch weakens security review and policy enforcement because an agent may be induced to use file read/write capabilities beyond what the manifest transparently communicates.
Allowing the AI to proactively suggest activation when it merely detects that the session context is 'too large' introduces an ambiguous trigger that can cause the skill to engage without a clear user request. In this skill's context, that increases the chance of unnecessary scanning or nudging the user toward cleanup actions on sensitive workspace files, even though later steps include confirmation gates.
This markdown file contains user-facing instructions only in Chinese, and there is no indication that the skill or guide is intentionally limited to Chinese-speaking users. Under the language/locale policy, forcing a specific language without user opt-in is a natural-language policy concern.
This markdown file is written entirely in Chinese and presents the guidance as the default without any opt-in, alternative language, or explanation that the content is intended only for a Chinese-speaking or region-specific audience. Under the policy, forcing a specific language without user choice is a natural-language policy violation.
The module docstring is written as a Chinese-only description, indicating a language-specific skill presentation. Under the policy, forcing a specific language without user opt-in or a documented region-specific justification is a natural-language policy violation.
The comment suggests AGENTS slimming should not affect custom files, but matching files are still auto-replaced if they appear to use the 'old verbose format'. Relying on a brittle regex heuristic to distinguish safe-to-replace files can misclassify real workspace policy documents, leading to unintended loss or weakening of agent instructions.
The script prints operational messages such as dry-run status, execution results, backup errors, and restore notices only in Chinese. Because these are user-facing strings and no language choice or locale justification is provided, this violates the language/locale policy criteria.
The file uses Chinese-only natural-language strings in the module docstring and all user-facing report output, with no indication that language is configurable or limited to a China-specific use case. This can violate language/locale policy when users are not given an opt-in or alternative locale.
The module docstring mixes English with Chinese and presents the skill as a Chinese-localized scanner description without any indication that language choice is optional. This can violate language/locale policy when a skill imposes a specific language presentation on users without offering opt-in or alternatives.
The module docstring is written only in Chinese, and the script's user-facing output is likewise Chinese-only, indicating a fixed language choice. For a general-purpose monitoring utility, this is a natural-language policy issue because it imposes a locale without user opt-in or any documented regional constraint.
These print statements provide the operational interface of the script, but they are hard-coded to Chinese and do not offer an alternative language or user selection. That creates a language-policy violation under the stated rule because the skill forces a specific language for interaction.