Commit a5285cd
Security: fix Windows backslash traversal in symlink checks, rename constant
- archive.py: extract _is_unsafe_symlink_target() helper that checks both
PurePosixPath and PureWindowsPath so targets like "..\\..\\evil" are caught
on any host OS; apply it to both _check_zip_member_type and
_check_tar_member_type, removing the duplicated inline check.
Rename _MAX_SYMLINK_TARGET → max_symlink_target to satisfy pylint C0103
(local variable vs. module-level constant naming convention).
- test_archive.py: add Windows-backslash traversal cases for both ZIP
(test_check_zip_members_symlink_windows_dotdot_target) and TAR
(test_check_tar_member_type_windows_dotdot_symlink).
https://claude.ai/code/session_01CxKrTZekNRCoSD9PSMekQZ1 parent 2d1ace7 commit a5285cd
2 files changed
Lines changed: 37 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
366 | 366 | | |
367 | 367 | | |
368 | 368 | | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
369 | 386 | | |
370 | 387 | | |
371 | 388 | | |
| |||
377 | 394 | | |
378 | 395 | | |
379 | 396 | | |
380 | | - | |
| 397 | + | |
381 | 398 | | |
382 | 399 | | |
383 | 400 | | |
384 | | - | |
385 | | - | |
| 401 | + | |
| 402 | + | |
386 | 403 | | |
387 | 404 | | |
388 | 405 | | |
389 | 406 | | |
390 | 407 | | |
391 | | - | |
392 | | - | |
393 | | - | |
| 408 | + | |
394 | 409 | | |
395 | 410 | | |
396 | 411 | | |
| |||
422 | 437 | | |
423 | 438 | | |
424 | 439 | | |
425 | | - | |
426 | | - | |
427 | | - | |
| 440 | + | |
428 | 441 | | |
429 | 442 | | |
430 | 443 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
165 | 172 | | |
166 | 173 | | |
167 | 174 | | |
| |||
268 | 275 | | |
269 | 276 | | |
270 | 277 | | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
271 | 286 | | |
272 | 287 | | |
273 | 288 | | |
| |||
0 commit comments