T05 · Unauthorized Access and Privilege Escalation
- Location
therapy-notes.py:24- Finding
Therapy Records Are Accessed Through a Hardcoded Developer-Specific Path
- Content
View full analysis
- Remediation
View remediation
Path: workspace = workspace.expanduser().resolve(strict=True) notes_dir = (workspace / "therapy-notes").resolve() if notes_dir != workspace and workspace not in notes_dir.parents: raise ValueError("Notes directory escapes the authorized workspace") notes_dir.mkdir(mode=0o700, parents=True, exist_ok=True) return notes_dir ``` The authorized workspace should be provided explicitly rather than inferred from an untrusted current working directory. ]]>
