Commit 5326ebf
fix: ignore includes in submodule configuration
Submodule configuration is read from .gitmodules, whose contents may come
from an untrusted repository. Its parser inherited merge_includes=True and
could therefore open files named by include directives during ordinary
submodule enumeration.
Disable include merging at the SubmoduleConfigParser construction site. This
matches Repo.config_writer() hardening from 41ecc6a and addresses
GHSA-7833-fr7j-v32q without changing include behavior for trusted config
parsers.
The regression points .gitmodules at a non-config file and verifies the
submodule entry remains readable without opening the included path.
Validation:
- pytest -q test/test_submodule.py::TestSubmodule::test_gitmodules_does_not_merge_includes
- pytest -q
- ruff check git/objects/submodule/base.py test/test_submodule.py
- ruff format --check git/objects/submodule/base.py test/test_submodule.py1 parent bde8148 commit 5326ebf
2 files changed
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
270 | 270 | | |
271 | 271 | | |
272 | 272 | | |
273 | | - | |
| 273 | + | |
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1207 | 1207 | | |
1208 | 1208 | | |
1209 | 1209 | | |
| 1210 | + | |
| 1211 | + | |
| 1212 | + | |
| 1213 | + | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
| 1220 | + | |
| 1221 | + | |
| 1222 | + | |
| 1223 | + | |
| 1224 | + | |
| 1225 | + | |
1210 | 1226 | | |
1211 | 1227 | | |
1212 | 1228 | | |
| |||
0 commit comments