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

Re: [PATCH v4 4/6] list-objects: filter objects in traverse_commit_list

From
Jeff King <peff@peff.net>
Date
Nov 16, 2017, 21:57 UTC
Message-ID
<20171116215725.k44e3alk2lq6bbwu@sigill.intra.peff.net>
In-Reply-To
<bdf75d90-570d-8cf0-886a-2c5c9cdba1c1@jeffhostetler.com>
On Thu, Nov 16, 2017 at 04:49:08PM -0500, Jeff Hostetler wrote:
Show 20 quoted lines
> > First of all, about the injection problem, replying to your previous e-mail
> > [1]:
> > 
> > https://public-inbox.org/git/61855872-221b-0e97-abaa-24a011ad899e@jeffhostetler.com/
> > 
> > > I couldn't use quote.[ch] because it is more concerned with
> > > quoting pathnames because of LF and CR characters within
> > > them -- rather than semicolons and quotes and the like which
> > > I was concerned about.
> > 
> > sq_quote_buf() (or one of the other similarly-named functions) should
> > solve this problem, right? The single quotes around the argument takes
> > care of LF, CR, and semicolons, and things like backslashes and quotes
> > are taken care of as documented.
> > 
> > I don't think we need to invent another encoding to solve this.
> 
> I'll take another look, sq_quote_buf() looks like it might work.
> I was looking at quote_c_style() and that didn't seem right for
> my needs.  Thanks.

I admit I haven't been following this thread closely, but I couldn't seem to find any indication of exactly which interfaces need quoting, or who is expected to unquote (here or in the previous iterations).

It sounds like you're worried about shell injection, but shouldn't we worry about that the actual shell boundary? Likewise, if these values are being passed over the git protocol, shouldn't that part of the protocol be designed to encode arbitrary bytes?

Those encodings don't necessarily need to be the same, because they're about transport. Inside each process we'd have the raw bytes, and encode them as appropriate to whatever sub-program we're going to pass to (or not at all if we skip the shell for sub-processes, which is usually a good idea).

I have the feeling I'm missing something.
-Peff
Previous: Jeff HostetlerNext: Junio C Hamano
Message 13 of 16 in “Partial clone part 1: object filtering”
  1. 0/6 Partial clone part 1: object filteringJeff Hostetler, Nov 16, 2017
  2. 1/6 dir: allow exclusions from blob in addition to fileJeff Hostetler, Nov 16, 2017
  3. 3/6 oidset: add iterator methods to oidsetJeff Hostetler, Nov 16, 2017
  4. 2/6 oidmap: add oidmap iterator methodsJeff Hostetler, Nov 16, 2017
  5. 5/6 rev-list: add list-objects filtering supportJeff Hostetler, Nov 16, 2017
  6. Jonathan TanNov 16, 2017
  7. Junio C HamanoNov 17, 2017
  8. Jeff HostetlerNov 17, 2017
  9. 6/6 pack-objects: add list-objects filteringJeff Hostetler, Nov 16, 2017
  10. 4/6 list-objects: filter objects in traverse_commit_listJeff Hostetler, Nov 16, 2017
  11. Jonathan TanNov 16, 2017
  12. Jeff HostetlerNov 16, 2017
  13. Jeff KingNov 16, 2017
  14. Junio C HamanoNov 17, 2017
  15. Jeff HostetlerNov 17, 2017
  16. Jeff KingNov 17, 2017

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.