Create SLSA policies
Create SLSA policies using OPA.
This document provides a step-by-step guide on how to create SLSA Policies. Go to write policy definitions to learn how to write these policies. To learn about implementing SLSA policies, follow the instructions in the section on enforcing SLSA policies.
Before you begin
As you learn to create SLSA policies, ensure you thoroughly review
The Harness Policy Library provides sample policies that simplify the process of creating and enforcing them against SLSA. Here is a guide on how to utilize these samples for policy creation.
Create SLSA policies
You must create a set of OPA policies that you want Harness SCS to use for SLSA Provenance verification. You can create a dedicated SLSA Provenance verification policy set or use existing policy sets that you have already created. Go to the Harness Policy As Code overview to create policies in Harness.
In your Harness Project, under Project Setup, go to Policies. You can also create policies at the Account and Org scopes.
Select Policies, and then create policies for the individual rules that you want to enforce. You can select from the policy library or write your own policies.
Create policy sets to group related policies. You must have at least one policy set.
SLSA policy example
Here is an example of an OPA policy that could be used to verify an SLSA Provenance generated in Harness. If you are verifying provenance from a third-party build system provider, make sure your OPA policies reflect the provenance structure used by that build system provider. Different providers might use different SLSA Provenance structures.
Validate repo and branch:
Validate trigger type:
Validate pipeline identifier:
For more examples, go to Policy samples.
Last updated
Was this helpful?