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

docs: add ratify v2 architecture design proposal #1962

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

binbin-li
Copy link
Collaborator

Description

What this PR does / why we need it:

This PR adds more details and addressed feedback from the previous discussion on the Ratify architecture design v2 proposal: #1942

We already have another PR discussing the v2 scope, this PR just focuses on the system architecture refactoring.

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):

Fixes #1942

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

Copy link

codecov bot commented Dec 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

see 4 files with indirect coverage changes

@binbin-li binbin-li force-pushed the v2-design branch 2 times, most recently from 975e88e to c625568 Compare December 4, 2024 14:36
@susanshi
Copy link
Collaborator

maintainers, please review @FeynmanZhou, @akashsinghal , @susanshi

@FeynmanZhou
Copy link
Collaborator

/cc @DahuK for a review if you are interested

@DahuK
Copy link
Contributor

DahuK commented Dec 10, 2024

/cc @DahuK for a review if you are interested

Thanks Feynman! As an adopter, we are very looking forward to the evolution of v2, especially Image Verification as an important feature of containerd 2.0. If ratify service can be adapted to the Image Transfer service, we will actively embrace such an evolution, and try to integrate this to provide a more flexible way of checking signatures and get rid of the dependency on k8s webhook. And I understand the importance of a loosely coupled and extensible architecture for the project, and will actively cooperate with the integration and transformation work under the v2 framework.

I can't give more suggestions on the implementation details, but we have received some feedback from the users. Here is my two cents: I know that image signing and verification itself is a complex scenario, which depends on the integration of multiple tools and services, and Ratify provides a variety of built-in CRD (store, keymanagementproviders, verifier), which makes it difficult for beginners to troubleshoot and find some common configuration errors, and when the artifacts has multiple signatures, it is also difficult to locate the specific verification report detail in addition to querying the ratify pod logs when encountering signature verification failures.

In the V2 version, is there any consideration for simplifying the cost of configuration? cause some users may only need to the basic verification of the image signature to complete the compliance requirements, it would be better if there were a simple minimal configuration set or best practice guidelines, is it possible for user to do all of the configurations in the v2 config.json with an easy way?

@binbin-li
Copy link
Collaborator Author

/cc @DahuK for a review if you are interested

Thanks Feynman! As an adopter, we are very looking forward to the evolution of v2, especially Image Verification as an important feature of containerd 2.0. If ratify service can be adapted to the Image Transfer service, we will actively embrace such an evolution, and try to integrate this to provide a more flexible way of checking signatures and get rid of the dependency on k8s webhook. And I understand the importance of a loosely coupled and extensible architecture for the project, and will actively cooperate with the integration and transformation work under the v2 framework.

I can't give more suggestions on the implementation details, but we have received some feedback from the users. Here is my two cents: I know that image signing and verification itself is a complex scenario, which depends on the integration of multiple tools and services, and Ratify provides a variety of built-in CRD (store, keymanagementproviders, verifier), which makes it difficult for beginners to troubleshoot and find some common configuration errors, and when the artifacts has multiple signatures, it is also difficult to locate the specific verification report detail in addition to querying the ratify pod logs when encountering signature verification failures.

In the V2 version, is there any consideration for simplifying the cost of configuration? cause some users may only need to the basic verification of the image signature to complete the compliance requirements, it would be better if there were a simple minimal configuration set or best practice guidelines, is it possible for user to do all of the configurations in the v2 config.json with an easy way?

thanks for the feedback and suggestion! Ratify v2 is designed to be more extensible to new scenarios including the containerD.
We have considered supporting this scenario before, and @akashsinghal already made a POC. We will allocate more resources to this feature after the V2 framework is complete. In the meantime, we also encourage everyone to contribute to these new features.

For the configuration refactoring, we have another PR referring to it. We also heard similar feedback on the setting up the configuration. Therefore, it's also in v2 scope to make it more straighforward to configure Ratify. And if you have any ideas on better user experience, feel free to leave comments.

As for troubleshooting, we also kept improving the user experience since v1, and will continue in v2. One possible improvement is to refactor the Policy Provider to make it return a more clear report when errors happen.

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.

