Commit db4e6b0
codejunkie99
fix(schema)!: reject Windows-style path traversal + skills_link paths
Security hardening for manifest path validation. Two P1s flagged
post-merge:
1. Windows traversal bypass: the existing guard tokenized only on `/`
and treated only `/`-prefixed paths as absolute. Inputs like
`..\..\outside`, `\\server\share`, `C:\temp\x`, or `C:foo` slipped
through and would let install/remove touch arbitrary filesystem
locations when run on Windows. New `_check_path_safe` helper
normalizes both separators and rejects every common absolute-path
form (POSIX root, Windows root, UNC, drive-letter, drive-relative).
2. skills_link unchecked: `target` and `dst` fields were only
validated for presence, then joined with target_root in
`_resolve_skills_link`. A manifest with `../../outside` or `/tmp/x`
in either field could redirect symlink/rsync into arbitrary paths
on any platform. Same `_check_path_safe` helper now applies.
13-case smoke test covers POSIX traversal, Windows traversal,
forward-slash and backslash absolute, UNC, drive-absolute,
drive-relative, and the lowercase-drive variant.
Tests: 40 passed, 1 skipped.1 parent 7dd35fd commit db4e6b0
2 files changed
Lines changed: 61 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
49 | 63 | | |
50 | 64 | | |
51 | 65 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
54 | 87 | | |
55 | 88 | | |
56 | 89 | | |
| |||
62 | 95 | | |
63 | 96 | | |
64 | 97 | | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 98 | + | |
| 99 | + | |
69 | 100 | | |
70 | 101 | | |
71 | 102 | | |
| |||
78 | 109 | | |
79 | 110 | | |
80 | 111 | | |
81 | | - | |
82 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
83 | 115 | | |
84 | | - | |
85 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
86 | 125 | | |
87 | 126 | | |
88 | 127 | | |
| |||
0 commit comments