Policy Groups
Group policies together to simplify their management.
Overview
This feature allow operators to group related policies into one single entity that can be reused across the organization. With Policy Groups, materials and policies can be enforced in Chainloop contracts with little or no effort.
For example, they might want to create a “SBOM quality” group with some SBOM-related policies. The policy groups can be defined this way:
Using Policy Groups
This policy group could be applied to any contract:
As we introduced earlier, policy groups define both materials and policies applied to them. Once they are included to a contract,
they become part of the contract. From this point of view, they can be seen as subcontracts, as they can also be used to enforce materials to be present in the attestation.
For example, after applying the above contract, doing an attestation push
would fail until the required material is provided:
Policy group parameters
In the same way as policies, groups can accept arguments, which are specified in the inputs
section.
Then those inputs can be passed down to policies using interpolation.
In the example above, bannedComponents
input parameter (which is mandatory) is passed to the underlying policy with the expression {{ inputs.bannedComponents }}
Using placeholders in material names
In the previous example, our policy group enforces a sbom
material. But what if our contract requires multiple SBOMs (because we are building several images in the same pipeline, for example)?
By using parameters and placeholders in material names, we can add as many instances of the same policy group as we need:
In our contract:
And finally, in our attestation, we can see the new configuration applied: