-
Notifications
You must be signed in to change notification settings - Fork 38
refactor: run attestation-level policy evaluations in crafting layer #1689
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
refactor: run attestation-level policy evaluations in crafting layer #1689
Conversation
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
Signed-off-by: Miguel Martinez <miguel@chainloop.dev>
|
|
||
| // execute policy evaluations | ||
| // We do not want to evaluate policies here during render since we want to do it in a separate step | ||
| statement, err := renderer.RenderStatement(ctx) |
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 thought about also running it on att.add but I am not sure it's needed yet.
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.
Probably not, since we want to block only on "push"
| } | ||
|
|
||
| // We do not want to evaluate policies here during render since we want to do it in a separate step | ||
| statement, err := renderer.RenderStatement(ctx, chainloop.WithSkipPolicyEvaluation(true)) |
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.
renderer never evaluates policies anymore
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.
Looks great!
| // addPolicyResults adds policy evaluation results to the statement. It does it by deserializing the predicate from a structpb.Struct, | ||
| // filling PolicyEvaluations, and serializing it again to a structpb.Struct object, using JSON as an intermediate representation. | ||
| // Note that this is needed because intoto predicates are generic structpb.Struct | ||
| func addPolicyResults(statement *intoto.Statement, policyResults []*v1.PolicyEvaluation) error { |
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 love this change.
…hainloop-dev#1689) Signed-off-by: Miguel Martinez <miguel@chainloop.dev> Signed-off-by: Austin Arlint <aarlint@gmail.com>
Runs the attestation-related policy evaluations in the crafting layer storing it in the state.
This is a pre-requisite for #1685.
In practice nothing changes except that policy-level evaluations happen in
statusandpushand then the renderer layer just takes the info in the state.