From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2 1/4] apply: reject input that touches outside $cwd
Date: Tue, 03 Feb 2015 13:40:12 -0800 [thread overview]
Message-ID: <xmqqpp9qptc3.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20150203212450.GC20594@peff.net> (Jeff King's message of "Tue, 3 Feb 2015 16:24:50 -0500")
Jeff King <peff@peff.net> writes:
> But wouldn't we still fail writing "foo/bar" at that point if "foo" is a
> regular file (again, we should never do this, but that is the point of
> the test).
The point of the test is not to create foo, whether it is a symlink
or an emulating regular file, in the first place.
In this piece:
>> +test_expect_failure 'symlink escape via ..' '
>> + {
>> + mkpatch_symlink tmp .. &&
This is a patch to create "tmp" that points at ".."
>> + mkpatch_add tmp/foo ../foo
And this is a patch to create "tmp/foo", and make sure ../foo does
not exist in the filesystem to prepare for the test.
>> + } >patch &&
>> + test_must_fail git apply patch &&
And this patch, if the rejection logic were to be broken in the
future, might create "tmp" and then try to follow it to affect
"../foo".
>> + test_path_is_missing ../foo
So if this test makes sure if "tmp" is missing, then it would be
alright, no? The "follow the symlink to affect ../foo" may not
happen on a filesystem without symlinks, but verifying that "tmp"
is missing will assure us that the patch application is atomic,
i.e. if we see "tmp" on the filesystem after seeing "git apply"
failed, that is a sign that "git apply" failed to be atomic.
next prev parent reply other threads:[~2015-02-03 21:40 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-02 23:27 [PATCH v2 0/4] "git apply" safety Junio C Hamano
2015-02-02 23:27 ` [PATCH v2 1/4] apply: reject input that touches outside $cwd Junio C Hamano
2015-02-03 0:45 ` Jeff King
2015-02-03 0:50 ` Jeff King
2015-02-03 20:23 ` Junio C Hamano
2015-02-03 21:01 ` Jeff King
2015-02-03 21:23 ` Junio C Hamano
2015-02-03 21:24 ` Jeff King
2015-02-03 21:40 ` Junio C Hamano [this message]
2015-02-03 21:50 ` Jeff King
2015-02-03 22:11 ` Junio C Hamano
2015-02-03 5:56 ` Torsten Bögershausen
2015-02-02 23:27 ` [PATCH v2 2/4] apply: do not read from the filesystem under --index Junio C Hamano
2015-02-02 23:27 ` [PATCH v2 3/4] apply: do not read from beyond a symbolic link Junio C Hamano
2015-02-03 0:08 ` Stefan Beller
2015-02-03 19:37 ` Junio C Hamano
2015-02-03 19:44 ` Stefan Beller
2015-02-03 20:31 ` Junio C Hamano
2015-02-02 23:27 ` [PATCH v2 4/4] apply: do not touch a file " Junio C Hamano
2015-02-03 1:11 ` Jeff King
2015-02-03 1:56 ` Junio C Hamano
2015-02-03 2:04 ` Jeff King
2015-02-03 21:01 ` Junio C Hamano
2015-02-03 23:40 ` Eric Sunshine
2015-02-04 0:44 ` [PATCH v3 0/4] "git apply" safety Junio C Hamano
2015-02-04 0:44 ` [PATCH v3 1/4] apply: reject input that touches outside the working area Junio C Hamano
2015-02-04 0:44 ` [PATCH v3 2/4] apply: do not read from the filesystem under --index Junio C Hamano
2015-02-04 0:44 ` [PATCH v3 3/4] apply: do not read from beyond a symbolic link Junio C Hamano
2015-02-04 0:44 ` [PATCH v3 4/4] apply: do not touch a file " Junio C Hamano
2015-02-10 22:36 ` [PATCH v4 0/4] "git apply" safety Junio C Hamano
2015-02-10 22:36 ` [PATCH v4 1/4] apply: reject input that touches outside the working area Junio C Hamano
2015-02-10 22:36 ` [PATCH v4 2/4] apply: do not read from the filesystem under --index Junio C Hamano
2015-02-10 22:36 ` [PATCH v4 3/4] apply: do not read from beyond a symbolic link Junio C Hamano
2015-02-10 22:36 ` [PATCH v4 4/4] apply: do not touch a file " 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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqpp9qptc3.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.