Uh oh!
There was an error while loading. Please reload this page.
feat(policies): evaluate policies on attestation push command - #1087
Conversation
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| @@ -0,0 +1,4 @@ | |||
| schemaVersion: "v1" | |||
| policies: | |||
| attestation: | |||
There was a problem hiding this comment.
in the future we should also have some examples with material attachments, all of them in this directory seem to be attestation.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
migmartri
left a comment
There was a problem hiding this comment.
Very nice!
Approving modulo making sure that we are not embedding the policies on contract create/update
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
| if p.PolicyEvaluations == nil { | ||
| p.PolicyEvaluations = make(map[string][]*v1.PolicyEvaluation) | ||
| } | ||
| p.PolicyEvaluations["ATTESTATION"] = policyResults |
There was a problem hiding this comment.
You should use the string representation of the MaterialType enum to avoid future inconsistencies
| p.PolicyEvaluations["ATTESTATION"] =policyResults | |
| p.PolicyEvaluations[schemaapi.CraftingSchema_Material_ATTESTATION.String()] =policyResults |
There was a problem hiding this comment.
Ey, thanks for the suggestion @jotadrilo . But in this case it's not a material, but policies applied to the whole attestation. I know the naming is confusing, we might choose a different key for this particular case. I'll give it a try.
There was a problem hiding this comment.
But you are mapping materials and policies, right? In other words, you are grouping policies by their material name.
If this specific grouping has a different semantic, I'd better use a different field in the in-toto predicate (v2), or add a reserved MaterialType name for this kind of grouping.
There was a problem hiding this comment.
Yes, we were evaluating those options. We'll revisit this in next iterations, as it might be part of a batch with other improvements. Thanks!
| } | ||
| _, err = base64.StdEncoding.Decode(rawMaterial, []byte(envelope.Payload)) | ||
| rawMaterial, err = envelope.DecodeB64Payload() |
There was a problem hiding this comment.
Yes! And it also implements URLEncoding which is is supported by DSSE in addition to StdEncoding.
Signed-off-by: Jose I. Paris <jiparis@chainloop.dev>
This PR is a follow up that connects all the pieces to evaluate any policy present in the schema before pushing the attestation. The PR includes:
Policies can be specified and linked to any schema. For example, this policy can be used to evaluate any material of type SBOM_SPDX_JSON, and check that was created with Syft.
Policy code can also be detached and referenced from the spec. I'll update the documentation in a separate PR.
Then, it can be linked to any contract:
Note the
policies.materialsandpolicies.attestationsection, denoting policies to be applied to all materials or the whole attestation (before signing) accordingly. In the case of materials, since the policy has atypein the specification, it will be applied to all materials that matches that type. There are other options and filters to flexibilize the policy selection criteria, allowing to apply policies to specific materials. For example, it can be filtered by name:If there is no
typein the policy spec, it will be applied regardless the material has a compatible type or not. This is useful for custom validations and artifacts.Closes#122