T09 · Insecure Skill Coding Practices
- Location
safe_file_editor.py:127- Finding
Predictable Temporary File Path Permits Symlink-Based File Overwrite
- Content
View full analysis
- Remediation
View remediation
Security audit
Security checks for vulnerabilities and agentic risk
This file-editing skill is coherent, but it needs review because its advertised safety controls are not fully enforced and its implementation can mishandle sensitive or important files.
Install only if you are comfortable reviewing each diff yourself and treating this as a convenience helper, not an enforced safety boundary. Avoid using it on secrets, credentials, or sensitive configuration until the confirmation check, temporary-file handling, backup uniqueness, metadata preservation, and logging behavior are fixed.
safe_file_editor.py:127Predictable Temporary File Path Permits Symlink-Based File Overwrite
safe_file_editor.py:127Atomic Replacement Can Weaken Target File Permissions
safe_file_editor.py:105Plaintext Edit Logging May Disclose Secrets and Allow Log Injection
safe_file_editor.py:154Backup Filename Collisions Can Overwrite Recovery Data
safe_file_editor.py:232Executable Demonstration Uses an Unsafe Predictable Path in the Shared Temporary Directory
The skill declares it should be used for essentially any file modification operation, which is an overly broad trigger for a high-impact capability. In agent environments, broad activation criteria can cause the editor to be invoked in inappropriate contexts, increasing the chance of unintended file writes, confirmation bypass patterns, or misuse on sensitive files despite the documented dry-run safeguards.
The primary natural-language documentation and descriptions in the module are written exclusively in Chinese, including the module title and core design notes. This imposes a locale/language constraint without offering a user choice or stating a justified region-specific scope, which matches the language-policy violation criteria.
The module-level documentation explicitly claims a '4-eyes principle' and secondary confirmation, but the implementation performs writes whenever dry_run=False without any approval workflow. This mismatch can cause callers to trust the tool's safety properties and permit edits that occur without the expected human verification, increasing the chance of unauthorized or accidental file modification.
The file mixes Chinese documentation with prescriptive English phrases such as 'always dry_run first' and 'show complete diff' in the best-practices section, without stating that language is optional or user-selectable. This can amount to an implicit language constraint rather than offering a locale choice.
The constructor exposes require_confirmation as if it controls a security boundary, but the value is never checked before modifying files. This creates a false sense of protection for integrators who may instantiate the editor expecting confirmation enforcement, while the code still allows direct writes.