From: Christian Couder <christian.couder@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>, Jeff King <peff@peff.net>,
Jeff Hostetler <jeffhost@microsoft.com>,
Jeff Hostetler <git@jeffhostetler.com>,
Jonathan Tan <jonathantanmy@google.com>,
Matthew DeVore <matvore@google.com>,
Christian Couder <chriscool@tuxfamily.org>
Subject: [RFC PATCH] list-objects-filter: disable 'sparse:path' filters
Date: Fri, 24 May 2019 14:03:18 +0200 [thread overview]
Message-ID: <20190524120318.4851-1-chriscool@tuxfamily.org> (raw)
If someone wants to use as a filter a sparse file that is in the
repository, something like "--filter=sparse:oid=<ref>:<path>"
already works.
So 'sparse:path' is only interesting if the sparse file is not in
the repository. In this case though the current implementation has
a big security issue, as it makes it possible to ask the server to
read any file, like for example /etc/password, and to explore the
filesystem, as well as individual lines of files.
If someone is interested in using a sparse file that is not in the
repository as a filter, then at the minimum a config option, such
as "uploadpack.sparsePathFilter", should be implemented first to
restrict the directory from which the files specified by
'sparse:path' can be read.
For now though, let's just disable 'sparse:path' filters.
---
list-objects-filter-options.c | 9 ++++++---
list-objects-filter-options.h | 2 --
list-objects-filter.c | 22 ----------------------
3 files changed, 6 insertions(+), 27 deletions(-)
diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c
index c0036f7378..007c104b93 100644
--- a/list-objects-filter-options.c
+++ b/list-objects-filter-options.c
@@ -78,9 +78,12 @@ static int gently_parse_list_objects_filter(
return 0;
} else if (skip_prefix(arg, "sparse:path=", &v0)) {
- filter_options->choice = LOFC_SPARSE_PATH;
- filter_options->sparse_path_value = strdup(v0);
- return 0;
+ if (errbuf) {
+ strbuf_addstr(
+ errbuf,
+ _("sparse:path filters are now disabled"));
+ }
+ return 1;
}
/*
* Please update _git_fetch() in git-completion.bash when you
diff --git a/list-objects-filter-options.h b/list-objects-filter-options.h
index e3adc78ebf..c54f0000fb 100644
--- a/list-objects-filter-options.h
+++ b/list-objects-filter-options.h
@@ -13,7 +13,6 @@ enum list_objects_filter_choice {
LOFC_BLOB_LIMIT,
LOFC_TREE_DEPTH,
LOFC_SPARSE_OID,
- LOFC_SPARSE_PATH,
LOFC__COUNT /* must be last */
};
@@ -44,7 +43,6 @@ struct list_objects_filter_options {
* choice.
*/
struct object_id *sparse_oid_value;
- char *sparse_path_value;
unsigned long blob_limit_value;
unsigned long tree_exclude_depth;
};
diff --git a/list-objects-filter.c b/list-objects-filter.c
index ee449de3f7..53f90442c5 100644
--- a/list-objects-filter.c
+++ b/list-objects-filter.c
@@ -478,27 +478,6 @@ static void *filter_sparse_oid__init(
return d;
}
-static void *filter_sparse_path__init(
- struct oidset *omitted,
- struct list_objects_filter_options *filter_options,
- filter_object_fn *filter_fn,
- filter_free_fn *filter_free_fn)
-{
- struct filter_sparse_data *d = xcalloc(1, sizeof(*d));
- d->omits = omitted;
- if (add_excludes_from_file_to_list(filter_options->sparse_path_value,
- NULL, 0, &d->el, NULL) < 0)
- die("could not load filter specification");
-
- ALLOC_GROW(d->array_frame, d->nr + 1, d->alloc);
- d->array_frame[d->nr].defval = 0; /* default to include */
- d->array_frame[d->nr].child_prov_omit = 0;
-
- *filter_fn = filter_sparse;
- *filter_free_fn = filter_sparse_free;
- return d;
-}
-
typedef void *(*filter_init_fn)(
struct oidset *omitted,
struct list_objects_filter_options *filter_options,
@@ -514,7 +493,6 @@ static filter_init_fn s_filters[] = {
filter_blobs_limit__init,
filter_trees_depth__init,
filter_sparse_oid__init,
- filter_sparse_path__init,
};
void *list_objects_filter__init(
--
2.22.0.rc1
next reply other threads:[~2019-05-24 12:03 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-24 12:03 Christian Couder [this message]
2019-05-24 12:21 ` [RFC PATCH] list-objects-filter: disable 'sparse:path' filters Ævar Arnfjörð Bjarmason
2019-05-24 12:39 ` Christian Couder
2019-05-24 18:46 ` Jeff Hostetler
2019-05-28 6:13 ` Jeff King
2019-05-28 13:29 ` Jeff Hostetler
2019-05-24 17:07 ` Matthew DeVore
2019-05-24 19:43 ` Christian Couder
2019-05-24 19:33 ` Jeff Hostetler
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=20190524120318.4851-1-chriscool@tuxfamily.org \
--to=christian.couder@gmail.com \
--cc=chriscool@tuxfamily.org \
--cc=git@jeffhostetler.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jeffhost@microsoft.com \
--cc=jonathantanmy@google.com \
--cc=matvore@google.com \
--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.
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).