Repository navigation
v0.6.0
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 authClientnow 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") } };
ScopeManagerscope state is now partitioned bypartitionId(#404). Six public methods
(GetScopesForHost,GetScopesStringForHost, bothSetActionsForRepositoryoverloads, and both
SetScopeForRegistryoverloads) gained a requiredstring? partitionIdparameter. Passnull
to preserve the previous unpartitioned behavior.- OCI manifests now use Go-compatible JSON encoding (#348). Serialized manifest bytes are now
byte-for-byte compatible withoras-go/ Goencoding/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 throwsSizeLimitExceededException. - Stricter auth scope parsing (#396, #404).
Scope.TryParsenow rejects malformed scope
strings that were previously accepted (empty resource type/name/action segments).
Migration Guide (v0.5.0 → v0.6.0)
- Update
ScopeManagercalls — the six methods now take apartitionId. Passnullfor 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);
- 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 toTrustedRealmHostsor supply
a customIRealmValidator. Same-host realms (e.g. GHCR, MCR) need no change; for local/insecure
registries setAllowInsecureHttp = true:See the runnable realm-validation samplevar client = new Client(httpClient) { RealmValidator = new DefaultRealmValidator { TrustedRealmHosts = ImmutableHashSet.Create("auth.docker.io") } };
and the realm-validation guide
forTrustedRealmHosts, a customIRealmValidator, andAllowInsecureHttpusage. - 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. - Handle the 4 MiB manifest limit — packing a manifest that serializes to more than 4 MiB now
throwsSizeLimitExceededException; reduce annotation/config size or split the content. - Fix malformed scope strings —
Scope.TryParsenow returnsfalsefor inputs such as
repository::pull,repository:myrepo:, orrepository:repo:pull,,push. Use well-formed scopes
of the formresourceType: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 fullexamples/directory
and the ACR authentication guide.
New Features
- Add
IRealmValidatorandDefaultRealmValidatorfor configurable auth-realm validation that
prevents forwarding credentials to untrusted hosts (#393). See the
realm-validation sample. - Add
IAccessTokenProviderfor external / broker-based access-token resolution without supplying
raw credentials to the SDK (#382). See the
external-token-broker sample.
Bug Fixes
- Tolerate
nullmanifestsin 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 a401(#372). - Handle
nullrepositoriesandtagsin catalog / tag-list responses (#361).
Other Changes
- docs: add an example of authentication with Azure Container Registry by @wangxiaoxuan273 in #321
- test: reorganize manifest serialization tests with OCI spec fixtures by @sajayantony in #366
- chore: add Akash Singhal as maintainer by @sajayantony in #367
- Dependency & CI bumps by @dependabot in #350, #358, #359, #360, #362, #363, #364, #368, #369,
#370, #373, #374, #376, #379, #380, #387, #390, #391, #392, #397
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
Full Changelog: v0.5.0...v0.6.0