-
Notifications
You must be signed in to change notification settings - Fork 38
feat(policy): Avoid policy evaluation creation #1933
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
Conversation
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
} | ||
|
||
result = append(result, ev) | ||
if ev != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would mean that there is no policy evaluation result for the attachment. This will happen when ALL execution paths of the multipolicy have been either not chosen (because the material type doesn't match), or ignored (because of this new feature), right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, the same that will happen with a multikind policy where all of the policies are ignored, no policy evaluation result.
We need to check the side implications.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it will be fine, since the consequence is that the policy evaluation is not added to the attestation, which is what we wanted. I'll double check other side effects.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Jose
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Tackled feedback coming back to the original proposal of |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @javirln
This patch introduces a way for a policy definition to instruct the policy engine to completely ignore an evaluation and prevent the creation of a policy evaluation.
This is achieved through a new result field,
ignore
, which signals whether the policy evaluation should be created. If a policy consists of multiple scripts and one of them returnsignore=true
, that script’s evaluation is excluded from the final result. If it’s the only script, no policy evaluation is created at all.By default, all existing policies are not ignored unless explicitly modified.