T09 · Insecure Skill Coding Practices
- Location
scripts/remove-agent.sh:32- Finding
Destructive Path Traversal in Agent Removal
- Content
View full analysis
- Remediation
View remediation
&2 exit 1 fi ``` 2. Canonicalize both the allowed root and deletion target using `realpath`. 3. Verify that each canonical target is a strict descendant of its expected root before deletion. 4. Explicitly reject empty targets, root directories, `.` and `..` components, path separators, and symlink-based escapes. 5. Refuse to remove symlink targets unless symlink behavior is deliberately supported and securely implemented. 6. Avoid allowing automated agents to use `--force`; require explicit user approval for destructive operations. 7. Display the canonical deletion paths during confirmation. 8. Add tests covering traversal identifiers, absolute-looking inputs, symlinks, empty values, and valid hyphenated identifiers. ]]>
