T09 · Insecure Skill Coding Practices
- Location
scripts/generate_module.py:48- Finding
Arbitrary filesystem writes through unrestricted module and output paths
- Content
View full analysis
2 else "." generate_module(module_name, output_dir) ``` ### Technical Analysis The script uses user-controlled `module_name` and `output_dir` values to construct filesystem paths without validating their format or confirming that the resolved destination remains inside an approved project directory. `os.path.join()` does not impose a security boundary. If `module_name` is absolute, it supersedes `output_dir`. A module name containing traversal components such as `../` can also escape the selected output directory. The script then passes the resulting path to `os.makedirs()` and writes a generated `README.md` beneath it. The existing-directory check reduces overwrite opportunities because generation stops when `module_dir` already exists. It does not prevent the creation of a new directory and files at an unintended writable location. ### Attack Path 1. An attacker or untrusted project specification supplies an absolute or traversal-bearing module ...[truncated 1147 chars]- Remediation
View remediation
