You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Upgrade self-tests to deal with github.com/oras-project/oras-go v2.6.2 security release: FAIL: TestPushSignature #587
Hi! This project uses oras-go 2.6.0 and recently v2.6.2 was released which fixes several security bugs. However upgrading it leads to build failures in notation-go. Could you look into this? I help maintain this package for Debian, and to allow the security release to migrate, I'm going to disable these self tests -- but I prefer a proper fix.
=== RUN TestPushSignature
=== RUN TestPushSignature/failed_to_upload_signature
=== RUN TestPushSignature/successfully_uploaded_signature_manifest
repository_test.go:421: error = blob upload Location "" is on a different host than the registry "localhost:5000", expectErr = false
--- FAIL: TestPushSignature (0.00s)
--- PASS: TestPushSignature/failed_to_upload_signature (0.00s)
--- FAIL: TestPushSignature/successfully_uploaded_signature_manifest (0.00s)
=== RUN TestPushSignatureImageManifest
repository_test.go:439: failed to push signature
--- FAIL: TestPushSignatureImageManifest (0.00s)
We investigated the root cause of this failure in Debian (tracking BTS #1148141).
Root Cause
In oras-go v2.6.2, PR #1152 added host validation on the Location header returned by the registry during blob uploads (completePushAfterInitialPost) to prevent credential leakage (GHSA-jxpm-75mh-9fp7).
In registry/repository_test.go, mockRemoteClient.Do returned a mock http.Response for /v2/test/blobs/uploads/ with:
Because Request.URL is nil, Go's (*http.Response).Location() cannot resolve the relative URL "test" against the base request URL. This leaves location.Host == "" (location.Hostname() == ""), which fails sameUploadHost comparison against req.URL.Hostname() ("localhost"), triggering:
error = blob upload Location "" is on a different host than the registry "localhost:5000", expectErr = false
Fix
Passing the incoming Request: req allows resp.Location() to resolve the URL relative to the request. Providing a path under /v2/test/blobs/uploads/test and returning 201 Created for the subsequent PUT satisfies oras-go's host and scheme checks.
Here is the patch we applied in Debian, which resolves the failure and passes cleanly with both oras-go v2.5.0 and v2.6.2 (and should unblock #585):
Activity
siretart commentedon Sep 25, 2026
We investigated the root cause of this failure in Debian (tracking BTS #1148141).
Root Cause
In
oras-gov2.6.2, PR #1152 added host validation on theLocationheader returned by the registry during blob uploads (completePushAfterInitialPost) to prevent credential leakage (GHSA-jxpm-75mh-9fp7).In
registry/repository_test.go,mockRemoteClient.Doreturned a mockhttp.Responsefor/v2/test/blobs/uploads/with:Because
Request.URLisnil, Go's(*http.Response).Location()cannot resolve the relative URL"test"against the base request URL. This leaveslocation.Host == ""(location.Hostname() == ""), which failssameUploadHostcomparison againstreq.URL.Hostname()("localhost"), triggering:Fix
Passing the incoming
Request: reqallowsresp.Location()to resolve the URL relative to the request. Providing a path under/v2/test/blobs/uploads/testand returning201 Createdfor the subsequentPUTsatisfiesoras-go's host and scheme checks.Here is the patch we applied in Debian, which resolves the failure and passes cleanly with both
oras-gov2.5.0 and v2.6.2 (and should unblock #585):