From: Reinhard Tartler Date: Fri, 25 Sep 2026 06:28:39 -0400 Subject: Fix mockRemoteClient to return valid Location and Request matching registry host In oras-go >= 2.6.2 (GHSA-jxpm-75mh-9fp7), blob upload location validation requires the Location header to match the registry host. Because mockRemoteClient previously returned an http.Response with an empty Request and a relative Location ("test"), Location() could not resolve the host, leading to test failures in TestPushSignature and TestPushSignatureImageManifest. Passing the original req as Response.Request and providing a valid Location path under /v2/test/blobs/uploads/ allows Location() to resolve properly against the request URL and pass host validation in oras-go. Bug: https://github.com/notaryproject/notation-go/issues/587 Bug-Debian: https://bugs.debian.org/1148141 Forwarded: https://github.com/notaryproject/notation-go/issues/587 Last-Update: 2026-09-25 --- registry/repository_test.go | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/registry/repository_test.go b/registry/repository_test.go index 708a974..4a7c09c 100644 --- a/registry/repository_test.go +++ b/registry/repository_test.go @@ -156,11 +156,9 @@ func (c mockRemoteClient) Do(req *http.Request) (*http.Response, error) { return &http.Response{ StatusCode: http.StatusAccepted, Body: io.NopCloser(bytes.NewReader([]byte(msg))), - Request: &http.Request{ - Header: map[string][]string{}, - }, + Request: req, Header: map[string][]string{ - "Location": {"test"}, + "Location": {"/v2/test/blobs/uploads/test"}, }, }, nil default: @@ -202,7 +200,7 @@ func (c mockRemoteClient) Do(req *http.Request) (*http.Response, error) { URL: &url.URL{Path: "/v2/test/referrers/" + zeroDigest}, }, }, nil - case validRepo: + case "/v2/test/blobs/uploads/test", validRepo: return &http.Response{ StatusCode: http.StatusCreated, Body: io.NopCloser(bytes.NewReader([]byte(msg))),