Skip to content

v2.6.0

Latest

Choose a tag to compare

@rdimitrov rdimitrov released this 27 Nov 14:36
Immutable release. Only release title and notes can be modified.
04f3122

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, and Updater now 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 subsequent root.json loads. Metadata.VerifyDelegate also enforces SuccinctRoles.IsDelegatedRole (with canonical lowercase hex bin suffixes) when succinct_roles is configured, and metadata.ValidateDelegatedRoleName is exported for callers constructing delegations in memory.
  • Read cached delegated metadata from the escaped cache path (#810): Updater now reads cached delegated metadata through the same url.PathEscape(roleName) + ".json" path written by persistMetadata, keeping delegated role reads confined to LocalMetadataDir and aligned with persisted filenames.
  • Reject duplicate signature keyids in VerifyDelegate (#748): Metadata.VerifyDelegate now rejects delegated metadata with duplicate signature keyids (matching FromBytes), guards against typed-nil metadata pointers, and stops scanning Signatures on the first keyid match.
  • OS-independent target URL and multirepo path handling (#795, #841): MultiRepoClient matches map.json path patterns with POSIX path.Match rather than filepath.Match, and Updater.DownloadTargetContext splits hash-prefixed target URLs on "/" rather than filepath.Base so \ and : behave identically on Windows and POSIX.
  • Preserve retry options in custom DefaultFetcher constructors (#842): NewFetcherWithHTTPClient and NewFetcherWithRoundTripper now clone the receiver's configured retry options and User-Agent (or default to backoff.WithMaxTries(1)), avoiding unintended 15-minute exponential backoff loops on expected HTTP 404s during root rotation.

New Features & Client Improvements

  • Context cancellation across fetcher and updater (#837, #804): added fetcher.ContextFetcher (DefaultFetcher.DownloadFileContext) alongside updater.NewContext, Updater.RefreshContext, Updater.GetTargetInfoContext, and Updater.DownloadTargetContext so 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 expires normalization in constructors (#736): metadata.Root, Snapshot, Timestamp, and Targets normalize initial Expires timestamps to whole-second UTC (YYYY-MM-DDTHH:MM:SSZ) per TUF §4.2.1 for interoperability with strict clients such as python-tuf, while keeping FromBytes and MarshalJSON byte-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

Full Changelog: v2.5.0...v2.6.0