Commit b88d913
Validate submodule names before filesystem operations
Submodule names read from .gitmodules can influence the separate Git directory path. Reject empty names, absolute or drive-qualified names, and parent components with either path separator.
Validate before constructing module paths and before opening or mutating existing checkouts, so a repository initialized by an older vulnerable version cannot bypass the guard. Validate programmatic add and rename inputs before making changes as well.
Add local-repository regression coverage for both new initialization and an existing separate Git directory outside the clone. This follows Git commit 0383bbb901 (submodule-config: verify submodule names as paths) while also accounting for os.path.join absolute-path semantics.
Advisory: GHSA-hmq2-w58f-27jc
Validation:
- pytest -q test/test_submodule.py on Python 3.14.6 (39 passed, 1 skipped, 1 xfailed)
- ruff check and format --check on changed files
- mypy git/objects/submodule/base.py1 parent 6e61b1d commit b88d913
2 files changed
Lines changed: 67 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
302 | 303 | | |
303 | 304 | | |
304 | 305 | | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
305 | 317 | | |
306 | 318 | | |
307 | 319 | | |
308 | | - | |
| 320 | + | |
309 | 321 | | |
310 | 322 | | |
311 | 323 | | |
| |||
523 | 535 | | |
524 | 536 | | |
525 | 537 | | |
| 538 | + | |
526 | 539 | | |
527 | 540 | | |
528 | 541 | | |
| |||
726 | 739 | | |
727 | 740 | | |
728 | 741 | | |
| 742 | + | |
729 | 743 | | |
730 | 744 | | |
731 | 745 | | |
| |||
1020 | 1034 | | |
1021 | 1035 | | |
1022 | 1036 | | |
| 1037 | + | |
1023 | 1038 | | |
1024 | 1039 | | |
1025 | 1040 | | |
| |||
1160 | 1175 | | |
1161 | 1176 | | |
1162 | 1177 | | |
| 1178 | + | |
1163 | 1179 | | |
1164 | 1180 | | |
1165 | 1181 | | |
| |||
1416 | 1432 | | |
1417 | 1433 | | |
1418 | 1434 | | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
1419 | 1438 | | |
1420 | 1439 | | |
1421 | 1440 | | |
| |||
1463 | 1482 | | |
1464 | 1483 | | |
1465 | 1484 | | |
| 1485 | + | |
1466 | 1486 | | |
1467 | 1487 | | |
1468 | 1488 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
925 | 925 | | |
926 | 926 | | |
927 | 927 | | |
| 928 | + | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
928 | 974 | | |
929 | 975 | | |
930 | 976 | | |
| |||
0 commit comments