bridgecrewio / checkov

Prevent cloud misconfigurations and find vulnerabilities during build-time in infrastructure as code, container images and open source packages with Checkov by Bridgecrew.
https://www.checkov.io/
Apache License 2.0
7.03k stars 1.1k forks source link

platform(general): Fix policy.name to use the spaces as specified on CLI. #6296

Closed jpaloalto closed 4 months ago

jpaloalto commented 4 months ago

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

PR Title

platform(general): Fix policy.name to use the spaces as specified on CLI.

Description

When adding the flag policy.name with a valid value of a particular policy, only that policy should run and return in the result.

checkov -f main.tf --skip-results-upload --repo-id ts/test --policy-metadata-filter policy.name="Data exfiltration allowed without resource constraints"

Instead all the policies are returned (and hence run). This is fixed by handling the spaces in the policy names and leading and trailing whitespaces appropriately.

Fixes # (issue) When adding the flag policy.name with a valid value of a particular policy, only that policy should run and return in the result. Instead all the policies are returned (and hence run)

Fix

This is fixed by handling the spaces in the policy names and leading and trailing whitespaces appropriately.

Checklist: