Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image: make layer validation work #111

Merged
merged 1 commit into from
Feb 10, 2017
Merged

image: make layer validation work #111

merged 1 commit into from
Feb 10, 2017

Conversation

cyphar
Copy link
Member

@cyphar cyphar commented Feb 8, 2017

Most recently, the validation was broken because the image-spec was
re-vendored but the code handling MediaType validation was not updated.

This change (among others) broke umoci's tests because we run the
validation code to ensure our images are always valid, and the
validation incorrectly flagged our images as invalid.

Fixes: ff477b3 ("vendor:update")
Signed-off-by: Aleksa Sarai [email protected]

Most recently, the validation was broken because the image-spec was
re-vendored but the code handling MediaType validation was not updated.

This change (among others) broke umoci's tests because we run the
validation code to ensure our images are always valid, and the
validation incorrectly flagged our images as invalid.

Fixes: ff477b3 ("vendor:update")
Signed-off-by: Aleksa Sarai <[email protected]>
@cyphar
Copy link
Member Author

cyphar commented Feb 8, 2017

This is also broken inside the image specification, which I'm fixing separately...

Here's the image spec PR: opencontainers/image-spec#560

@cyphar
Copy link
Member Author

cyphar commented Feb 8, 2017

Can we please be more careful next time?

@runcom
Copy link
Member

runcom commented Feb 8, 2017

This is a dupe of #108 (though, this PR is correct...)

@vbatts
Copy link
Member

vbatts commented Feb 8, 2017

LGTM

Approved with PullApprove

@@ -75,8 +75,15 @@ func (m *manifest) validate(w walker) error {
return errors.Wrap(err, "config validation failed")
}

validLayerMediaTypes := []string{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason to make this private? If a third party wants to support an extension layer type (which we explicitly allow), that would give them a way to do it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can stay private until asked for. :-)

@wking
Copy link
Contributor

wking commented Feb 8, 2017

Taking a step back, isn't this already handled by image-spec (which is was why it was broken in two places)? The DRY path forward seems like it would be dropping this image-tools code completely and using the image-spec validation instead.

@wking
Copy link
Contributor

wking commented Feb 8, 2017

image-spec calls that descriptor-type check (see here and here), so MediaTypeManifest.Validate will trigger it. And image-tools already calls MediaTypeManifest.Validate. I think the local manifest validation should be “call MediaTypeManifest.Validate and (optionally?) recurse through descendants” (because the image-spec validation is intra-blob). Maintaining parallel intra-blob validation here seems like a waste of effort.

@xiekeyang
Copy link
Contributor

Refer to #62 (comment). This had better to be done in image spec repo.
cc @stevvooe WDYT?

@cyphar
Copy link
Member Author

cyphar commented Feb 9, 2017

@wking Sure, but at the moment that code doesn't actually return an error if the validation fails.

@wking
Copy link
Contributor

wking commented Feb 9, 2017 via email

@runcom runcom mentioned this pull request Feb 9, 2017
@stevvooe
Copy link
Contributor

stevvooe commented Feb 10, 2017

LGTM

Approved with PullApprove

1 similar comment
@coolljt0725
Copy link
Member

coolljt0725 commented Feb 10, 2017

LGTM

Approved with PullApprove

@coolljt0725 coolljt0725 merged commit a358e03 into opencontainers:master Feb 10, 2017
@cyphar cyphar deleted the fix-layer-validation branch February 10, 2017 16:58
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.

7 participants