T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/manage_plan.py:37- Finding
Unrestricted Path Arguments Allow Arbitrary File Overwrite and Relocation
- Content
View full analysis
2 else "plan.md" archive_dir = "archive" if "--dir" in sys.argv: idx = sys.argv.index("--dir") archive_dir = sys.argv[idx + 1] archive_plan(output_path, archive_ ...[truncated 2662 chars]- Remediation
View remediation
/archive`; do not accept an unrestricted `--dir` argument. 4. Reject symbolic links for files and relevant parent directories, or securely resolve them and revalidate the resolved target against the workspace root. 5. Use exclusive creation mode (`'x'`) for new plans. If replacement is required, demand explicit confirmation or a dedicated `--force` option. 6. Before archive or cleanup operations, verify that each target is a regular file under the approved directory. 7. Apply the same centralized path-validation function to `create`, `update`, `check`, `pause`, `resume`, `archive`, `cleanup`, `list`, and `on-start`. 8. Add tests covering absolute paths, `../` traversal, symlink traversal, filenames that do not match `plan*.md`, and archive destinations outside the workspace. ]]>