PR looks great, having the diagram is very helpful Binbin, we should include them on the Ratify website! Left some questions.

1. Ratify only supports CLI and K8s scenarios. But actually current Ratify is only well implemented/designed for K8s scenarios. There are some feature gaps between CLI and K8s implementations. To support more scenarios, like containerd plugins or docker plugins, or just a library for downstream services, we need to make Ratify to be more extensible.
2. Ratify was designed to validate security metadata of any given artifacts. But right now Ratify is mainly focusing on the K8s scenarios with images being verified.
3. The plugin framework was designed to separate built-in and external plugins. Built-in plugins run in the same process of Ratify while each external plugin would be executed in a new subprocess. Therefore, external plugins cannot share the in-momory cache with the main process, which may result to performance degradation, data inconsistency, race condition and security vulnerabilties.
4. The built-in plugins and authentication for different cloud providers are part of the main Ratify repository, which introduces a significant number of dependencies. This issue will become even more pronounced as additional cloud provider and new plugin implementation are added in the future.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @binbin-li , after the refactoring, will auth providers be in Ratify core, have we called this out already?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ratify core will just define the Store interface without its implementation. The auth provider will belong to oras implementation repo.

# Command to run the executable
CMD ["./main"]
```
In the above example, the only dependency of Ratify repo is the Ratify core library. And users could select appropriate interface implementations based on need in the Dockerfile.
Copy link
Collaborator

Choose a reason for hiding this comment

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

just clarify, we will have docker files for each entry point ( cli , k8s)?

Copy link
Collaborator

Choose a reason for hiding this comment

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

we Ratify have a docker image with the default verifiers?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good question!

  1. For different repos, like ratify-cli, ratify, they will different scripts and Dockerfile for each.
  2. For ratify repo, users might have different scenarios to integrate different plugins. I plan to have one Dockerfile along with a script so that users can just pass in different plugin paths to it instead of writing different Dockerfiles.
  3. And ratify repo should also ship one or a few images with default verifiers that cover common user scenarios.

7. **Customized App**: The customized app can be any application behaves in a similar was as the middleware. It will be responsible for handling its own input and invoking the core logic to validate the security metadata of the artifacts and rendering its own output.

### Deisgn Details
Below is a more detailed design of the proposed architecture of Ratify v2. Note that text in red indicates a repository under `ratify-project` organization.
Copy link
Collaborator

Choose a reason for hiding this comment

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

the v2 diagram doesn't show the cache component. Will all plugins share the oras cache in v2?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yes, the new diagram focuses on the core and plugins. Oras cache will reside in the oras implementation. And since all plugins will run in the host process as library, the oras cache is also in the host process which can be safely shared by verifiers. I'll add it to the doc as well.

### Limitations
1. Ratify only supports CLI and K8s scenarios. But actually current Ratify is only well implemented/designed for K8s scenarios. There are some feature gaps between CLI and K8s implementations. To support more scenarios, like containerd plugins or docker plugins, or just a library for downstream services, we need to make Ratify to be more extensible.
2. Ratify was designed to validate security metadata of any given artifacts. But right now Ratify is mainly focusing on the K8s scenarios with images being verified.
3. The plugin framework was designed to separate built-in and external plugins. Built-in plugins run in the same process of Ratify while each external plugin would be executed in a new subprocess. Therefore, external plugins cannot share the in-momory cache with the main process, which may result to performance degradation, data inconsistency, race condition and security vulnerabilties.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
3. The plugin framework was designed to separate built-in and external plugins. Built-in plugins run in the same process of Ratify while each external plugin would be executed in a new subprocess. Therefore, external plugins cannot share the in-momory cache with the main process, which may result to performance degradation, data inconsistency, race condition and security vulnerabilties.
3. The plugin framework was designed to separate built-in and external plugins. Built-in plugins run in the same process of Ratify while each external plugin would be executed in a new subprocess. Therefore, external plugins cannot share the in-memory cache with the main process, which may result to performance degradation, data inconsistency, race condition and security vulnerabilities.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: you may scan and check typos in this design proposal

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.

Ratify v2 architecture proposal
4 participants