Repository navigation
Highlights & Upgrade Notes
Security & Reliability Fixes
- Reject empty and reserved top-level delegated role names (GHSA-h95j-g597-frvp, 04f3122):
DelegatedRole.UnmarshalJSON,Metadata.VerifyDelegate,TargetsType.AddKey,TrustedMetadata.UpdateDelegatedTargets, andUpdaternow reject empty delegated role names and names matching any top-level role (root,snapshot,timestamp,targets), including case-folded variants, preventing delegated metadata from overwriting cached top-level files and bypassing rollback checks or breaking subsequentroot.jsonloads.Metadata.VerifyDelegatealso enforcesSuccinctRoles.IsDelegatedRole(with canonical lowercase hex bin suffixes) whensuccinct_rolesis configured, andmetadata.ValidateDelegatedRoleNameis exported for callers constructing delegations in memory. - Read cached delegated metadata from the escaped cache path (#810):
Updaternow reads cached delegated metadata through the sameurl.PathEscape(roleName) + ".json"path written bypersistMetadata, keeping delegated role reads confined toLocalMetadataDirand aligned with persisted filenames. - Reject duplicate signature
keyids inVerifyDelegate(#748):Metadata.VerifyDelegatenow rejects delegated metadata with duplicate signaturekeyids (matchingFromBytes), guards against typed-nilmetadata pointers, and stops scanningSignatureson the firstkeyidmatch. - OS-independent target URL and
multirepopath handling (#795, #841):MultiRepoClientmatchesmap.jsonpath patterns with POSIXpath.Matchrather thanfilepath.Match, andUpdater.DownloadTargetContextsplits hash-prefixed target URLs on"/"rather thanfilepath.Baseso\and:behave identically on Windows and POSIX. - Preserve retry options in custom
DefaultFetcherconstructors (#842):NewFetcherWithHTTPClientandNewFetcherWithRoundTrippernow clone the receiver's configured retry options andUser-Agent(or default tobackoff.WithMaxTries(1)), avoiding unintended 15-minute exponential backoff loops on expected HTTP 404s during root rotation.
New Features & Client Improvements
- Context cancellation across
fetcherandupdater(#837, #804): addedfetcher.ContextFetcher(DefaultFetcher.DownloadFileContext) alongsideupdater.NewContext,Updater.RefreshContext,Updater.GetTargetInfoContext, andUpdater.DownloadTargetContextso callers can enforce deadlines and cancel hanging mirror requests cleanly. - Pluggable metadata persistence (
config.MetadataStore) (#804):UpdaterConfig.MetadataStore(Load(ctx, role)/Persist(ctx, role, data)) allows applications to replace the default filesystem metadata cache with encrypted, database, or transactional storage while preserving root rotations across restarts and failing closed on storage read/write errors. - Whole-second UTC
expiresnormalization in constructors (#736):metadata.Root,Snapshot,Timestamp, andTargetsnormalize initialExpirestimestamps to whole-second UTC (YYYY-MM-DDTHH:MM:SSZ) per TUF §4.2.1 for interoperability with strict clients such aspython-tuf, while keepingFromBytesandMarshalJSONbyte-preserving so existing metadata signed with fractional seconds continues to verify unchanged.
What's Changed
- fetcher, updater: honour a caller's context so a hanging mirror can be cancelled by @khrisrichardson in #837
- fix(updater): read delegated metadata from the escaped cache path by @ashvinctrl in #810
- test: cover refresh server errors, rejected metadata and the old root threshold by @rene-founder in #840
- metadata: match multirepo map.json path patterns OS-independently by @choksi2212 in #795
- fix(updater): split hash-prefixed target URLs on '/' instead of filepath.Base by @rdimitrov in #841
- Format expires with second precision per TUF spec by @arpitjain099 in #736
- fix(metadata): reject duplicate signature key IDs in VerifyDelegate by @udf2457 in #748
- Allow caller-provided metadata persistence by @vanbroup in #804
- fetcher: inherit or default retry options in custom-client constructors by @xgbtxy in #842
- fix(metadata,updater): reject empty and top-level delegated role names by @rdimitrov in 04f3122 (GHSA-h95j-g597-frvp)
New Contributors
- @khrisrichardson made their first contribution in #837
- @ashvinctrl made their first contribution in #810
- @rene-founder made their first contribution in #840
- @choksi2212 made their first contribution in #795
- @vanbroup made their first contribution in #804
- @xgbtxy made their first contribution in #842
Full Changelog: v2.5.0...v2.6.0