T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/init_project.py:117- Finding
Unvalidated Path Components Allow Writes Outside Intended Project and Workspace Roots
- Content
View full analysis
`', f'`{project_dir.parent}`') if write_text(system_path, content, overwrite=overwrite): created.append(str(system_path)) else: skipped.append(str(system_path)) ``` ### Technical Analysis The values of `project_name` and `project_rule_filename` are used as path components without validation. The implementation does not reject: - Absolute paths - Parent-directory components such as `..` - Embedded path separators - Symlink-based path redirection With `pathlib`, joining a root with an absolute path discards the original root. For example: ```python Path('/approved/workspace') / '/tmp/target' ``` evaluates to `/tmp/target`. Similarly, a value such as `../../outside` can escape the intended root. The resulting paths are subsequen ...[truncated 2112 chars]- Remediation
View remediation
