Skip to content

v0.6.0

Choose a tag to compare

@github-actions github-actions released this 13 Jul 05:27
· 28 commits to main since this release
v0.6.0
08de137

The NuGet package is available at nuget.org.

Important

This release includes behavioral breaking changes in authentication and OCI manifest
serialization that are not obvious from method signatures. Please read the Breaking Changes
and Migration Guide sections before upgrading.

Breaking Changes

  • Auth realm validation is now enabled by default and is least-permissive (#393, #403). A
    freshly constructed auth Client now validates the bearer-challenge realm and, by default, only
    allows realms on the same host as the registry (HTTPS; scheme-default or matching port; no
    built-in trusted hosts). Registries whose token realm lives on a different host (e.g. Docker Hub:
    registry-1.docker.io → auth.docker.io) now require explicit opt-in:
    new Client(httpClient)
    {
        RealmValidator = new DefaultRealmValidator
        {
            TrustedRealmHosts = ImmutableHashSet.Create("auth.docker.io")
        }
    };
  • ScopeManager scope state is now partitioned by partitionId (#404). Six public methods
    (GetScopesForHost, GetScopesStringForHost, both SetActionsForRepository overloads, and both
    SetScopeForRegistry overloads) gained a required string? partitionId parameter. Pass null
    to preserve the previous unpartitioned behavior.
  • OCI manifests now use Go-compatible JSON encoding (#348). Serialized manifest bytes are now
    byte-for-byte compatible with oras-go / Go encoding/json (+ is no longer escaped; <, >,
    &, U+2028 and U+2029 are escaped as Go does). This changes the digest of any manifest whose
    fields contain those characters — recompute or re-push any digests cached from earlier versions.
  • Manifest serialization now enforces a 4 MiB limit (#348). Packing a manifest that serializes
    to more than 4 MiB now throws SizeLimitExceededException.
  • Stricter auth scope parsing (#396, #404). Scope.TryParse now rejects malformed scope
    strings that were previously accepted (empty resource type/name/action segments).

Migration Guide (v0.5.0 → v0.6.0)

  1. Update ScopeManager calls — the six methods now take a partitionId. Pass null for the
    previous behavior (or a non-null id to isolate scope state per tenant/identity):
    // before
    scopeManager.SetActionsForRepository(reference, Scope.Action.Pull);
    var scopes = scopeManager.GetScopesForHost("registry.example.com");
    // after
    scopeManager.SetActionsForRepository(reference, partitionId: null, Scope.Action.Pull);
    var scopes = scopeManager.GetScopesForHost("registry.example.com", partitionId: null);
  2. Opt into cross-host auth realms — if a registry's token realm is on a different host from the
    registry (Docker Hub, GitLab, NVIDIA NGC, …), add the realm host to TrustedRealmHosts or supply
    a custom IRealmValidator. Same-host realms (e.g. GHCR, MCR) need no change; for local/insecure
    registries set AllowInsecureHttp = true:
    var client = new Client(httpClient)
    {
        RealmValidator = new DefaultRealmValidator
        {
            TrustedRealmHosts = ImmutableHashSet.Create("auth.docker.io")
        }
    };
    See the runnable realm-validation sample
    and the realm-validation guide
    for TrustedRealmHosts, a custom IRealmValidator, and AllowInsecureHttp usage.
  3. Recompute cached manifest digests — digests you persisted from v0.5.0 for content containing
    +, <, >, &, U+2028 or U+2029 will differ in v0.6.0 (now Go/oras-go-compatible). Re-pack /
    re-push or recompute those digests.
  4. Handle the 4 MiB manifest limit — packing a manifest that serializes to more than 4 MiB now
    throws SizeLimitExceededException; reduce annotation/config size or split the content.
  5. Fix malformed scope strings — Scope.TryParse now returns false for inputs such as
    repository::pull, repository:myrepo:, or repository:repo:pull,,push. Use well-formed scopes
    of the form resourceType:resourceName:action[,action…].

Runnable samples added in this release demonstrate the new auth surface end-to-end:
realm validation,
external token broker,
and Azure Container Registry authentication.
See the full examples/ directory
and the ACR authentication guide.

New Features

  • Add IRealmValidator and DefaultRealmValidator for configurable auth-realm validation that
    prevents forwarding credentials to untrusted hosts (#393). See the
    realm-validation sample.
  • Add IAccessTokenProvider for external / broker-based access-token resolution without supplying
    raw credentials to the SDK (#382). See the
    external-token-broker sample.

Bug Fixes

  • Tolerate null manifests in referrers / index responses on the consumer side (#408;
    co-authored by @renshao, original fix in #399).
  • Preserve opaque bearer-challenge scopes on the token request (#396).
  • Buffer non-seekable request content before an auth retry so pushes from non-seekable streams
    succeed after a 401 (#372).
  • Handle null repositories and tags in catalog / tag-list responses (#361).

Other Changes

All Changes

  • docs: add an example of authentication with Azure Container Registry by @wangxiaoxuan273 in #321
  • Bump Microsoft.NET.Test.Sdk from 18.0.1 to 18.3.0 by @dependabot in #350
  • Bump Microsoft.CodeAnalysis.NetAnalyzers from 10.0.103 to 10.0.200 by @dependabot in #358
  • fix: handle null repositories and tags in catalog/tag list responses by @cshung in #361
  • build(deps): bump actions/configure-pages from 5 to 6 by @dependabot in #364
  • Bump Microsoft.CodeAnalysis.NetAnalyzers from 10.0.200 to 10.0.201 by @dependabot in #359
  • Bump coverlet.msbuild from 8.0.0 to 8.0.1 by @dependabot in #360
  • build(deps): bump codecov/codecov-action from 4 to 6 by @dependabot in #363
  • build(deps): bump actions/deploy-pages from 4 to 5 by @dependabot in #362
  • Bump Microsoft.NET.Test.Sdk from 18.3.0 to 18.4.0 by @dependabot in #368
  • Bump Microsoft.CodeAnalysis.NetAnalyzers from 10.0.201 to 10.0.202 by @dependabot in #370
  • build(deps): bump actions/upload-pages-artifact from 4 to 5 by @dependabot in #369
  • chore: add Akash Singhal as maintainer by @sajayantony in #367
  • fix: use Go-compatible JSON encoding for OCI manifests by @sajayantony in #348
  • test: reorganize manifest serialization tests with OCI spec fixtures by @sajayantony in #366
  • Bump coverlet.msbuild from 8.0.1 to 10.0.0 by @dependabot in #373
  • Bump Microsoft.CodeAnalysis.NetAnalyzers from 10.0.202 to 10.0.203 by @dependabot in #374
  • Bump Microsoft.NET.Test.Sdk from 18.4.0 to 18.5.1 by @dependabot in #376
  • Bump coverlet.msbuild from 10.0.0 to 10.0.1 by @dependabot in #380
  • Bump Microsoft.CodeAnalysis.NetAnalyzers from 10.0.203 to 10.0.300 by @dependabot in #379
  • fix: buffer non-seekable request content before auth retry by @cshung in #372
  • feat(auth): add IAccessTokenProvider for external token resolution by @cshung in #382
  • Bump Microsoft.NET.Test.Sdk from 18.5.1 to 18.6.0 by @dependabot in #387
  • Bump Microsoft.CodeAnalysis.NetAnalyzers from 10.0.300 to 10.0.301 by @dependabot in #391
  • build(deps): bump actions/checkout from 6 to 7 by @dependabot in #392
  • build(deps): bump codecov/codecov-action from 6 to 7 by @dependabot in #390
  • feat(auth): add realm URL validation to prevent credential forwarding by @cshung in #393
  • fix: preserve opaque bearer challenge scopes by @akashsinghal in #396
  • Bump Microsoft.NET.Test.Sdk from 18.6.0 to 18.7.0 by @dependabot in #397
  • fix(auth)!: least-permissive realm validation (no built-in trusted hosts) by @akashsinghal in #403
  • fix(auth)!: partition ScopeManager scope state by partitionId by @akashsinghal in #404
  • fix: tolerate null referrers manifests on the consumer side by @akashsinghal in #408

New Contributors

  • @renshao made their first contribution in #408 (original fix in #399, merged as co-author)

Full Changelog: v0.5.0...v0.6.0