Skip to content

chore: sync with upstream google/go-containerregistry - #12

Open
ec-automation[bot] wants to merge 8 commits into
mainfrom
sync/upstream-2026-07-13-60
Open

ec-automation[bot] wants to merge 8 commits into
mainfrom
sync/upstream-2026-07-13-60

Conversation

@ec-automation

@ec-automation ec-automation Bot commented Jul 13, 2026

Copy link
Copy Markdown

Automated weekly sync from google/go-containerregistry.

Merge completed cleanly — no conflicts detected.

amarkdotdev and others added 8 commits June 17, 2026 09:43
Move defer r.Close() and defer pw.Close() to the top of the goroutine
so they execute regardless of which error path exits the function.
Previously, r.Close() was only called inside the io.Copy error path
and the happy-path end, leaving it unclosed when gw.Close() or
bw.Flush() failed.

When r wraps a limitedReadCloser (used by the pullLimiter introduced
in google#2271), failing to close r permanently leaks the limiter token
slot. Under layout.WriteImage (used by kaniko for build-stage caching),
this eventually deadlocks because all slots are occupied.

Also add defer gw.Close() after gw creation so the gzip writer is
always properly finalized.

Fixes google#2342

Signed-off-by: Aaron <aaroniofjm@gmail.com>
google#2337)

When an http.Client-level redirect sends a request to a host that
differs from bt.registry, the sendRequest() closure skips setting the
Authorization header (its matchesHost guard returns false). The previous
code called sendRequest() again after bt.refresh(), so the freshly
fetched token was never applied to the retried request and the client
received a second 401 instead of succeeding.

Fix by reading the token directly from bt.bearer after a successful
refresh and setting the Authorization header unconditionally before
retrying, bypassing the matchesHost guard that is only needed to prevent
header forwarding on client-visible redirects.

Closes google#2333
…es (google#2348)

* build(deps): bump the go-deps group across 3 directories with 4 updates

Bumps the go-deps group with 1 update in the / directory: [golang.org/x/tools](https://github.com/golang/tools).
Bumps the go-deps group with 2 updates in the /pkg/authn/k8schain directory: [k8s.io/api](https://github.com/kubernetes/api) and [k8s.io/client-go](https://github.com/kubernetes/client-go).
Bumps the go-deps group with 2 updates in the /pkg/authn/kubernetes directory: [k8s.io/api](https://github.com/kubernetes/api) and [k8s.io/client-go](https://github.com/kubernetes/client-go).


Updates `golang.org/x/tools` from 0.45.0 to 0.46.0
- [Release notes](https://github.com/golang/tools/releases)
- [Commits](golang/tools@v0.45.0...v0.46.0)

Updates `k8s.io/api` from 0.36.1 to 0.36.2
- [Commits](kubernetes/api@v0.36.1...v0.36.2)

Updates `k8s.io/client-go` from 0.36.1 to 0.36.2
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](kubernetes/client-go@v0.36.1...v0.36.2)

Updates `k8s.io/api` from 0.36.1 to 0.36.2
- [Commits](kubernetes/api@v0.36.1...v0.36.2)

Updates `k8s.io/client-go` from 0.36.1 to 0.36.2
- [Changelog](https://github.com/kubernetes/client-go/blob/master/CHANGELOG.md)
- [Commits](kubernetes/client-go@v0.36.1...v0.36.2)

Updates `k8s.io/apimachinery` from 0.36.1 to 0.36.2
- [Commits](kubernetes/apimachinery@v0.36.1...v0.36.2)

---
updated-dependencies:
- dependency-name: golang.org/x/tools
  dependency-version: 0.46.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: k8s.io/api
  dependency-version: 0.36.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-deps
- dependency-name: k8s.io/client-go
  dependency-version: 0.36.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-deps
- dependency-name: k8s.io/api
  dependency-version: 0.36.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-deps
- dependency-name: k8s.io/client-go
  dependency-version: 0.36.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-deps
- dependency-name: k8s.io/apimachinery
  dependency-version: 0.36.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: go-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Some tools generate tarballs with ./ prefix in paths (e.g. ./manifest.json).
Use path.Clean on both header name and target path to ensure they match
correctly even if they have different formatting.

This fixes loading images that have ./ prefixed paths, which was causing
errors like "file manifest.json not found in tar".
…oogle#2349)

PR google#2337 made bearerTransport.RoundTrip set the Authorization header
unconditionally on the post-401 retry, bypassing the matchesHost guard.
That guard exists to stop the credential being forwarded across an
http.Client-level redirect to a different host. With it bypassed, a
malicious or compromised registry can 302 a manifest/blob fetch to an
attacker-controlled host, answer the follow-up request with a Bearer
challenge, and harvest the operator's registry token: the client
refreshes the token from the trusted realm and then sends it to the
redirected host.

Gate the re-attach on matchesHost so the refreshed token is only applied
when the request is still talking to the registry we authenticated
against; for a cross-host request fall back to sendRequest(), which omits
the credential. This preserves the google#2333 fix for same-host 401 retries
(e.g. mid-session token expiry) while closing the credential leak.

Add a regression test for the same-host retry and a test asserting the
token is not leaked to a cross-host challenger.
…google#2353)

Bumps the go-deps group with 3 updates in the / directory: [github.com/docker/cli](https://github.com/docker/cli), [github.com/moby/moby/api](https://github.com/moby/moby) and [github.com/moby/moby/client](https://github.com/moby/moby).


Updates `github.com/docker/cli` from 29.5.3+incompatible to 29.6.0+incompatible
- [Commits](docker/cli@v29.5.3...v29.6.0)

Updates `github.com/moby/moby/api` from 1.54.2 to 1.55.0
- [Release notes](https://github.com/moby/moby/releases)
- [Commits](moby/moby@api/v1.54.2...api/v1.55.0)

Updates `github.com/moby/moby/client` from 0.4.1 to 0.5.0
- [Release notes](https://github.com/moby/moby/releases)
- [Changelog](https://github.com/moby/moby/blob/v0.5.0/CHANGELOG.md)
- [Commits](moby/moby@v0.4.1...v0.5.0)

---
updated-dependencies:
- dependency-name: github.com/docker/cli
  dependency-version: 29.6.0+incompatible
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: github.com/moby/moby/api
  dependency-version: 1.55.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
- dependency-name: github.com/moby/moby/client
  dependency-version: 0.5.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: go-deps
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@codecov

codecov Bot commented Jul 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
internal/gzip/zip.go 89.47% <100.00%> (-0.27%) ⬇️
pkg/v1/remote/transport/bearer.go 73.79% <100.00%> (+0.70%) ⬆️
pkg/v1/tarball/image.go 81.90% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants