Skip to content

[registry] Accept empty scope during token auth challenge - #3

Merged
Fricounet merged 1 commit into
datadogfrom
fricounet/allow-empty-scope-dd
Jul 31, 2025
Merged

[registry] Accept empty scope during token auth challenge#3
Fricounet merged 1 commit into
datadogfrom
fricounet/allow-empty-scope-dd

Conversation

@Fricounet

Copy link
Copy Markdown
Collaborator

Cherry-picking dragonflyoss#1733 from upstream

Description:
The distribution spec (https://distribution.github.io/distribution/spec/auth/scope/#authorization-server-use) mentions that the access token provided during auth challenge "may include a scope" which means that it's not necessary to have one either to comply with the spec. Additionally, this is something that is already accepted by containerd which will simply log a warning when no scope is specified: https://github.com/containerd/containerd/blob/main/core/remotes/docker/auth/fetch.go#L64 To match with what containerd and the spec suggest, the commit modifies the parse_auth logic to accept an empty scope field. It also logs the same warning as containerd.

The distribution spec (https://distribution.github.io/distribution/spec/auth/scope/#authorization-server-use) mentions that the access token provided during auth challenge "may include a scope" which means that it's not necessary to have one either to comply with the spec.
Additionally, this is something that is already accepted by containerd which will simply log a warning when no scope is specified: https://github.com/containerd/containerd/blob/main/core/remotes/docker/auth/fetch.go#L64
To match with what containerd and the spec suggest, the commit modifies the `parse_auth` logic to accept an empty `scope` field. It also logs the same warning as containerd.

Signed-off-by: Baptiste Girard-Carrabin <baptiste.girardcarrabin@datadoghq.com>
@Fricounet
Fricounet merged commit ebcc55d into datadog Jul 31, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants