Commit 0116e20
committed
fix(security): allow symlink creation, check path escape only during file writes (#381)
- Remove strict validation during symlink creation to allow legitimate symlinks to system paths
- Keep path validation during file writes using canonicalFilePath() to resolve symbolic links
- Remove symlinkTargetIsWithinTarget function to simplify security check logic
- Fix over-blocking issue while preventing Zip Slip attacks
Before fix: lib.so -> /usr/lib/xxx was incorrectly rejected
After fix: Symlink creation succeeds, writing to system files via symlinks is blocke
Bug:https://pms.uniontech.com/bug-view-356233.html1 parent e3f6b70 commit 0116e20
4 files changed
Lines changed: 11 additions & 62 deletions
File tree
- 3rdparty
- interface
- libminizipplugin
- libzipplugin
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
540 | 540 | | |
541 | 541 | | |
542 | 542 | | |
543 | | - | |
| 543 | + | |
| 544 | + | |
544 | 545 | | |
545 | | - | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
546 | 550 | | |
547 | 551 | | |
548 | 552 | | |
549 | 553 | | |
550 | 554 | | |
| 555 | + | |
551 | 556 | | |
552 | 557 | | |
553 | 558 | | |
554 | 559 | | |
555 | 560 | | |
556 | 561 | | |
557 | 562 | | |
| 563 | + | |
558 | 564 | | |
559 | 565 | | |
560 | 566 | | |
561 | 567 | | |
562 | 568 | | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | | - | |
597 | 569 | | |
598 | 570 | | |
599 | 571 | | |
| |||
602 | 574 | | |
603 | 575 | | |
604 | 576 | | |
605 | | - | |
| 577 | + | |
606 | 578 | | |
607 | 579 | | |
608 | 580 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | 67 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
311 | 311 | | |
312 | 312 | | |
313 | 313 | | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
318 | | - | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
327 | 314 | | |
328 | 315 | | |
329 | 316 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
910 | 910 | | |
911 | 911 | | |
912 | 912 | | |
| 913 | + | |
913 | 914 | | |
914 | | - | |
| 915 | + | |
915 | 916 | | |
916 | 917 | | |
917 | 918 | | |
| |||
971 | 972 | | |
972 | 973 | | |
973 | 974 | | |
974 | | - | |
975 | | - | |
976 | | - | |
977 | | - | |
978 | | - | |
979 | | - | |
980 | 975 | | |
981 | 976 | | |
982 | 977 | | |
| |||
0 commit comments