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

Drop image signature annotations #19037

Conversation

miminar
Copy link

@miminar miminar commented Mar 20, 2018

Because they were never meant to be allowed.

Includes and superseds #19030 (kudos to @deads2k)
Closes #19011

Resolves: rhbz#1557607

/assign @bparees @deads2k
/cc @mfojtik

@openshift-ci-robot openshift-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Mar 20, 2018
@miminar
Copy link
Author

miminar commented Mar 20, 2018

@openshift/api-review

@miminar
Copy link
Author

miminar commented Mar 20, 2018

/retest

// validation; resolves rhbz#1557607
for i := range newImage.Signatures {
newImage.Signatures[i].Annotations = map[string]string{}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

should only need this on prepare for update right?

on a create i think we want to reject the creation w/ the validation failure reason, rather than silently drop the user's metadata.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree. that is consistent with existing behavior

Copy link
Author

Choose a reason for hiding this comment

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

What if somebody wants to import backed up images?

@@ -62,9 +62,6 @@ func (s *containerImageSignatureDownloader) DownloadImageSignatures(image *image
// signature.
sig.Name = imageapi.JoinImageStreamImage(image.Name, fmt.Sprintf("%x", sha256.Sum256(blob)))
sig.Content = blob
sig.Annotations = map[string]string{
SignatureManagedAnnotation: "true",
Copy link
Contributor

Choose a reason for hiding this comment

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

@mfojtik does the controller do something with this annotation later?

Copy link
Author

Choose a reason for hiding this comment

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

No, there's no other reference to the annotation apart those referenced here.

Copy link
Contributor

Choose a reason for hiding this comment

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

no and I don't remember adding this

// bug in image update logic allowed to set arbitrary annotations that would otherwise be rejected by
// validation; resolves rhbz#1557607
for i := range newImage.Signatures {
newImage.Signatures[i].Annotations = map[string]string{}
Copy link
Contributor

Choose a reason for hiding this comment

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

I would only drop the old controller annotation.

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah i guess that makes sense. for any other annotation they'll run into the validation rule.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

@miminar miminar force-pushed the naughty-image-signature-annotation branch from 27cb3bb to 136a32b Compare March 20, 2018 20:32
@openshift-ci-robot openshift-ci-robot added size/L Denotes a PR that changes 100-499 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Mar 20, 2018
@miminar miminar force-pushed the naughty-image-signature-annotation branch from 136a32b to 3718037 Compare March 20, 2018 20:39
@@ -49,6 +52,8 @@ func (s imageStrategy) PrepareForCreate(ctx apirequest.Context, obj runtime.Obje
newImage.DockerImageManifest = ""
newImage.DockerImageConfig = ""
}

removeManagedSignatureAnnotation(newImage)
Copy link
Contributor

Choose a reason for hiding this comment

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

since it's now only going to drop the one annotation, i think i'm ok w/ doing this on create, for the (unlikely) backup/restore use case. @deads2k ?

Copy link
Contributor

Choose a reason for hiding this comment

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

since it's now only going to drop the one annotation, i think i'm ok w/ doing this on create, for the (unlikely) backup/restore use case. @deads2k ?

Ok.

@@ -16,6 +16,9 @@ import (
"github.com/openshift/origin/pkg/image/util"
)

// ManagedSignatureAnnotation used to be set by image signature import controller as a signature annotation.
const ManagedSignatureAnnotation = "image.openshift.io/managed-signature"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: private, right?

Copy link
Author

Choose a reason for hiding this comment

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

good catch, fixed

@deads2k
Copy link
Contributor

deads2k commented Mar 21, 2018

I think this is our best route forward.

@smarterclayton @liggitt any alternative ideas? We'll have to pick this fairly far back.

@bparees
Copy link
Contributor

bparees commented Mar 21, 2018

We'll have to pick this fairly far back.

back to 3.7, no further right?

@miminar miminar force-pushed the naughty-image-signature-annotation branch 2 times, most recently from ed6c117 to 0a9bec8 Compare March 21, 2018 15:48
@bparees
Copy link
Contributor

bparees commented Mar 21, 2018

We'll have to pick this fairly far back.
back to 3.7, no further right?

I see now, the validation check itself (the swap args) needs to be backported further to ensure users don't update image objects w/ invalid content.

@deads2k
Copy link
Contributor

deads2k commented Mar 21, 2018

Add more commits by pushing to the naughty-image-signature-annotation branch on miminar/origin.

@mfojtik and that's what we think of your annotation! :)

@bparees
Copy link
Contributor

bparees commented Mar 21, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 21, 2018
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

4 similar comments
@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link
Contributor

/retest

Please review the full test history for this PR and help us cut down flakes.

@miminar
Copy link
Author

miminar commented Mar 22, 2018

Made it compilable again.

@miminar miminar force-pushed the naughty-image-signature-annotation branch from 0a9bec8 to 6feafaf Compare March 22, 2018 10:15
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Mar 22, 2018
@mfojtik
Copy link
Contributor

mfojtik commented Mar 22, 2018

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 22, 2018
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: bparees, mfojtik, miminar

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot
Copy link
Contributor

Automatic merge from submit-queue (batch tested with PRs 18905, 18968, 19016, 19037, 19056).

@openshift-merge-robot openshift-merge-robot merged commit 1453679 into openshift:master Mar 22, 2018
@bparees
Copy link
Contributor

bparees commented Mar 22, 2018

@miminar can you start queuing up backports of the validation fix? Needs to go back to at least v3.3 i'd say. (and the removal of the signature annotation logic would need to go back to at least 3.7 where it was introduced)

@miminar miminar deleted the naughty-image-signature-annotation branch June 20, 2018 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants