T09 · Insecure Skill Coding Practices
- Location
references/build-questions.md:13- Finding
Destructive cleanup commands can delete files outside the intended project
- Content
View full analysis
- Remediation
View remediation
&2; exit 1 ;; esac ``` 3. Enter the validated project directory and terminate if that operation fails: ```bash cd -- "$project_root" || exit 1 ``` 4. Replace `build*` with an exact allowlist such as `"$project_root/build"`. 5. Quote every path expansion, especially `"$GOPATH/native"`. 6. Before deletion, verify that each canonical target is a descendant of an approved root and is not `/`, the user's home directory, or the GOPATH root itself. 7. Prefer CMake-native cleanup where possible, such as `cmake --build "$build_dir" --target clean`. 8. Require explicit user confirmation before deleting directories outside the project root, including `"$GOPATH/native"`. ]]>
