Johannes Schindelin a8dee3ca61 Disallow dubiously-nested submodule git directories
Currently it is technically possible to let a submodule's git
directory point right into the git dir of a sibling submodule.

Example: the git directories of two submodules with the names `hippo`
and `hippo/hooks` would be `.git/modules/hippo/` and
`.git/modules/hippo/hooks/`, respectively, but the latter is already
intended to house the former's hooks.

In most cases, this is just confusing, but there is also a (quite
contrived) attack vector where Git can be fooled into mistaking remote
content for file contents it wrote itself during a recursive clone.

Let's plug this bug.

To do so, we introduce the new function `validate_submodule_git_dir()`
which simply verifies that no git dir exists for any leading directories
of the submodule name (if there are any).

Note: this patch specifically continues to allow sibling modules names
of the form `core/lib`, `core/doc`, etc, as long as `core` is not a
submodule name.

This fixes CVE-2019-1387.

Reported-by: Nicolas Joly <Nicolas.Joly@microsoft.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2019-12-05 15:36:51 +01:00
..
2017-09-10 17:02:51 +09:00
2016-11-22 13:55:20 -08:00
2017-06-24 14:28:41 -07:00
2017-06-24 14:28:41 -07:00
2017-06-24 14:28:41 -07:00
2017-06-24 14:28:41 -07:00
2017-06-24 14:28:41 -07:00
2017-06-24 14:28:41 -07:00
2017-03-31 08:33:56 -07:00
2017-08-23 14:33:44 -07:00
2017-06-24 14:28:41 -07:00
2017-06-24 14:28:41 -07:00
2017-06-15 12:56:22 -07:00
2017-06-24 14:28:41 -07:00
2017-07-13 16:14:54 -07:00
2017-06-24 14:28:41 -07:00
2017-06-24 14:28:41 -07:00
2017-07-10 13:42:51 -07:00
2017-06-24 14:28:41 -07:00
2017-06-24 14:28:41 -07:00
2017-07-10 13:42:51 -07:00
2017-06-24 14:28:41 -07:00
2017-06-24 14:28:41 -07:00
2017-01-23 18:51:56 -08:00
2017-10-17 15:10:13 +09:00
2018-05-22 14:10:49 +09:00
2017-06-24 14:28:41 -07:00
2017-06-24 14:28:41 -07:00