Action policy templates
Learn about the predefined action policy templates and how to customize them.
Action policies define the workflows that are triggered when the application encounters a given set of criteria (a.k.a. findings).
For example, action policies can be used to:
You can view, enable, clone disable, edit, or delete your Endor Labs action policies.
You can create an action policy in Endor Labs to perform a given action when a given set of conditions are met.
Sign in to Endor Labs, and select Policies from the left sidebar.
Click on the Action Policies tab.
Click Create Action Policy to create a new action policy.
First, you must Define a Policy. Choose a policy template and define the criteria for the action. For more information, see Action policy templates.
Next, Choose an Action to take when the policy criteria are met.
Choose Enforce Policy to define the behavior of endorctl scans.
--exit-on-policy-warning
flag.Choose Send Notification to create a ticket or send a custom message to an integrated notification system.
Assign Scope for which this action policy should apply. Scopes are defined by the tags assigned to a project.
Note: You can set custom tags for your projects from Projects > Settings > Custom Tags. See also Tagging projects.
Name Your Action Policy.
Advanced: When you define a policy you do so for the current namespace and all child namespaces. If you do not want the policy to be applied to any child namespaces, click Advanced and deselect Propagate this policy to all child namespaces.
Click Create Action Policy. The policy will be enabled by default.
Write an action policy from scratch using the OPA Rego policy language.
Sign in to Endor Labs, and select Policies from the left sidebar.
Click Create Action Policy.
Choose From Scratch to author an action policy.
Enter the Rego rule for the policy in Rego Definition. For instance, the following Rego rule identifies all repository version findings that are not present in the baseline. Action policies should only operate on Findings. For more information about findings, see the Finding resource kind documentation.
package examples
match_baseline(finding) {
some i
data.baseline.Finding[i].meta.description == finding.meta.description
}
match_repo_version_finding[result] {
some i
data.resources.Finding[i].meta.parent_kind == "RepositoryVersion"
not match_baseline(data.resources.Finding[i])
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.examples.match_repo_version_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>
. The corresponding baseline records are available under data.baseline.<ResourceKind>
. Note: Action policies should only operate on Findings.
See steps 5-9 above under Create an action policy from template
All action 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 creating the policy. However, please note that the logic cannot be fully validated without input data.
See the endorctl validate policy command for details on how to validate a custom policy and inspect the matches returned for a given project.
Aggregation types for notifications streamline the organization and management of findings for efficient workflow. By default, all project findings are included in a single notification. With the option to select aggregation types, notifications can be tailored to specific criteria based on dependencies. This customization simplifies developer actions and enhances productivity.
Endor Labs enables you to choose the following notification aggregation types, each offering distinct benefits:
For Jira integration notifications, a parent ticket is created with the selected issue type, either Task or Bug. The parent ticket includes the project name. Each identified dependency is grouped under a dedicated sub-ticket. The sub-ticket includes both the project name and dependency name. Findings without any dependency are grouped in a separate sub-ticket. During future scans, the existing sub-ticket status is updated or resolved. If a new dependency is found, a new sub-ticket is created.
Learn about the predefined action 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.