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

Fix file signing verification error and bucket upload #2785

Merged
merged 5 commits into from
Nov 30, 2022

Conversation

puerco
Copy link
Member

@puerco puerco commented Nov 30, 2022

What type of PR is this?

/kind bug

What this PR does / why we need it:

Following @xmudrii 's intuition, this PR modifies krel sign blob to stop synching down from the bucket any existing certificates and signatures. For some reason, this seems to avoid the verification error encountered during the v1.26.0-rc.1 release.

My theory is that when resigning a file, the signatures are not written to disk if a .sig file already exists (or there is a race condition somewhere). And then the verification fails because it checks against a previous signature. I tried looking for the bug but could not find it yet. This PR avoids copying the signatures down so krel sign blob will not find them.

It also fixes another bug where copying back to the bucket would not send new signatures and certs as the noclobber option of gsutil was enabled.

Which issue(s) this PR fixes:

Fixes the verification error encountered during the v1.26.0-rc.1 release.

Special notes for your reviewer:

/cc @cpanato @xmudrii @jeremyrickard @saschagrunert

Does this PR introduce a user-facing change?

- `krel sign blob` will not sync down existing signatures and certs when signing files in a gcs bucket to work around a bug causing file verification to fail
- Fixed a bug where `krel sign blob` would not sync new signatures to a bucket that already signed files.

Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
Signed-off-by: Adolfo Garcia Veytia (puerco) <[email protected]>
@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Nov 30, 2022
@k8s-ci-robot k8s-ci-robot added kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-priority area/release-eng Issues or PRs related to the Release Engineering subproject sig/release Categorizes an issue or PR as relevant to SIG Release. approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files. labels Nov 30, 2022
@puerco
Copy link
Member Author

puerco commented Nov 30, 2022

/priority critical-urgent

@k8s-ci-robot k8s-ci-robot added priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. and removed needs-priority labels Nov 30, 2022
Copy link
Member

@xmudrii xmudrii left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve
/hold
for @cpanato and @saschagrunert to take a look if they want

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 30, 2022
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Nov 30, 2022
@@ -120,13 +128,14 @@ func runSignBlobs(signOpts *signOptions, signBlobOpts *signBlobOptions, args []s
if strings.HasSuffix(file, ".sha256") || strings.HasSuffix(file, ".sha512") ||
strings.HasSuffix(file, ":") || strings.HasSuffix(file, ".docker_tag") ||
strings.Contains(file, "SHA256SUMS") || strings.Contains(file, "SHA512SUMS") ||
strings.Contains(file, "README") || strings.Contains(file, "Makefile") {
strings.Contains(file, "README") || strings.Contains(file, "Makefile") ||
strings.HasSuffix(file, certExt) || strings.HasSuffix(file, sigExt) || strings.HasSuffix(file, ".pem") {
Copy link
Member

Choose a reason for hiding this comment

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

nit: We decided to not use ".pem" at all but it should not hurt to have it part of the list.

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

Thank you for fixing this! I think we're coming close to the final version 🤞

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: puerco, saschagrunert, xmudrii

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

@saschagrunert
Copy link
Member

/unhold

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Nov 30, 2022
@k8s-ci-robot k8s-ci-robot merged commit 7d3fe98 into kubernetes:master Nov 30, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.26 milestone Nov 30, 2022
_, err = gcli.GSUtilOutput("cp", "-n", certFiles, signFiles, fmt.Sprintf("%s%s", object.GcsPrefix, fileBundle.destinationPathToCopy))
if err != nil {
if _, err := gcli.GSUtilOutput(
"cp", certFiles, signFiles, fmt.Sprintf("%s%s", object.GcsPrefix, fileBundle.destinationPathToCopy),
Copy link
Member

Choose a reason for hiding this comment

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

ok, that sounds good

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. area/release-eng Issues or PRs related to the Release Engineering subproject cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/bug Categorizes issue or PR as related to a bug. lgtm "Looks good to me", indicates that a PR is ready to be merged. priority/critical-urgent Highest priority. Must be actively worked on as someone's top priority right now. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/release Categorizes an issue or PR as relevant to SIG Release. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants