File tree 3 files changed +27
-4
lines changed
crates/cargo-test-support
3 files changed +27
-4
lines changed Original file line number Diff line number Diff line change @@ -28,8 +28,8 @@ pretty_env_logger = { version = "0.4", optional = true }
28
28
anyhow = " 1.0"
29
29
filetime = " 0.2.9"
30
30
flate2 = { version = " 1.0.3" , default-features = false , features = [" zlib" ] }
31
- git2 = " 0.14.2 "
32
- git2-curl = " 0.15 .0"
31
+ git2 = " 0.15.0 "
32
+ git2-curl = " 0.16 .0"
33
33
glob = " 0.3.0"
34
34
hex = " 0.4"
35
35
home = " 0.5"
@@ -41,7 +41,7 @@ jobserver = "0.1.24"
41
41
lazycell = " 1.2.0"
42
42
libc = " 0.2"
43
43
log = " 0.4.6"
44
- libgit2-sys = " 0.13.2 "
44
+ libgit2-sys = " 0.14.0 "
45
45
memchr = " 2.1.3"
46
46
opener = " 0.5"
47
47
os_info = " 3.5.0"
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ cargo-util = { path = "../cargo-util" }
14
14
snapbox = { version = " 0.3.0" , features = [" diff" , " path" ] }
15
15
filetime = " 0.2"
16
16
flate2 = { version = " 1.0" , default-features = false , features = [" zlib" ] }
17
- git2 = " 0.14.2 "
17
+ git2 = " 0.15.0 "
18
18
glob = " 0.3"
19
19
itertools = " 0.10.0"
20
20
lazy_static = " 1.0"
Original file line number Diff line number Diff line change @@ -255,4 +255,27 @@ fn init_git_transports(config: &Config) {
255
255
unsafe {
256
256
git2_curl:: register ( handle) ;
257
257
}
258
+
259
+ // Disabling the owner validation in git can, in theory, lead to code execution
260
+ // vulnerabilities. However, libgit2 does not launch executables, which is the foundation of
261
+ // the original security issue. Meanwhile, issues with refusing to load git repos in
262
+ // `CARGO_HOME` for example will likely be very frustrating for users. So, we disable the
263
+ // validation.
264
+ //
265
+ // For further discussion of Cargo's current interactions with git, see
266
+ //
267
+ // https://github.com/rust-lang/rfcs/pull/3279
268
+ //
269
+ // and in particular the subsection on "Git support".
270
+ //
271
+ // Note that we only disable this when Cargo is run as a binary. If Cargo is used as a library,
272
+ // this code won't be invoked. Instead, developers will need to explicitly disable the
273
+ // validation in their code. This is inconvenient, but won't accidentally open consuming
274
+ // applications up to security issues if they use git2 to open repositories elsewhere in their
275
+ // code.
276
+ unsafe {
277
+ if git2:: opts:: set_verify_owner_validation ( false ) . is_err ( ) {
278
+ return ;
279
+ }
280
+ }
258
281
}
You can’t perform that action at this time.
0 commit comments