<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/http.c, branch v2.47.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v2.47.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v2.47.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2024-10-02T14:46:26Z</updated>
<entry>
<title>Merge branch 'jk/http-leakfixes'</title>
<updated>2024-10-02T14:46:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-10-02T14:46:26Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=59ee4f70136a12feb47979ca90baaf7c7beafe73'/>
<id>urn:sha1:59ee4f70136a12feb47979ca90baaf7c7beafe73</id>
<content type='text'>
Leakfixes.

* jk/http-leakfixes: (28 commits)
  http-push: clean up local_refs at exit
  http-push: clean up loose request when falling back to packed
  http-push: clean up objects list
  http-push: free xml_ctx.cdata after use
  http-push: free remote_ls_ctx.dentry_name
  http-push: free transfer_request strbuf
  http-push: free transfer_request dest field
  http-push: free curl header lists
  http-push: free repo-&gt;url string
  http-push: clear refspecs before exiting
  http-walker: free fake packed_git list
  remote-curl: free HEAD ref with free_one_ref()
  http: stop leaking buffer in http_get_info_packs()
  http: call git_inflate_end() when releasing http_object_request
  http: fix leak of http_object_request struct
  http: fix leak when redacting cookies from curl trace
  transport-helper: fix leak of dummy refs_list
  fetch-pack: clear pack lockfiles list
  fetch: free "raw" string when shrinking refspec
  transport-helper: fix strbuf leak in push_refs_with_push()
  ...
</content>
</entry>
<entry>
<title>Merge branch 'ak/typofix-2.46-maint'</title>
<updated>2024-09-25T17:37:12Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-09-25T17:37:11Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=78ce6660bba5fd2faf03efd79912725dcf5be481'/>
<id>urn:sha1:78ce6660bba5fd2faf03efd79912725dcf5be481</id>
<content type='text'>
Typofix.

* ak/typofix-2.46-maint:
  upload-pack: fix a typo
  sideband: fix a typo
  setup: fix a typo
  run-command: fix a typo
  revision: fix a typo
  refs: fix typos
  rebase: fix a typo
  read-cache-ll: fix a typo
  pretty: fix a typo
  object-file: fix a typo
  merge-ort: fix typos
  merge-ll: fix a typo
  http: fix a typo
  gpg-interface: fix a typo
  git-p4: fix typos
  git-instaweb: fix a typo
  fsmonitor-settings: fix a typo
  diffcore-rename: fix typos
  config.mak.dev: fix a typo
</content>
</entry>
<entry>
<title>http: stop leaking buffer in http_get_info_packs()</title>
<updated>2024-09-25T17:24:55Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2024-09-24T22:02:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=75f4acc98125a9e9f5b3051c0dc6690839830e25'/>
<id>urn:sha1:75f4acc98125a9e9f5b3051c0dc6690839830e25</id>
<content type='text'>
We use http_get_strbuf() to fetch the remote info/packs content into a
strbuf, but never free it, causing a leak. There's no need to hold onto
it, as we've already parsed it completely.

This lets us mark t5619 as leak-free.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>http: call git_inflate_end() when releasing http_object_request</title>
<updated>2024-09-25T17:24:55Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2024-09-24T22:02:13Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=8bdb84ebbbfadf71ae1760e68be5422cbe4872c6'/>
<id>urn:sha1:8bdb84ebbbfadf71ae1760e68be5422cbe4872c6</id>
<content type='text'>
In new_http_object_request(), we initialize the zlib stream with
git_inflate_init(). We must have a matching git_inflate_end() to avoid
leaking any memory allocated by zlib.

In most cases this happens in finish_http_object_request(), but we don't
always get there. If we abort a request mid-stream, then we may clean it
up without hitting that function.

