T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/render.py:34- Finding
Nested Symlink Output Escape When Using --replace
- Content
View full analysis
None: path = output_dir / rel path.parent.mkdir(parents=True, exist_ok=True) path.write_text(content, encoding="utf-8") written.append(rel) ``` ### Technical Analysis The output safety gate validates only the output directory itself. When `--replace` is enabled, the directory may already contain arbitrary files and nested directories. Existing child paths are not checked for symlinks before `mkdir()` or `write_text()` is called. Python path-based file operations normally follow symlinks. Consequently, an existing generated destination such as `src/index.ts`, or a parent such as `src`, can point outside the approved output directory. The renderer then writes generated content to the symlink target. This contradicts the documented containment claim that generation writes only inside the caller-created output directory. Exis ...[truncated 2008 chars]- Remediation
View remediation
