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

chore: Refactor error messages for Notation signature verification #1730

Merged
merged 34 commits into from
Sep 9, 2024

Conversation

binbin-li
Copy link
Collaborator

@binbin-li binbin-li commented Aug 20, 2024

Description

What this PR does / why we need it:

This PR focuses on the notation signature validation scenario, improving the clarity of error messages and providing more intuitive remediation steps for users.

For errors that are self-explanatory, I have not included remediation steps.

Which issue(s) this PR fixes (optional, using fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when the PR gets merged):

It will fix some cases of the issue: #1321

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Helm Chart Change (any edit/addition/update that is necessary for changes merged to the main branch)
  • This change requires a documentation update

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Please also list any relevant details for your test configuration

  • Test A
  • Test B

Checklist:

  • Does the affected code have corresponding tests?
  • Are the changes documented, not just with inline documentation, but also with conceptual documentation such as an overview of a new feature, or task-based documentation like a tutorial? Consider if this change should be announced on your project blog.
  • Does this introduce breaking changes that would require an announcement or bumping the major version?
  • Do all new files have appropriate license header?

Post Merge Requirements

  • MAINTAINERS: manually trigger the "Publish Package" workflow after merging any PR that indicates Helm Chart Change

duffney and others added 15 commits August 16, 2024 05:55
feat: refresher interface

fix: formatting and license

test: kuberefresher

test: kuberefresher helpers

refactor: IsRefreshable KMP interface method

fix: add IsRefreshable method

refactor: kmp spec interval as string

mod: rm todo

mod: rm comment

style: use embedded type

feat: namespaced refresher interface

test: mock factory & test refreshable logic

refactor: use kubeRefreshNamespaced in controller

mod: add license blocks

refactor: kmp.spec.interval default to empty string disabling refresh

tests: increase refresher coverage

refactor(kmp): use factory for creating refresher objects

This change introduces a RefresherFactory that is responsible for creating the
appropriate refresher object based on a configuration that's passed in. This decouples the
reconcile logic from the object creation, making the code more modular and easier to test

mod: rename interval to refreshinterval & adds crd descriptions

mod: remove verbose logging from refresher

docs: kmp refresh interval samples

doc: corrected resource name of akv samples

fix: kmp spec json tag using incorrect values & add refresh interval description

fix: add licenses & update interval name in tests

mod: comments for exported interfaces

test: improve refresher test coverage
Signed-off-by: Joshua Duffney <[email protected]>
Bumps [anchore/sbom-action](https://github.com/anchore/sbom-action) from 0.17.0 to 0.17.1.
- [Release notes](https://github.com/anchore/sbom-action/releases)
- [Commits](anchore/sbom-action@d94f46e...ab9d16d)

---
updated-dependencies:
- dependency-name: anchore/sbom-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Joshua Duffney <[email protected]>
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.0 to 3.26.1.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@eb055d7...29d86d2)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Joshua Duffney <[email protected]>
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.26.1 to 3.26.2.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](github/codeql-action@29d86d2...429e197)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <[email protected]>
Signed-off-by: Joshua Duffney <[email protected]>
@binbin-li binbin-li marked this pull request as draft August 20, 2024 13:39
Copy link

codecov bot commented Aug 21, 2024

Codecov Report

Attention: Patch coverage is 90.74074% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
pkg/executor/core/executor.go 60.00% 2 Missing ⚠️
pkg/keymanagementprovider/keymanagementprovider.go 75.00% 1 Missing ⚠️
pkg/referrerstore/oras/oras.go 87.50% 1 Missing ⚠️
pkg/verifier/factory/factory.go 87.50% 1 Missing ⚠️
Files with missing lines Coverage Δ
...controllers/clusterresource/verifier_controller.go 90.24% <100.00%> (+10.24%) ⬆️
...ntrollers/namespaceresource/verifier_controller.go 90.00% <100.00%> (+10.00%) ⬆️
pkg/controllers/utils/verifier.go 100.00% <100.00%> (ø)
pkg/verifier/notation/certstoresbytype.go 92.59% <100.00%> (ø)
pkg/verifier/notation/notation.go 98.11% <100.00%> (+9.99%) ⬆️
pkg/verifier/notation/truststore.go 93.75% <100.00%> (+9.75%) ⬆️
pkg/keymanagementprovider/keymanagementprovider.go 94.20% <75.00%> (+1.47%) ⬆️
pkg/referrerstore/oras/oras.go 80.97% <87.50%> (+13.18%) ⬆️
pkg/verifier/factory/factory.go 89.65% <87.50%> (+24.13%) ⬆️
pkg/executor/core/executor.go 88.46% <60.00%> (-0.70%) ⬇️

... and 9 files with indirect coverage changes

@binbin-li binbin-li force-pushed the refactor-error-msg branch 4 times, most recently from 4745ef8 to 644e8bb Compare August 22, 2024 08:53
susanshi
susanshi previously approved these changes Aug 29, 2024
Copy link
Collaborator

@susanshi susanshi left a comment

Choose a reason for hiding this comment

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

LGTM , left a minor comment

pkg/controllers/clusterresource/verifier_controller.go Outdated Show resolved Hide resolved
pkg/controllers/namespaceresource/verifier_controller.go Outdated Show resolved Hide resolved
pkg/controllers/utils/verifier.go Outdated Show resolved Hide resolved
pkg/controllers/utils/verifier.go Outdated Show resolved Hide resolved
pkg/keymanagementprovider/keymanagementprovider.go Outdated Show resolved Hide resolved
pkg/executor/core/executor.go Outdated Show resolved Hide resolved
pkg/executor/core/executor.go Outdated Show resolved Hide resolved
pkg/referrerstore/oras/oras.go Outdated Show resolved Hide resolved
pkg/referrerstore/oras/oras.go Outdated Show resolved Hide resolved
pkg/referrerstore/oras/oras.go Outdated Show resolved Hide resolved
pkg/verifier/factory/factory.go Outdated Show resolved Hide resolved
pkg/verifier/factory/factory.go Outdated Show resolved Hide resolved
pkg/verifier/factory/factory.go Outdated Show resolved Hide resolved
pkg/verifier/factory/factory.go Outdated Show resolved Hide resolved
pkg/verifier/notation/certstoresbytype.go Outdated Show resolved Hide resolved
pkg/verifier/notation/certstoresbytype.go Outdated Show resolved Hide resolved
pkg/verifier/notation/certstoresbytype.go Outdated Show resolved Hide resolved
pkg/verifier/notation/notation.go Outdated Show resolved Hide resolved
pkg/verifier/notation/notation.go Outdated Show resolved Hide resolved
pkg/verifier/notation/notation.go Outdated Show resolved Hide resolved
pkg/verifier/notation/notation.go Outdated Show resolved Hide resolved
pkg/verifier/notation/notation.go Outdated Show resolved Hide resolved
pkg/verifier/notation/notation.go Outdated Show resolved Hide resolved
pkg/verifier/notation/notation.go Outdated Show resolved Hide resolved
pkg/verifier/notation/notation.go Outdated Show resolved Hide resolved
pkg/verifier/notation/notation.go Outdated Show resolved Hide resolved
pkg/verifier/notation/truststore.go Outdated Show resolved Hide resolved
@binbin-li
Copy link
Collaborator Author

@yizha1 thanks a lot for your feedback, could you take another look? I've addressed all comments.

Copy link
Collaborator

@yizha1 yizha1 left a comment

Choose a reason for hiding this comment

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

Thanks @binbin-li

LGTM for the first round of improvements.

Copy link
Collaborator

@luisdlp luisdlp left a comment

Choose a reason for hiding this comment

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

LGTM

@binbin-li binbin-li enabled auto-merge (squash) September 9, 2024 15:41
@binbin-li binbin-li merged commit ab8d001 into ratify-project:dev Sep 9, 2024
19 checks passed
akashsinghal pushed a commit to akashsinghal/ratify that referenced this pull request Sep 13, 2024
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.

6 participants