Apply a policy to Projects
After applying Project attributes to your Projects, you can create policies that apply to those attributes. Projects and policies are linked based on the attributes assigned to the policy.
Policies assigned to Project attributes always take precedence over policies assigned to Organizations.
A policy can be applied to one or multiple Project attributes; but a set of attributes can only be assigned to one policy. For example, if there is already a policy applied to
Frontend, you cannot create another policy that matches only these exact attributes.
Policies assigned to project attributes apply when running snyk monitor in the CLI, assuming it runs on a CLI project with project attributes applied. Project attribute policies do not apply to snyk test
To add an attribute, click on the desired attribute checkbox(es) from the attribute selector panel.
To remove an attribute from a policy, uncheck the desired attribute checkbox(es) from the attribute selector panel.
Add a policy attribute
You can create and save a policy where no attributes are selected, for example, if you have not yet decided which attributes should be associated with that policy. This policy does not apply to projects where all attributes are left blank.
To be associated with a policy, a Project must have all the attributes listed on the policy (the Pincluderoject could also have more attributes that are not listed on the policy).
For example, if you have a policy assigned to
Frontend, this policy applies to projects which include those same attributes, but not to a project with the attributes
Here is our sample policy:
Here is a Project that will inherit the policy:
Project inheriting a policy
Here is a project that will not inherit the policy:
Project not inheriting a policy
Multiple policies can apply to a Project. For example, if you have a policy assigned to
Externaland another policy assigned to
Production. If you then have a Project with attributes
Production, it could have either of these policies applying.
If multiple policies can be applied to a project, the order of the policies on the policy manager page determines precedence. The policy closest to the top of the list takes precedence over other applicable policies below it. To change the order of policies, either drag and drop the policies into the right order, or use the ... button on the right hand side to move the policy up or down in the list.
Change policy order