Exception policy templates
Learn about the predefined exception policy templates and how to customize them.
Exception policies define the conditions for applying an exception to a finding. When an exception is applied to a finding, it is tracked as an exception and action policies do not apply to it. Findings with exceptions are filtered out from Endor Labs reports by default.
For example, exception policies can be used to:
You can view, enable, clone, disable, edit, or delete your Endor Labs exception policies.
You can create an exception policy in Endor Labs to apply an exception to a finding when a given set of conditions are met.
Sign in to Endor Labs, and select Policies & Rules from the left sidebar.
Select Exception Policies.
Click Create Exception Policy.
In Define Exception Criteria, choose a policy template and define the criteria for the exception.
See exception policy templates to choose a template and define the criteria for the exception.
Next, you must Choose a Reason for your exception and set an expiration time for the exception.
30
, 60
, 90
days, or Never
.Assign Scope for which this exception policy should apply. Scopes are defined by the tags assigned to a project.
Finally, you must Name Your Exception Policy.
Advanced: When you define a policy, it applies to the current namespace and all its child namespaces. To prevent the policy from being applied to any child namespace, click Advanced and deselect Propagate this policy to all child namespaces.
Click Create Exception Policy. The policy is enabled by default.
Write an exception policy from scratch using the OPA Rego policy language.
You can create an exception policy in Endor Labs to apply an exception to a finding when a given set of conditions are met.
Sign in to Endor Labs, and select Policies from the left sidebar.
Click on the Exception Policies tab.
Click Create Exception Policy to create a new exception policy
First, choose From Scratch to author an exception policy under Define Exception Criteria.
Next, you must Choose a Reason for your exception and set an expiration time for the exception.
Enter the Rego rule for the policy in Rego Definition. For example, the following Rego rule recognizes a set of 3 vulnerabilities acknowledged by an organization, with an organization-wide exception. For more information about findings, see the Finding resource kind documentation.
package exceptions
match_vuln_id(finding, ids) {
finding.spec.finding_metadata.vulnerability.meta.name = ids[_]
}
match_vuln_id(finding, ids) {
finding.spec.finding_metadata.vulnerability.spec.aliases[_] = ids[_]
}
match_finding[result] {
some i
ids := ["CVE-2020-10683", "CVE-2019-0231", "CVE-2017-0144"]
match_vuln_id(data.resources.Finding[i], ids)
result = {
"Endor" : {
"Finding" : data.resources.Finding[i].uuid
}
}
}
Enter the OPA Query Statement for the rule in the following format: data.<package-name>.<function-name>
. For the example above the query statement is data.exceptions.match_finding
.
Select the Resource Kinds required to evaluate the policy. For the example above, the required resource kind is Finding
. The requested resource kind records for the current scan are made available to the Rego code under data.resources.<ResourceKind>
.
Assign Scope for which this exception policy should apply. Scopes are defined by the tags assigned to a project.
Finally, you must Name Your Exception Policy.
Advanced: When you define a policy, it applies to the current namespace and all its child namespaces. To prevent the policy from being applied to any child namespace, click Advanced and deselect Propagate this policy to all child namespaces.
Click Create Exception Policy. The policy is enabled by default.
All exception policies must list the matching Finding UUID under “Endor” in the following format.
foo[result] {
<match conditions>
result = {
"Endor": {
Finding: <finding-uuid>
}
}
}
The application verifies the Rego syntax and query statement before generating the policy. However, it is important to note that the logic cannot be completely validated without input data.
See the endorctl validate policy command for instructions on validating a custom policy and inspecting the matches returned for a specific project.
Learn about the predefined exception policy templates and how to customize them.
Was this page helpful?
Thanks for the feedback. Write to us at support@endor.ai to tell us more.
Thanks for the feedback. Write to us at support@endor.ai to tell us more.