Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GCP - filter - scc findings #6630

Merged
merged 22 commits into from
Apr 24, 2021

Conversation

anovis
Copy link
Contributor

@anovis anovis commented Apr 20, 2021

Allows GCP resources to be filtered on Security Command Center (SCC) findings. So they can be filtered on just if they have findings or further filtered on the findings themselves.

      - name: bucket-contains-finding
        resource: gcp.bucket
        filters:
        - type: scc-finding
          org: 11111111111111

      - name: bucket-contains-high-finding
        resource: gcp.bucket
        filters:
        - type: scc-finding
          org: 11111111111111
          key: "[].finding.category"
          severity: HIGH
          op: contains

filters:
- type: scc-findings
org: 11111111111111
key: "[].finding.severity"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it feels like we should be processing per finding instead of doing so on the set to make matching a little easier, else every key has to be prefixed [].. doing that means we can also annotate the matched finding onto the resource.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was debating whether I should do that or not since the api call also returns a resource section in addition to the finding, but I agree it makes it much cleaner to have it just on the findings, which is the use case we want anyway.

        "finding":{
           ...
         },
        "resource": {
          "name": "//storage.googleapis.com/gcf-sources-2222222222222-us-east1",
          "projectName": "//cloudresourcemanager.googleapis.com/projects/2222222222222",
          "projectDisplayName": "cloud-custodian",
          "parentName": "//cloudresourcemanager.googleapis.com/projects/2222222222222",
          "parentDisplayName": "cloud-custodian"
        }

@anovis
Copy link
Contributor Author

anovis commented Apr 22, 2021

updated filter now filters the findings directly. subsequent scc-findings filters in a policy would filter on the previous findings.

      - name: bucket-contains-high-finding
        resource: gcp.bucket
        filters:
        - type: scc-findings
          org: 11111111111111
          key: severity
          value: HIGH

Copy link
Collaborator

@kapilt kapilt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks! lgtm

@kapilt kapilt merged commit be00024 into cloud-custodian:master Apr 24, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants