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
feat(general): add policy metadata filter exception flag #6132
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kartikp10
had a problem deploying
to
scan-security
March 30, 2024 03:40
— with
GitHub Actions
Failure
kartikp10
had a problem deploying
to
scan-security
March 30, 2024 17:28
— with
GitHub Actions
Failure
mikeurbanski1
approved these changes
Apr 2, 2024
@@ -468,6 +468,13 @@ def add_parser_args(self) -> None: | |||
"information on allowed filters. Format: policy.label=test,cloud.type=aws ", | |||
default=None, | |||
) | |||
self.add( | |||
"--policy-metadata-filter-exception", | |||
help="comma separated key:value string to exclude filtered policies based on Prisma Cloud policy metadata. " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a description of what happens when you use both options (the subtraction logic), to this as well as to the other one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✅
kartikp10
had a problem deploying
to
scan-security
April 2, 2024 16:23
— with
GitHub Actions
Failure
ChanochShayner
approved these changes
Apr 2, 2024
pull bot
pushed a commit
to tooniez/checkov
that referenced
this pull request
Apr 3, 2024
…o#6132) * add exception flag * add tests * add type hints * refine help text
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Description
Adds a new
--policy-metadata-filter-exception
flag that can only be used with a Prisma Cloud API key. This adds the ability to exclude checks based on policy metadata filters.Filters can be specified in a comma-separated key-value list, for example:
When you list checks with a filter, checks returned by the filter are excluded.
Some important behaviors:
If a filter is invalid, checkov will continue execution with a warning and will run as though no filters were specified.
If
--policy-metadata-filter
and--policy-metadata-filter-exception
are simultaneously used, the former is applied first, then the checks returned by the exception flag are removed. For example:CRITICAL
EXCEPTION
Running the following command will result in only running policy P3. P1 and P2 will not be executed (not skipped).
Checklist: