Commit 8df05e8
fix: Improve file path validation for macOS system directories
Fixed file path validation to properly block system directories on macOS:
- Added /private/etc check (macOS: /etc is symlink to /private/etc)
- Added /private/var/root check (root's home directory)
- Added system binary directories (/bin, /sbin, /usr/bin, /usr/sbin)
- Fixed path comparison to handle both exact matches and subdirectories
Updated test to use absolute path instead of relative path traversal
that doesn't actually reach system directories from test working directory.
Results:
- Fixed 6 file path validation tests in test_config_parser_batch4.py
- All TestFilePathValidation tests now pass on macOS
Files Modified:
- src/empathy_os/config.py: Enhanced dangerous_paths list
- tests/behavioral/test_config_parser_batch4.py: Fixed path traversal test
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>1 parent 1abf115 commit 8df05e8
2 files changed
Lines changed: 18 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
64 | | - | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
65 | 78 | | |
66 | | - | |
| 79 | + | |
67 | 80 | | |
68 | 81 | | |
69 | 82 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
63 | 64 | | |
64 | | - | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
0 commit comments