]> git.ipfire.org Git - thirdparty/git.git/commit
remote-mediawiki: use "sh" to eliminate unquoted commands
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>
Mon, 21 Sep 2020 10:40:00 +0000 (12:40 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 21 Sep 2020 19:37:38 +0000 (12:37 -0700)
commit9a8606465e81a04d58c20324c402ba3464bc706a
tree7a4aa1b4c4da0c6bf3a57486fff2fe035b845149
parent878d150106b0050253390623a8fd5acf553f4be0
remote-mediawiki: use "sh" to eliminate unquoted commands

Remove the use of run_git_unquoted() completely with a use of "sh -c"
suggested by Jeff King, i.e.:

    sh -c '"$@" 2>/dev/null' -- echo sneaky 'argument;id'

I don't think this is needed now for any potential RCE issue. The
$remotename argument is ultimately picked by the local user (and
similarly, the $local variable comes from a user-supplied
refspec).

But completely eliminating the use of unquoted shell arguments has a
value in and of itself, by making the code easier to review. As noted
in an earlier commit I think the use of IPC::Open3 would be too
verbose here, but this "sh -c" trick strikes the right balance between
readability and semantic sanity.

Suggested-by: Jeff King <peff@peff.net>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/mw-to-git/git-remote-mediawiki.perl