From: Jonathan Nieder <jrnieder@gmail.com>
To: Stefan Beller <sbeller@google.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] t7406: submodule.<name>.update command must not be run from .gitmodules
Date: Mon, 25 Sep 2017 13:04:48 -0700 [thread overview]
Message-ID: <20170925200448.GY27425@aiede.mtv.corp.google.com> (raw)
In-Reply-To: <20170925195533.15172-1-sbeller@google.com>
Stefan Beller wrote:
> submodule.<name>.update can be assigned an arbitrary command via setting
> it to "!command". When this command is found in the regular config, Git
> ought to just run that command instead of other update mechanisms.
>
> However if that command is just found in the .gitmodules file, it is
> potentially untrusted, which is why we do not run it. Add a test
> confirming the behavior.
>
> Suggested-by: Jonathan Nieder <jrnieder@gmail.com>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> t/t7406-submodule-update.sh | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh
> index 034914a14f..780af4e6f5 100755
> --- a/t/t7406-submodule-update.sh
> +++ b/t/t7406-submodule-update.sh
> @@ -406,6 +406,16 @@ test_expect_success 'submodule update - command in .git/config' '
> )
> '
>
> +test_expect_success 'submodule update - command in .gitmodules is ignored' '
> + test_when_finished "git -C super reset --hard HEAD^" &&
> +
> + git -C super config -f .gitmodules submodule.submodule.update "!false || echo >bad" &&
What does the '!false || echo >bad' do?
Ideally we want this test to be super robust: e.g. if it runs the
command but from a different directory, we still want the test to fail,
and if it runs the command but using exec instead of a shell, we still
want the test to fail.
Maybe write_script would help with this. E.g. would something like
test_when_finished ... &&
write_script must_not_run.sh <<-EOF &&
>$TEST_DIRECTORY/bad
EOF
git -C super config -f .gitmodules submodule.submodule.update \
"!$TEST_DIRECTORY/must_not_run.sh" &&
...
work?
Thanks,
Jonathan
next prev parent reply other threads:[~2017-09-25 20:04 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-25 19:55 [PATCH] t7406: submodule.<name>.update command must not be run from .gitmodules Stefan Beller
2017-09-25 20:04 ` Jonathan Nieder [this message]
2017-09-25 22:50 ` Stefan Beller
2017-09-26 0:01 ` Jonathan Nieder
2017-09-26 5:37 ` Johannes Sixt
2017-09-26 6:28 ` Junio C Hamano
2017-09-26 18:54 ` Stefan Beller
2017-09-26 19:46 ` Johannes Sixt
2017-09-26 19:54 ` Stefan Beller
2017-09-27 3:21 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170925200448.GY27425@aiede.mtv.corp.google.com \
--to=jrnieder@gmail.com \
--cc=git@vger.kernel.org \
--cc=sbeller@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).