Repository navigation
Docker: an image a selector of the caller's grant hides is not found (404) - #704
Merged
Merged
Conversation
`Registry::decide` folded the caller's content selectors into the permission check, so a pull of an image a selector of the requested repository's grant hid (a group's included) was refused with 403 `DENIED` (401 for an anonymous caller), while the same image hidden through a group's member answered 404, and NuGet and npm answer a package a selector hides as not found. `rbac_decision` now tells the two apart: a caller who may not read the repository is `Deny` as before; one who may, asking for an image a selector hides, is `Hidden` to a read, which `refusal` answers as a name that does not exist (404 `NAME_UNKNOWN`) on every endpoint. A push or delete outside the selector stays `Deny` (403), also the read check a push through a group makes first. `rbac_allows`, which the token service uses, still allows only what the caller may see, so a registry token grants `pull` on no hidden name. The #648 group test now expects 404 for a selector on the group's grant, and a new test pulls hidden images of a hosted repository on every endpoint (HEAD too), and checks that a push and a delete outside the selector, and a pull by a caller who may not read the repository, are still refused. Fixes #703 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012e6DJZaXD2mBH9tURsdutM
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #703
Follow-up of #648 / #700: with a content selector on the grant of the requested repository (a group, or a hosted or proxy repository pulled directly), Docker refused a hidden image with 403
DENIED, where #648 asks for 404 like a package that does not exist (and where a hidden member already gave 404).Change (
crates/server/src/images/dispatch.rs)rbac_decisionreplaces the boolean check insidedecide: no read on the repository →Deny(401/403 as before); read allowed but a selector hides the image →Hiddenfor a read,Denyfor a push or delete.refusalanswersHiddenwith 404NAME_UNKNOWN(the same answer an unknown repository gives an admin), on every endpoint under/v2/<name>/: manifests, blobs, tags, referrers, HEAD too. A proxy asks its upstream nothing for it, as before.write_targetturns aHiddengroup read intoDeny, so a push through a group outside the selector stays 403.rbac_allows(used by the token service and imports) keeps its meaning:trueonly forAllow. A registry token still grantspullonly on names the caller may read; a hidden name's request answers 404 whatever the token's scope.Tests
an_image_a_selector_hides_is_not_found(new): a hosted repository, a caller withwritescoped topublic/*. The hidden image answers 404NAME_UNKNOWNon all five paths (GET and HEAD), the visible one 200, a push tosecret/new403, a delete of the hidden manifest 401/403, and a caller without read on the repository 403.groups_show_a_caller_only_the_images_it_may_read(from Groups and content selectors: a reader sees only the members and packages they may read; raw listings name hidden entries innext#648) now expects 404 for every hidden image, including under a selector on the group's grant.main(403 where 404 is expected).Checks run
cargo test -p forge-server --lib --test registry(248 + 47)cargo clippy --workspace --all-targets -- -D warnings,cargo fmt --all --check,cargo xtask changelog --checkdocs/docker.mddescribes what a hidden image answers. Changelog:docs/changes/2.2.0/703.fixed.md.Generated by Claude Code