Skip to content

Commit d851d94

Browse files
committed
Sync with 2.19.3
* maint-2.19: (34 commits) Git 2.19.3 Git 2.18.2 Git 2.17.3 Git 2.16.6 test-drop-caches: use `has_dos_drive_prefix()` Git 2.15.4 Git 2.14.6 mingw: handle `subst`-ed "DOS drives" mingw: refuse to access paths with trailing spaces or periods mingw: refuse to access paths with illegal characters unpack-trees: let merged_entry() pass through do_add_entry()'s errors quote-stress-test: offer to test quoting arguments for MSYS2 sh t6130/t9350: prepare for stringent Win32 path validation quote-stress-test: allow skipping some trials quote-stress-test: accept arguments to test via the command-line tests: add a helper to stress test argument quoting mingw: fix quoting of arguments Disallow dubiously-nested submodule git directories protect_ntfs: turn on NTFS protection by default path: also guard `.gitmodules` against NTFS Alternate Data Streams ...
2 parents 0d0ac38 + caccc52 commit d851d94

40 files changed

+914
-82
lines changed

Documentation/RelNotes/2.14.6.txt

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
Git v2.14.6 Release Notes
2+
=========================
3+
4+
This release addresses the security issues CVE-2019-1348,
5+
CVE-2019-1349, CVE-2019-1350, CVE-2019-1351, CVE-2019-1352,
6+
CVE-2019-1353, CVE-2019-1354, and CVE-2019-1387.
7+
8+
Fixes since v2.14.5
9+
-------------------
10+
11+
* CVE-2019-1348:
12+
The --export-marks option of git fast-import is exposed also via
13+
the in-stream command feature export-marks=... and it allows
14+
overwriting arbitrary paths.
15+
16+
* CVE-2019-1349:
17+
When submodules are cloned recursively, under certain circumstances
18+
Git could be fooled into using the same Git directory twice. We now
19+
require the directory to be empty.
20+
21+
* CVE-2019-1350:
22+
Incorrect quoting of command-line arguments allowed remote code
23+
execution during a recursive clone in conjunction with SSH URLs.
24+
25+
* CVE-2019-1351:
26+
While the only permitted drive letters for physical drives on
27+
Windows are letters of the US-English alphabet, this restriction
28+
does not apply to virtual drives assigned via subst <letter>:
29+
<path>. Git mistook such paths for relative paths, allowing writing
30+
outside of the worktree while cloning.
31+
32+
* CVE-2019-1352:
33+
Git was unaware of NTFS Alternate Data Streams, allowing files
34+
inside the .git/ directory to be overwritten during a clone.
35+
36+
* CVE-2019-1353:
37+
When running Git in the Windows Subsystem for Linux (also known as
38+
"WSL") while accessing a working directory on a regular Windows
39+
drive, none of the NTFS protections were active.
40+
41+
* CVE-2019-1354:
42+
Filenames on Linux/Unix can contain backslashes. On Windows,
43+
backslashes are directory separators. Git did not use to refuse to
44+
write out tracked files with such filenames.
45+
46+
* CVE-2019-1387:
47+
Recursive clones are currently affected by a vulnerability that is
48+
caused by too-lax validation of submodule names, allowing very
49+
targeted attacks via remote code execution in recursive clones.
50+
51+
Credit for finding these vulnerabilities goes to Microsoft Security
52+
Response Center, in particular to Nicolas Joly. The `fast-import`
53+
fixes were provided by Jeff King, the other fixes by Johannes
54+
Schindelin with help from Garima Singh.

Documentation/RelNotes/2.15.4.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
Git v2.15.4 Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appear in v2.14.6 to address
5+
the security issues CVE-2019-1348, CVE-2019-1349, CVE-2019-1350,
6+
CVE-2019-1351, CVE-2019-1352, CVE-2019-1353, CVE-2019-1354, and
7+
CVE-2019-1387; see the release notes for that version for details.
8+
9+
In conjunction with a vulnerability that was fixed in v2.20.2,
10+
`.gitmodules` is no longer allowed to contain entries of the form
11+
`submodule.<name>.update=!command`.

Documentation/RelNotes/2.16.6.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Git v2.16.6 Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appear in v2.14.6 and in
5+
v2.15.4 addressing the security issues CVE-2019-1348, CVE-2019-1349,
6+
CVE-2019-1350, CVE-2019-1351, CVE-2019-1352, CVE-2019-1353,
7+
CVE-2019-1354, and CVE-2019-1387; see the release notes for those
8+
versions for details.

Documentation/RelNotes/2.17.3.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Git v2.17.3 Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appear in v2.14.6 and in
5+
v2.15.4 addressing the security issues CVE-2019-1348, CVE-2019-1349,
6+
CVE-2019-1350, CVE-2019-1351, CVE-2019-1352, CVE-2019-1353,
7+
CVE-2019-1354, and CVE-2019-1387; see the release notes for those
8+
versions for details.
9+
10+
In addition, `git fsck` was taught to identify `.gitmodules` entries
11+
of the form `submodule.<name>.update=!command`, which have been
12+
disallowed in v2.15.4.

Documentation/RelNotes/2.18.2.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Git v2.18.2 Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appear in v2.14.6, v2.15.4
5+
and in v2.17.3, addressing the security issues CVE-2019-1348,
6+
CVE-2019-1349, CVE-2019-1350, CVE-2019-1351, CVE-2019-1352,
7+
CVE-2019-1353, CVE-2019-1354, and CVE-2019-1387; see the release notes
8+
for those versions for details.

Documentation/RelNotes/2.19.3.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Git v2.19.3 Release Notes
2+
=========================
3+
4+
This release merges up the fixes that appear in v2.14.6, v2.15.4
5+
and in v2.17.3, addressing the security issues CVE-2019-1348,
6+
CVE-2019-1349, CVE-2019-1350, CVE-2019-1351, CVE-2019-1352,
7+
CVE-2019-1353, CVE-2019-1354, and CVE-2019-1387; see the release notes
8+
for those versions for details.

Documentation/git-fast-import.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,21 @@ OPTIONS
5050
memory used by fast-import during this run. Showing this output
5151
is currently the default, but can be disabled with --quiet.
5252

53+
--allow-unsafe-features::
54+
Many command-line options can be provided as part of the
55+
fast-import stream itself by using the `feature` or `option`
56+
commands. However, some of these options are unsafe (e.g.,
57+
allowing fast-import to access the filesystem outside of the
58+
repository). These options are disabled by default, but can be
59+
allowed by providing this option on the command line. This
60+
currently impacts only the `export-marks`, `import-marks`, and
61+
`import-marks-if-exists` feature commands.
62+
+
63+
Only enable this option if you trust the program generating the
64+
fast-import stream! This option is enabled automatically for
65+
remote-helpers that use the `import` capability, as they are
66+
already trusted to run their own code.
67+
5368
Options for Frontends
5469
~~~~~~~~~~~~~~~~~~~~~
5570

