Git 2.10.4
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAABCAAGBQJZflbsAAoJELC16IaWr+bLUUAQAONDi4Ty/I9K79Nwv9/15HcV 4oMfCC56Y8nLUs83GsS0aZadX15iABsOACtZUA0kPQB8PV2XYcUnM6rPFtpeovRI sfs0XqfK5l+cVDoMMb2sGAfQYEBIXRy8sUb1EXIuJ4MzHxfRbmm1sKd7ko3lg6hN JHhGsNpzIVRspuUZh+yXp0Qa8CKKnekhwEntVd5b71eahG3lJNBO7UXvDAkDyl33 amoc5eqKdoGvjs3yYBvOV0qX8ePV53wieKwL5uBG6LdjMrjtWpLJOuMk6IYR18Sm ++A+WiCb14lQ/6Wfu+r7WhjaWIXHHMPV/5YMhm1OzrWKiw+DuucLVaorl3cSPA2G zNPoHGUGxfnKz0NLiMkpbjUfB0gYqqLKts5pcnKeTconUcLZlpYKEYNpypfgbJyr XvIgkjAt3KwRa8mrGvCURkelmYKzFzd+hZdxvXiJ/flk4CcssgMgYorWCMwwy86a uErlgWDcGh9wtV9Pwy8M7EwXcRDggBND5jqH2dpFUaQ+8Kzm11lX5BRseZIOASzL ++MuZGEQiETz2HkWb+DWMIDAJMej2N2DF1eq7DnsmEUZgOarf2ZP3Lsd84W43WLI PdLhA1zpL2YVz9EEeFT/hLSX3fC16+lkeVQhtV5pJlIiLumHOdWYBElsnX694Nv3 JTE4X1l38kCBQ4on8eEo =R9MM -----END PGP SIGNATURE----- Merge tag 'v2.10.4' into maint-2.11 Git 2.10.4maint
						commit
						05bb78abc1
					
				|  | @ -0,0 +1,4 @@ | |||
| Git v2.10.4 Release Notes | ||||
| ========================= | ||||
|  | ||||
| This release forward-ports the fix for "ssh://..." URL from Git v2.7.6 | ||||
|  | @ -0,0 +1,25 @@ | |||
| Git v2.7.6 Release Notes | ||||
| ======================== | ||||
|  | ||||
| Fixes since v2.7.5 | ||||
| ------------------ | ||||
|  | ||||
|  * A "ssh://..." URL can result in a "ssh" command line with a | ||||
|    hostname that begins with a dash "-", which would cause the "ssh" | ||||
|    command to instead (mis)treat it as an option.  This is now | ||||
|    prevented by forbidding such a hostname (which will not be | ||||
|    necessary in the real world). | ||||
|  | ||||
|  * Similarly, when GIT_PROXY_COMMAND is configured, the command is | ||||
|    run with host and port that are parsed out from "ssh://..." URL; | ||||
|    a poorly written GIT_PROXY_COMMAND could be tricked into treating | ||||
|    a string that begins with a dash "-".  This is now prevented by | ||||
|    forbidding such a hostname and port number (again, which will not | ||||
|    be necessary in the real world). | ||||
|  | ||||
|  * In the same spirit, a repository name that begins with a dash "-" | ||||
|    is also forbidden now. | ||||
|  | ||||
| Credits go to Brian Neel at GitLab, Joern Schneeweisz of Recurity | ||||
| Labs and Jeff King at GitHub. | ||||
|  | ||||
|  | @ -0,0 +1,4 @@ | |||
| Git v2.8.6 Release Notes | ||||
| ======================== | ||||
|  | ||||
| This release forward-ports the fix for "ssh://..." URL from Git v2.7.6 | ||||
|  | @ -0,0 +1,4 @@ | |||
| Git v2.9.5 Release Notes | ||||
| ======================== | ||||
|  | ||||
| This release forward-ports the fix for "ssh://..." URL from Git v2.7.6 | ||||
							
								
								
									
										8
									
								
								cache.h
								
								
								
								
							
							
						
						
									
										8
									
								
								cache.h
								
								
								
								
							|  | @ -1108,6 +1108,14 @@ char *strip_path_suffix(const char *path, const char *suffix); | |||
| int daemon_avoid_alias(const char *path); | ||||
| extern int is_ntfs_dotgit(const char *name); | ||||
|  | ||||
| /* | ||||
|  * Returns true iff "str" could be confused as a command-line option when | ||||
|  * passed to a sub-program like "ssh". Note that this has nothing to do with | ||||
|  * shell-quoting, which should be handled separately; we're assuming here that | ||||
|  * the string makes it verbatim to the sub-program. | ||||
|  */ | ||||
| int looks_like_command_line_option(const char *str); | ||||
|  | ||||
| /** | ||||
|  * Return a newly allocated string with the evaluation of | ||||
|  * "$XDG_CONFIG_HOME/git/$filename" if $XDG_CONFIG_HOME is non-empty, otherwise | ||||
|  |  | |||
							
								
								
									
										11
									
								
								connect.c
								
								
								
								
							
							
						
						
									
										11
									
								
								connect.c
								
								
								
								
							|  | @ -577,6 +577,11 @@ static struct child_process *git_proxy_connect(int fd[2], char *host) | |||
|  | ||||
| 	get_host_and_port(&host, &port); | ||||
|  | ||||
| 	if (looks_like_command_line_option(host)) | ||||
| 		die("strange hostname '%s' blocked", host); | ||||
| 	if (looks_like_command_line_option(port)) | ||||
| 		die("strange port '%s' blocked", port); | ||||
|  | ||||
| 	proxy = xmalloc(sizeof(*proxy)); | ||||
| 	child_process_init(proxy); | ||||
| 	argv_array_push(&proxy->args, git_proxy_command); | ||||
|  | @ -759,6 +764,9 @@ struct child_process *git_connect(int fd[2], const char *url, | |||
| 		conn = xmalloc(sizeof(*conn)); | ||||
| 		child_process_init(conn); | ||||
|  | ||||
| 		if (looks_like_command_line_option(path)) | ||||
| 			die("strange pathname '%s' blocked", path); | ||||
|  | ||||
| 		strbuf_addstr(&cmd, prog); | ||||
| 		strbuf_addch(&cmd, ' '); | ||||
| 		sq_quote_buf(&cmd, path); | ||||
|  | @ -791,6 +799,9 @@ struct child_process *git_connect(int fd[2], const char *url, | |||
| 				return NULL; | ||||
| 			} | ||||
|  | ||||
| 			if (looks_like_command_line_option(ssh_host)) | ||||
| 				die("strange hostname '%s' blocked", ssh_host); | ||||
|  | ||||
| 			ssh = get_ssh_command(); | ||||
| 			if (!ssh) { | ||||
| 				const char *base; | ||||
|  |  | |||
							
								
								
									
										5
									
								
								path.c
								
								
								
								
							
							
						
						
									
										5
									
								
								path.c
								
								
								
								
							|  | @ -1257,6 +1257,11 @@ int is_ntfs_dotgit(const char *name) | |||
| 		} | ||||
| } | ||||
|  | ||||
| int looks_like_command_line_option(const char *str) | ||||
| { | ||||
| 	return str && str[0] == '-'; | ||||
| } | ||||
|  | ||||
| char *xdg_config_home(const char *filename) | ||||
| { | ||||
| 	const char *home, *config_home; | ||||
|  |  | |||
|  | @ -43,4 +43,9 @@ test_expect_success 'fetch through proxy works' ' | |||
| 	test_cmp expect actual | ||||
| ' | ||||
|  | ||||
| test_expect_success 'funny hostnames are rejected before running proxy' ' | ||||
| 	test_must_fail git fetch git://-remote/repo.git 2>stderr && | ||||
| 	! grep "proxying for" stderr | ||||
| ' | ||||
|  | ||||
| test_done | ||||
|  |  | |||
|  | @ -11,4 +11,27 @@ test_expect_success 'setup repository to clone' ' | |||
| test_proto "file://" file "file://$PWD" | ||||
| test_proto "path" file . | ||||
|  | ||||
| test_expect_success 'setup repo with dash' ' | ||||
| 	git init --bare repo.git && | ||||
| 	git push repo.git HEAD && | ||||
| 	mv repo.git "$PWD/-repo.git" | ||||
| ' | ||||
|  | ||||
| # This will fail even without our rejection because upload-pack will | ||||
| # complain about the bogus option. So let's make sure that GIT_TRACE | ||||
| # doesn't show us even running upload-pack. | ||||
| # | ||||
| # We must also be sure to use "fetch" and not "clone" here, as the latter | ||||
| # actually canonicalizes our input into an absolute path (which is fine | ||||
| # to allow). | ||||
| test_expect_success 'repo names starting with dash are rejected' ' | ||||
| 	rm -f trace.out && | ||||
| 	test_must_fail env GIT_TRACE="$PWD/trace.out" git fetch -- -repo.git && | ||||
| 	! grep upload-pack trace.out | ||||
| ' | ||||
|  | ||||
| test_expect_success 'full paths still work' ' | ||||
| 	git fetch "$PWD/-repo.git" | ||||
| ' | ||||
|  | ||||
| test_done | ||||
|  |  | |||
|  | @ -17,4 +17,27 @@ test_proto "host:path" ssh "remote:repo.git" | |||
| test_proto "ssh://" ssh "ssh://remote$PWD/remote/repo.git" | ||||
| test_proto "git+ssh://" ssh "git+ssh://remote$PWD/remote/repo.git" | ||||
|  | ||||
| # Don't even bother setting up a "-remote" directory, as ssh would generally | ||||
| # complain about the bogus option rather than completing our request. Our | ||||
| # fake wrapper actually _can_ handle this case, but it's more robust to | ||||
| # simply confirm from its output that it did not run at all. | ||||
| test_expect_success 'hostnames starting with dash are rejected' ' | ||||
| 	test_must_fail git clone ssh://-remote/repo.git dash-host 2>stderr && | ||||
| 	! grep ^ssh: stderr | ||||
| ' | ||||
|  | ||||
| test_expect_success 'setup repo with dash' ' | ||||
| 	git init --bare remote/-repo.git && | ||||
| 	git push remote/-repo.git HEAD | ||||
| ' | ||||
|  | ||||
| test_expect_success 'repo names starting with dash are rejected' ' | ||||
| 	test_must_fail git clone remote:-repo.git dash-path 2>stderr && | ||||
| 	! grep ^ssh: stderr | ||||
| ' | ||||
|  | ||||
| test_expect_success 'full paths still work' ' | ||||
| 	git clone "remote:$PWD/remote/-repo.git" dash-path | ||||
| ' | ||||
|  | ||||
| test_done | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	 Junio C Hamano
						Junio C Hamano