Commit 757b5ad
fix: reject path traversal in SSH URL parsing (#458)
* fix: reject path traversal in SSH URL parsing
SSH URLs (git@host:owner/repo) bypassed the path validation that
HTTPS URLs already apply. Paths like git@host:owner/../etc would
parse without error.
Apply the same traversal check to _parse_ssh_url: reject '.' and
'..' segments, and reject empty segments from double slashes.
Fixes #455
* fix: address copilot review — update error message and add edge case tests
Update the SSH traversal error message to mention empty segments,
and add tests for double-slash and trailing-slash cases in SSH URLs.
---------
Co-authored-by: Daniel Meppiel <51440732+danielmeppiel@users.noreply.github.com>1 parent fdd0003 commit 757b5ad
File tree
2 files changed
+50
-0
lines changed- src/apm_cli/models/dependency
- tests/unit
2 files changed
+50
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
655 | 655 | | |
656 | 656 | | |
657 | 657 | | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
658 | 667 | | |
659 | 668 | | |
660 | 669 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
177 | 177 | | |
178 | 178 | | |
179 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
180 | 221 | | |
181 | 222 | | |
182 | 223 | | |
| |||
0 commit comments