Documentation/gitmodules.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,8 @@ submodule.<name>.update::
4444
submodule init` to initialize the configuration variable of
4545
the same name. Allowed values here are 'checkout', 'rebase',
4646
'merge' or 'none'. See description of 'update' command in
47-
linkgit:git-submodule[1] for their meaning. Note that the
48-
'!command' form is intentionally ignored here for security
49-
reasons.
47+
linkgit:git-submodule[1] for their meaning. For security
48+
reasons, the '!command' form is not accepted here.
5049

5150
submodule.<name>.branch::
5251
A remote branch name for tracking updates in the upstream submodule.

builtin/clone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,7 @@ static int checkout(int submodule_progress)
768768

769769
if (!err && (option_recurse_submodules.nr > 0)) {
770770
struct argv_array args = ARGV_ARRAY_INIT;
771-
argv_array_pushl(&args, "submodule", "update", "--init", "--recursive", NULL);
771+
argv_array_pushl(&args, "submodule", "update", "--require-init", "--recursive", NULL);
772772

773773
if (option_shallow_submodules == 1)
774774
argv_array_push(&args, "--depth=1");

builtin/submodule--helper.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include "diffcore.h"
1919
#include "diff.h"
2020
#include "object-store.h"
21+
#include "dir.h"
2122

2223
#define OPT_QUIET (1 << 0)
2324
#define OPT_CACHED (1 << 1)
@@ -1354,7 +1355,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)
13541355
char *p, *path = NULL, *sm_gitdir;
13551356
struct strbuf sb = STRBUF_INIT;
13561357
struct string_list reference = STRING_LIST_INIT_NODUP;
1357-
int dissociate = 0;
1358+
int dissociate = 0, require_init = 0;
13581359
char *sm_alternate = NULL, *error_strategy = NULL;
13591360

13601361
struct option module_clone_options[] = {
@@ -1381,6 +1382,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)
13811382
OPT__QUIET(&quiet, "Suppress output for cloning a submodule"),
13821383
OPT_BOOL(0, "progress", &progress,
13831384
N_("force cloning progress")),
1385+
OPT_BOOL(0, "require-init", &require_init,
1386+
N_("disallow cloning into non-empty directory")),
13841387
OPT_END()
13851388
};
13861389

@@ -1408,6 +1411,10 @@ static int module_clone(int argc, const char **argv, const char *prefix)
14081411
} else
14091412
path = xstrdup(path);
14101413

1414+
if (validate_submodule_git_dir(sm_gitdir, name) < 0)
1415+
die(_("refusing to create/use '%s' in another submodule's "
1416+
"git dir"), sm_gitdir);
1417+
14111418
if (!file_exists(sm_gitdir)) {
14121419
if (safe_create_leading_directories_const(sm_gitdir) < 0)
14131420
die(_("could not create directory '%s'"), sm_gitdir);
@@ -1419,6 +1426,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)
14191426
die(_("clone of '%s' into submodule path '%s' failed"),
14201427
url, path);
14211428
} else {
1429+
if (require_init && !access(path, X_OK) && !is_empty_dir(path))
1430+
die(_("directory not empty: '%s'"), path);
14221431
if (safe_create_leading_directories_const(path) < 0)
14231432
die(_("could not create directory '%s'"), path);
14241433
strbuf_addf(&sb, "%s/index", sm_gitdir);
@@ -1531,6 +1540,7 @@ struct submodule_update_clone {
15311540
int recommend_shallow;
15321541
struct string_list references;
15331542
int dissociate;
1543+
unsigned require_init;
15341544
const char *depth;
15351545
const char *recursive_prefix;
15361546
const char *prefix;
@@ -1549,7 +1559,7 @@ struct submodule_update_clone {
15491559
int max_jobs;
15501560
};
15511561
#define SUBMODULE_UPDATE_CLONE_INIT {0, MODULE_LIST_INIT, 0, \
1552-
SUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, 0, \
1562+
SUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, 0, 0, \
15531563
NULL, NULL, NULL, \
15541564
NULL, 0, 0, 0, NULL, 0, 0, 0}
15551565

@@ -1676,6 +1686,8 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
16761686
argv_array_pushl(&child->args, "--prefix", suc->prefix, NULL);
16771687
if (suc->recommend_shallow && sub->recommend_shallow == 1)
16781688
argv_array_push(&child->args, "--depth=1");
1689+
if (suc->require_init)
1690+
argv_array_push(&child->args, "--require-init");
16791691
argv_array_pushl(&child->args, "--path", sub->path, NULL);
16801692
argv_array_pushl(&child->args, "--name", sub->name, NULL);
16811693
argv_array_pushl(&child->args, "--url", url, NULL);
@@ -1866,6 +1878,8 @@ static int update_clone(int argc, const char **argv, const char *prefix)
18661878
OPT__QUIET(&suc.quiet, N_("don't print cloning progress")),
18671879
OPT_BOOL(0, "progress", &suc.progress,
18681880
N_("force cloning progress")),
1881+
OPT_BOOL(0, "require-init", &suc.require_init,
1882+
N_("disallow cloning into non-empty directory")),
18691883
OPT_END()
18701884
};
18711885

0 commit comments

Comments
 (0)