Commit b8d92a2
[Fix] Validate shard filenames in sharded checkpoint index files (#4033)
* Validate shard filenames in sharded checkpoint index files
Reject shard references with path traversal or mismatched extensions
to prevent a crafted safetensors index from loading pickle payloads.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* remove unrelated tests
* Update src/huggingface_hub/serialization/_torch.py
Co-authored-by: célina <hanouticelina@gmail.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: célina <hanouticelina@gmail.com>1 parent 695e73a commit b8d92a2
2 files changed
Lines changed: 72 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
510 | 510 | | |
511 | 511 | | |
512 | 512 | | |
513 | | - | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
514 | 533 | | |
515 | 534 | | |
516 | 535 | | |
517 | 536 | | |
518 | | - | |
| 537 | + | |
519 | 538 | | |
520 | | - | |
521 | 539 | | |
522 | 540 | | |
523 | 541 | | |
| |||
531 | 549 | | |
532 | 550 | | |
533 | 551 | | |
534 | | - | |
| 552 | + | |
535 | 553 | | |
536 | 554 | | |
537 | 555 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
828 | 828 | | |
829 | 829 | | |
830 | 830 | | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
| 854 | + | |
| 855 | + | |
| 856 | + | |
| 857 | + | |
| 858 | + | |
| 859 | + | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
| 868 | + | |
| 869 | + | |
| 870 | + | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
0 commit comments