How to Create Insight Filter Policy in StackGuardian via API #147
refeed
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
What are Policies?
Policy is a construct in the StackGuardian Platform. Its job is to contain a policy definition that will be applied to another construct like Workflow or Insights findings.
As of now, there are two types of Policy:
GENERAL: the original Policy type. Policies that have this type will be able to be applied to construct like Workflow.FILTER.INSIGHT: Policies that control what findings will be excluded from Insight report.How to create a Insight Filter Policy?
Insight Filter is a Policy type that contains a filter definition that will be applied to the Insight view finding reports. With Insight Filter, we can exclude findings that matches the filters defined so that they won't appear in the main Insight dashboard.
For this, we'll use the Create Policy API
To create an insight filter policy, we first need to define our filter. A filter is a key value pairs with the key having the filter name, and the value is the filter value. It also has an extra key called
ignoreUntil, which is a timestamp, when the value isnull, the filter will be effective forever. Please see the example below.{ "CSP": ["AWS"], "benchmark": ["gdpr"], "ignoreUntil": 1735715376000 // This is timestamp in millisecond }The filter above will match all of the findings that of CSP
AWS, having the benchmark ofgdpr, and it will be effective until January 1st 2025. After the filter is made, we can finally wrap it insideexclude_ruleslist. Please see the example below.This payload will create an Insight Filter that will exclude findings that have
controlIdofaws_thrifty.control.lambda_function_with_gravitonand the filter will ignore the matching findings forever.{ "ResourceName": "ignore_thrifty_graviton", "Description": "We always use x86 lambda", "Tags": [], "PolicyType": "FILTER.INSIGHT", "PoliciesConfig": [ { "name": "Rule-1", "policyInputData": { "data": { "exclusion_rules": [ { "controlId": ["aws_thrifty.control.lambda_function_with_graviton"], "ignoreUntil": null } ] }, "schemaType": "FILTER_INSIGHT_JSON", "schemaVersion": "V1" } } ] }Please note that, every policy of type
FILTER.INSIGHTcan only contain one filter rule as of now.Here are the available filters that can be put inside the
exclusion_ruleskey:CSPAWS,AZURE, orGCP)severityCritical,High,Medium,Low)benchmarkthrifty,gdpr)integrationsaws-prod)resourceregioneu-central-1, `globalcontrolTitlecontrolIdaccountIdBeta Was this translation helpful? Give feedback.
All reactions