⚠ This page is served via a proxy. Original site: https://github.com
This service does not collect credentials or authentication data.
Skip to content

Commit 91c9b95

Browse files
committed
git_connect: avoid full shell when executing git-upload-pack
When the `git-upload-pack` program needs to be called, we do not actually need to run this through a shell... This reduces the security surface of running Git on servers a bit. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 6ba2ebc commit 91c9b95

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

connect.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1512,7 +1512,14 @@ struct child_process *git_connect(int fd[2], const char *url,
15121512
version);
15131513
}
15141514
}
1515-
strvec_push(&conn->args, cmd.buf);
1515+
if (!conn->use_shell || conn->args.nr > 0 ||
1516+
does_cmd_require_shell(prog))
1517+
strvec_push(&conn->args, cmd.buf);
1518+
else {
1519+
/* avoid running through shell; it's unnecessary */
1520+
strvec_pushl(&conn->args, prog, path, NULL);
1521+
conn->use_shell = 0;
1522+
}
15161523

15171524
if (start_command(conn))
15181525
die(_("unable to fork"));

0 commit comments

Comments
 (0)