fix: Use sigstore-go TUF client for delegation-aware target retrieval#1947
Merged
hectorj2f merged 1 commit intosigstore:mainfrom Mar 26, 2026
Merged
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1947 +/- ##
==========================================
+ Coverage 29.98% 30.32% +0.33%
==========================================
Files 122 122
Lines 7323 7354 +31
==========================================
+ Hits 2196 2230 +34
+ Misses 4894 4892 -2
+ Partials 233 232 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
dfb0436 to
328321f
Compare
Refactor TUF client usage to use sigstore-go's tuf.Client for target retrieval (GetTarget), which correctly traverses TUF delegations. Introduce TUFClient wrapper that provides: - GetTarget(): delegates to sigstore-go tuf.Client (delegation-aware) - GetTopLevelTargets(): lazy-initialized raw go-tuf v2 updater (legacy) The raw updater for GetTopLevelTargets is lazily initialized on first call, avoiding a double TUF metadata refresh for the common path where only GetTarget is needed (trusted_root.json lookup). GetTarget errors are now properly distinguished: "not found" falls through to the legacy custom metadata path, while other errors (network, hash mismatch, corruption) are propagated immediately. Based on feedback from sigstore/sigstore-go#602. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Kenny Leung <kleung@chainguard.dev>
328321f to
771bc40
Compare
hectorj2f
approved these changes
Mar 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactor TUF client usage to use sigstore-go's
tuf.Clientfor target retrieval, which correctly traverses TUF delegations.TUFClientwrapper providing:GetTarget(): delegates to sigstore-gotuf.Client(delegation-aware)GetTopLevelTargets(): lazy-initialized raw go-tuf v2 updater (legacy fallback only)GetTopLevelTargetsis lazily initialized on first call, avoiding a double TUF metadata refresh when onlyGetTargetis needed (the commontrusted_root.jsonpath)GetTargeterrors are properly distinguished: "not found" falls through to the legacy custom metadata path, while other errors (network, hash mismatch, corruption) are propagated immediatelyClientFromSerializedMirrorandClientFromRemotenow return*TUFClientdownloadTargethelper — replaced bytufClient.GetTarget()Based on feedback from sigstore/sigstore-go#602.
Test plan
go build ./...passesgo test ./...passes (all 14 test packages)gofmtcleangolangci-lint— no new issuesTUFClientAPI🤖 Generated with Claude Code