Prevent fallback to v1 registry for digest pulls
The intention of the user is to download a verified image if explicitly pulling with a digest and falling back to v1 registry circumvents that protection. Signed-off-by: Nuutti Kotivuori <naked@iki.fi> Upstream-commit: 642e6a377324c7873f278c6bd7fd5e60201139e2 Component: engine
This commit is contained in:
@@ -115,6 +115,16 @@ func (s *DockerRegistrySuite) TestPullByDigest(c *check.C) {
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerRegistrySuite) TestPullByDigestNoFallback(c *check.C) {
|
||||
// pull from the registry using the <name>@<digest> reference
|
||||
imageReference := fmt.Sprintf("%s@sha256:ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", repoName)
|
||||
cmd := exec.Command(dockerBinary, "pull", imageReference)
|
||||
out, _, err := runCommandWithOutput(cmd)
|
||||
if err == nil || !strings.Contains(out, "pulling with digest reference failed from v2 registry") {
|
||||
c.Fatalf("expected non-zero exit status and correct error message when pulling non-existing image: %s", out)
|
||||
}
|
||||
}
|
||||
|
||||
func (s *DockerRegistrySuite) TestCreateByDigest(c *check.C) {
|
||||
pushDigest, err := setupImage()
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user