Skip to content

Add scan action filter to scanExecutionPolicies graphql query

Sashi Kumar Kumaresan requested to merge sk/344687-scan-type-filter into master

What does this MR do and why?

Addresses #344687 (closed)

This MR adds action_scan_types filter to scanExecutionPolicies graphql resolver.

Screenshots or screen recordings

Policies containing given scan action Screenshot_2021-11-12_at_7.19.29_PM

No policies with given scan action Screenshot_2021-11-12_at_7.19.42_PM

Policies Screenshot_2021-11-12_at_7.26.28_PM

How to set up and validate locally

  1. Go to Security Policy -> Policies, click on New Policy, select Scan Execution as Policy type.

  2. Paste policy:

    type: scan_execution_policy
    name: Container Scanning Policy
    description: This policy executes container scanning on the project
    enabled: false
    rules:
    - type: pipeline
      branches:
      - main
    actions:
    - scan: container_scanning
  3. Create new MR with updated policy and hit merge.

  4. Go to graphql-explorer and run the query:

query {
  project(fullPath:<project_path>) {
    scanExecutionPolicies(actionScanTypes:[CONTAINER_SCANNING]) {
      nodes {
        name
        description
        yaml
      }
    }
  }
} 

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Sashi Kumar Kumaresan

Merge request reports