-
Notifications
You must be signed in to change notification settings - Fork 18
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
policy-server seems to pull cached OCI artifacts regardless of hot cache #883
Comments
I've tested the code. Everything is working as described:
If a container image is not signed, getting its signature will fail. Hence whenever a workload uses an unsigned image we will keep reaching to the remote registry until a signature blob is found. In the setup described above, the audit-scanner performs an assessment every 2 minutes. That means the cache is always empty when the scanner is initiated. However, if multiple workloads are using the same image, the remote registry is interrogated only once. We could provide a configuration knob that sets the cache expiration time. @recena: do you have any opinion? I know the potential bug was reported by you. |
Moving to blocked, waiting for feedback |
I'm not sure If I understand the scenario, but:
|
We're caching the valid images, but we expire the cache after 1 minute. That's because someone in the meantime might overwrite a tag. For example:
Right now we're conservative, being a security project, and we let the cache expire after 1 minute. I think we should allow the user to configure the cache expiration time. In this way the user could define a value that is the right tradeoff between the two cases (talking too much with a registry vs having stale data). |
We're going to refine this card as part of 1.18, and work on this improvement during 1.19. I would like to come up with a solution that allows the policy to configure the caching interval, so that the k8s admin can put a value that makes him comfortable |
I propose to define a new host capability about caching. The new capability will allow the policy author to cache arbitrary data. We will then update the Steps required to solve this issue:
|
Deploying Kubewarden with Audit Scanner enabled, and configured to run every 2 minutes,
Deploying verify-image-signatures policy configured to verify Application Collection images following the instructions in kubewarden/docs#443,
It seems that the PolicyServer still exercises the OCI registry instead of consuming from its cache, when calling:
https://github.com/kubewarden/policy-evaluator/blob/3cd66b932b199037e677e3e204d4d9742e23edc8/src/callback_handler/sigstore_verification.rs#L251-L266
Acceptance criteria
Verify that policy-server cache for context-aware calls is correctly configured.
Configure the cache in policy-evaluator as needed.
Add tests as needed.
The text was updated successfully, but these errors were encountered: