git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [RFC PATCH] list-objects-filter: disable 'sparse:path' filters

From
JHJeff Hostetler <git@jeffhostetler.com>
Date
May 24, 2019, 19:33 UTC
Message-ID
<3ac687d6-d534-13c8-db9a-f481403634d1@jeffhostetler.com>
In-Reply-To
<20190524120318.4851-1-chriscool@tuxfamily.org>
On 5/24/2019 8:03 AM, Christian Couder wrote:
Show 43 quoted lines
> 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
[...]
We should update git-completion.bash to remove this option.
Jeff
Previous: Christian Couder
Message 9 of 9 in “list-objects-filter: disable 'sparse:path' filters”
  1. list-objects-filter: disable 'sparse:path' filtersChristian Couder, May 24, 2019
  2. Ævar Arnfjörð BjarmasonMay 24, 2019
  3. Christian CouderMay 24, 2019
  4. Jeff HostetlerMay 24, 2019
  5. Jeff KingMay 28, 2019
  6. Jeff HostetlerMay 28, 2019
  7. Matthew DeVoreMay 24, 2019
  8. Christian CouderMay 24, 2019
  9. Jeff HostetlerMay 24, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.