Skip to content

Conversation

javirln
Copy link
Member

@javirln javirln commented Apr 1, 2025

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 returns ignore=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.

Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@javirln javirln requested review from migmartri and jiparis April 1, 2025 09:14
@javirln javirln self-assigned this Apr 1, 2025
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
}

result = append(result, ev)
if ev != nil {
Copy link
Member

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?

Copy link
Member Author

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.

Copy link
Member

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.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks Jose

javirln added 2 commits April 1, 2025 12:50
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
Signed-off-by: Javier Rodriguez <javier@chainloop.dev>
@javirln
Copy link
Member Author

javirln commented Apr 1, 2025

Tackled feedback coming back to the original proposal of ignore field which has a default value of false.

Copy link
Member

@migmartri migmartri left a comment

Choose a reason for hiding this comment

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

Thanks @javirln

@javirln javirln merged commit d94d70e into chainloop-dev:main Apr 2, 2025
13 checks passed
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.

3 participants