From e693237e2ba27b6129e8af7f6a794f5c2fbd26f3 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Wed, 29 May 2019 14:44:32 +0200 Subject: list-objects-filter: disable 'sparse:path' filters If someone wants to use as a filter a sparse file that is in the repository, something like "--filter=sparse:oid=:" 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. Helped-by: Matthew DeVore Helped-by: Jeff Hostetler Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- list-objects-filter-options.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'list-objects-filter-options.c') diff --git a/list-objects-filter-options.c b/list-objects-filter-options.c index c0036f7378..a15d0f7829 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 support has been dropped")); + } + return 1; } /* * Please update _git_fetch() in git-completion.bash when you @@ -136,7 +139,6 @@ void list_objects_filter_release( { free(filter_options->filter_spec); free(filter_options->sparse_oid_value); - free(filter_options->sparse_path_value); memset(filter_options, 0, sizeof(*filter_options)); } -- cgit v1.2.3