Repository navigation
Description
With the new registry 2.4 (about to land with #8938) and docker 1.10+ a feature called cross-repo mount is utilized during image push. It works like this:
- docker keeps a database of source references for each blob
- it is updated whenever a blob is downloaded from a any registry/repository or successfully pushed to a new one
- when pushing a blob B to a repository R/foo while a mapping between the blob and another repository bar in the same registry R exists, it will set headers requesting to mount the blob from repository bar to repository foo
- registry verifies the blob exists in repository bar and returns a special response saying "mounted"
- docker then doesn't need to re-upload the blob, resulting in a significant speed-up
The problem is that on registry's side an authorization check is done both for target (foo) and source repository (bar). Docker daemon expects that if it already owns a blob coming from some registry, any other user requesting to push the blob back to it is authorized to access previously registered location.
This means we will be broken in cases like:
- bob tags
docker.io/foo:v1to image streamfooin project P - he uses the
fooas a base image to build his new application app - docker pulls it, a new layer is added on top and pushed to internal registry
- another user alice (or even bob himself) tags
docker.io/foo:v1to image streamfooin another project P2 - same as step 2
- docker repulls the
docker.io/foo:v1(no change), adds a new layer on top and pushes to internal registry- this fails because a cross repo mount from repository
P/foois requested andsystem:serviceaccount:P2:builderisn't authorized to access layers from namespaceP
- this fails because a cross repo mount from repository
This used to work before so it's a regression.
Version
once the #8938 lands
Proposed solution
In our auth.go module when asked for access to repository:pull:foo, determine from context whether the request wants to push with a blob cross-repo mounted from foo. If yes, allow it unconditionally.
Related to #6841
Activity
miminar commentedon Jun 24, 2016
/cc @legionus
/cc @mfojtik - it seems like a P1 to me
mfojtik commentedon Jun 24, 2016
yes, definitely p1