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

Re: [PATCH] http: match headers case-insensitively when redacting

From
Jeff King <peff@peff.net>
Date
Sep 22, 2021, 21:18 UTC
Message-ID
<YUudqYmzy9N3e0Bk@coredump.intra.peff.net>
In-Reply-To
<xmqqk0j85o6c.fsf@gitster.g>
On Wed, Sep 22, 2021 at 01:51:39PM -0700, Junio C Hamano wrote:
Show 14 quoted lines
> >> Neither pattern of the above two will not match the HTTP/2 one, so
> >> the first one would report "there is no leakage of Auth with a
> >> caplital letter"; the second one may see only one pre-upgrade Auth
> >> with a capital letter, but as long as it does find one, it should be
> >> happy, no?
> >> 
> >> I am a bit puzzled how the test gets confused.
> >
> > The first one matches nothing, because the HTTP/2 one which fails to
> > redact has a lower-case "A". The second one _does_ match, because ...
> 
> I thought we were talking about the original case sensitive test
> getting confused when testing the software that is fixed,
> i.e. HTTP/2 lowercase "authorization" line properly redacted.

No, sorry. I meant: before the fix, even if we were running HTTP/2, the test does not detect the bug. And thus it is hard to realize that the fix is indeed making the bug go away. :)

Show 14 quoted lines
> > I get (with some extraneous headers omitted):
> > ...
> >   => Send header: GET /auth/smart/repo.git/info/refs?service=git-upload-pack HTTP/1.1
> >   => Send header: Authorization: Basic <redacted>
> 
> So, this is what we see in HTTP/1.1 (with capitalization).  And then
> ...
> 
> > ...
> >   => Send header: POST /auth/smart/repo.git/git-upload-pack HTTP/2
> >   => Send header: authorization: Basic dXNlckBob3N0OnBhc3NAaG9zdA==
> 
> this one, once the redaction code is fixed by applying this patch,
> would show that we redacted it, too, no?

Correct. But the test, without switching to "grep -i", does not realize that.

Show 10 quoted lines
> With or without the fix in the code, I agree that neither of the two
> "grep" patterns without "grep -i" change will match this line.  So
> the end result is that the test finds no unredacted line, and one
> redacted one (instead of two).
> 
> I agree that it is *not* testing what we want to test, and if you
> said so, I wouldn't have been puzzled.  I just wanted to know if
> there is something _else_ (other than "gee, we are not testing the
> HTTP/2 case at all") going on that I failed to read in your
> "... gets confused".

No, I think we are on the same page now. Do you want me to take another stab at writing the commit message to clarify things (i.e., do we think it's badly written, or was it just mis-interpreted)?

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 19 of 22 in “http: match headers case-insensitively when redacting”
  1. http: match headers case-insensitively when redactingJeff King, Sep 21, 2021
  2. Jeff KingSep 21, 2021
  3. Carlo ArenasSep 21, 2021
  4. Jeff KingSep 21, 2021
  5. Daniel StenbergSep 21, 2021
  6. Jeff KingSep 22, 2021
  7. Eric SunshineSep 21, 2021
  8. Jeff KingSep 21, 2021
  9. Junio C HamanoSep 22, 2021
  10. Taylor BlauSep 21, 2021
  11. Jeff KingSep 22, 2021
  12. Bagas SanjayaSep 22, 2021
  13. Jeff KingSep 22, 2021
  14. Ævar Arnfjörð BjarmasonSep 23, 2021
  15. Jeff KingSep 23, 2021
  16. Junio C HamanoSep 22, 2021
  17. Jeff KingSep 22, 2021
  18. Junio C HamanoSep 22, 2021
  19. Jeff KingSep 22, 2021
  20. Junio C HamanoSep 22, 2021
  21. http: match headers case-insensitively when redactingJeff King, Sep 22, 2021
  22. Jeff KingSep 22, 2021

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.