From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH v2 1/4] apply: reject input that touches outside $cwd
Date: Mon, 2 Feb 2015 19:45:08 -0500 [thread overview]
Message-ID: <20150203004507.GA31946@peff.net> (raw)
In-Reply-To: <1422919650-13346-2-git-send-email-gitster@pobox.com>
On Mon, Feb 02, 2015 at 03:27:27PM -0800, Junio C Hamano wrote:
> By default, a patch that affects outside the working area is
> rejected as a mistake (or a mischief); Git itself does not create
> such a patch, unless the user bends backwards and specifies a
> non-standard prefix to "git diff" and friends.
>
> When `git apply` is used without either `--index` or `--cached`
> option as a "better GNU patch", the user can pass `--unsafe-paths`
> option to override this safety check. This cannot be used to escape
> outside the working tree when using `--index` or `--cached` to apply
> the patch to the index.
>
> The new test was stolen from Jeff King with slight enhancements.
I notice that this includes the symlink-crossing tests, marked as
failures. Reading the series, I know what is going to happen later, but
do you want to leave a note like:
Note that we also add tests for leaving the working directory by
crossing symlink boundaries, which is not addressed in this patch.
That is a separate issue caused following symlinks, which will come
later.
or something to help later readers of "git log"?
> +--unsafe-paths::
> + By default, a patch that affects outside the working area is
> + rejected as a mistake (or a mischief); Git itself never
> + creates such a patch unless the user bends backwards and
> + specifies nonstandard prefix to "git diff" and friends.
Minor wordsmithing: the usual idiom is "bend over backwards", and you
probably want s/specifies/& a/.
> ++
> +When `git apply` is used without either `--index` or `--cached`
> +option as a "better GNU patch", the user can pass `--unsafe-paths`
> +option to override this safety check.
Similarly, probably every instance of "foo option" would read better as
"the foo option".
> This cannot be used to escape
> +outside the working tree when using `--index` or `--cached` to apply
> +the patch to the index.
I had trouble figuring out what this meant. Would it be simpler to just
say:
This option has no effect when `--index` or `--cached` is in use.
Or is there some other subtlety that you are trying to convey that I am
missing?
-Peff
next prev parent reply other threads:[~2015-02-03 0:45 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 [this message]
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
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=20150203004507.GA31946@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.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.
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 NNTP newsgroup(s).