We can't just add a git_inflate_end() call to the release function,
though. That would double-free the cases that did actually finish.
Instead, we'll move the call from the finish function to the release
function. This does delay it for the cases that do finish, but I don't
think it matters. We should have already reached Z_STREAM_END (and
complain if we didn't), and we do not record any status code from
git_inflate_end().

This leak is triggered by t5550 at least (and probably other dumb-http
tests).

I did find one other related spot of interest. If we try to read a
previously downloaded file and fail, we reset the stream by calling
memset() followed by a fresh git_inflate_init(). I don't think this case
is triggered in the test suite, but it seemed like an obvious leak, so I
added the appropriate git_inflate_end() before the memset() there.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>http: fix leak of http_object_request struct</title>
<updated>2024-09-25T17:24:55Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2024-09-24T22:01:09Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=a1bc3c88de1526c83882143b2e47400f7e3ee4b2'/>
<id>urn:sha1:a1bc3c88de1526c83882143b2e47400f7e3ee4b2</id>
<content type='text'>
The new_http_object_request() function allocates a struct on the heap,
along with some fields inside the struct. But the matching function to
clean it up, release_http_object_request(), only frees the interior
fields without freeing the struct itself, causing a leak.

The related http_pack_request new/release pair gets this right, and at
first glance we should be able to do the same thing and just add a
single free() call. But there's a catch.

These http_object_request structs are typically embedded in the
object_request struct of http-walker.c. And when we clean up that parent
struct, it sanity-checks the embedded struct to make sure we are not
leaking descriptors. Which means a use-after-free if we simply free()
the embedded struct.

I have no idea how valuable that sanity-check is, or whether it can
simply be deleted. This all goes back to 5424bc557f (http*: add helper
methods for fetching objects (loose), 2009-06-06). But the obvious way
to make it all work is to be sure we set the pointer to NULL after
freeing it (and our freeing process closes the descriptor, so we know
there is no leak).

To make sure we do that consistently, we'll switch the pointer we take
in release_http_object_request() to a pointer-to-pointer, and we'll set
it to NULL ourselves. And then the compiler can help us find each caller
which needs to be updated.

Most cases will just pass "&amp;obj_req-&gt;req", which will obviously do the
right thing. In a few cases, like http-push's finish_request(), we are
working with a copy of the pointer, so we don't NULL the original. But
it's OK because the next step is to free the struct containing the
original pointer anyway.

This lets us mark t5551 as leak-free. Ironically this is the "smart"
http test, and the leak here only affects dumb http. But there's a
single dumb-http invocation in there. The full dumb tests are in t5550,
which still has some more leaks.

This also makes t5559 leak-free, as it's just an HTTP/2 variant of
t5551. But we don't need to mark it as such, since it inherits the flag
from t5551.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>http: fix leak when redacting cookies from curl trace</title>
<updated>2024-09-25T17:24:55Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2024-09-24T21:59:14Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=3d33e96653fecbc692fa5674b127fd598ad2dbeb'/>
<id>urn:sha1:3d33e96653fecbc692fa5674b127fd598ad2dbeb</id>
<content type='text'>
When redacting headers for GIT_TRACE_CURL, we build up a redacted cookie
header in a local strbuf, and then copy it into the output. But we
forget to release the temporary strbuf, leaking it for every cookie
header we show.

The other redacted headers don't run into this problem, since they're
able to work in-place in the output buffer. But the cookie parsing is
too complicated for that, since we redact the cookies individually.

This leak is triggered by the cookie tests in t5551.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>http: fix a typo</title>
<updated>2024-09-19T20:46:00Z</updated>
<author>
<name>Andrew Kreimer</name>
<email>algonell@gmail.com</email>
</author>
<published>2024-09-19T18:34:27Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=7a6d5a464171dfc4d7830b3e1d1ed8a577604f8b'/>
<id>urn:sha1:7a6d5a464171dfc4d7830b3e1d1ed8a577604f8b</id>
<content type='text'>
Fix a typo in comments.

Signed-off-by: Andrew Kreimer &lt;algonell@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>http: do not ignore proxy path</title>
<updated>2024-08-02T15:30:08Z</updated>
<author>
<name>Ryan Hendrickson</name>
<email>ryan.hendrickson@alum.mit.edu</email>
</author>
<published>2024-08-02T05:20:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=0ca365c2ed48084974c7081bdfe3189094a2b993'/>
<id>urn:sha1:0ca365c2ed48084974c7081bdfe3189094a2b993</id>
<content type='text'>
The documentation for `http.proxy` describes that option, and the
environment variables it overrides, as supporting "the syntax understood
by curl". curl allows SOCKS proxies to use a path to a Unix domain
socket, like `socks5h://localhost/path/to/socket.sock`. Git should
therefore include, if present, the path part of the proxy URL in what it
passes to libcurl.

Co-authored-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Ryan Hendrickson &lt;ryan.hendrickson@alum.mit.edu&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'jc/http-cookiefile'</title>
<updated>2024-07-17T17:47:26Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-07-17T17:47:25Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=dd6d10285b91af584d0f9316467d870fa3d20c1d'/>
<id>urn:sha1:dd6d10285b91af584d0f9316467d870fa3d20c1d</id>
<content type='text'>
The http.cookieFile and http.saveCookies configuration variables
have a few values that need to be avoided, which are now ignored
with warning messages.

* jc/http-cookiefile:
  http.c: cookie file tightening
</content>
</entry>
<entry>
<title>Merge branch 'bc/http-proactive-auth'</title>
<updated>2024-07-16T18:18:57Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2024-07-16T18:18:57Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=fe5ba894ec129491e57f0f5d0873fd374c058414'/>
<id>urn:sha1:fe5ba894ec129491e57f0f5d0873fd374c058414</id>
<content type='text'>
The http transport can now be told to send request with
authentication material without first getting a 401 response.

* bc/http-proactive-auth:
  http: allow authenticating proactively
</content>
</entry>
</feed>
