Merge pull request #1828 from nwt/foreign-layer-url-validation

Properly validate multi-URL foreign layers
This commit is contained in:
Derek McGowan 2016-07-11 13:01:04 -07:00 committed by GitHub
commit 9d84a6a18e
2 changed files with 6 additions and 0 deletions

View file

@ -107,6 +107,7 @@ func (ms *schema2ManifestHandler) verifyManifest(ctx context.Context, mnfst sche
pu, err = url.Parse(u)
if err != nil || (pu.Scheme != "http" && pu.Scheme != "https") || pu.Fragment != "" {
err = errInvalidURL
break
}
}
}

View file

@ -78,6 +78,11 @@ func TestVerifyManifestForeignLayer(t *testing.T) {
[]string{"https://foo/bar", ""},
errInvalidURL,
},
{
foreignLayer,
[]string{"", "https://foo/bar"},
errInvalidURL,
},
{
foreignLayer,
[]string{"http://foo/bar"},