-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(terraform): Add multi skip inline suppression (#6860)
Add multi inline suppression
- Loading branch information
Showing
4 changed files
with
69 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
import re | ||
|
||
COMMENT_REGEX = re.compile(r'(checkov:skip=|bridgecrew:skip=) *([A-Za-z_\d]+)(:[^\n]+)?') | ||
COMMENT_REGEX = re.compile(r'(checkov:skip=|bridgecrew:skip=) *([A-Za-z_\d]+(?:,[A-Za-z_\d]+)*)?(:[^\n]*)?') |
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
40 changes: 40 additions & 0 deletions
40
tests/terraform/context_parsers/mock_tf_files/inline_suppression.tf
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
resource "aws_s3_bucket" "multi-line-multi-checks" { | ||
region = "var.region" | ||
#checkov:skip=CKV_AWS_93,CKV_AWS_21:Skip all | ||
#checkov:skip=CKV_AWS_145:The bucket is a public static content host | ||
bucket = "local.bucket_name" | ||
force_destroy = true | ||
acl = "public-read" | ||
} | ||
|
||
resource "aws_s3_bucket" "multi-line-no-comment" { | ||
region = "var.region" | ||
#checkov:skip=CKV_AWS_93: | ||
#checkov:skip=CKV_AWS_145:The bucket is a public static content host | ||
bucket = "local.bucket_name" | ||
force_destroy = true | ||
acl = "public-read" | ||
} | ||
|
||
resource "aws_s3_bucket" "one-line-one-check" { | ||
region = "var.region" | ||
#checkov:skip=CKV_AWS_145:The bucket is a public static content host | ||
bucket = "local.bucket_name" | ||
force_destroy = true | ||
acl = "public-read" | ||
} | ||
|
||
resource "aws_s3_bucket" "one-line-multi-checks" { | ||
region = "var.region" | ||
#checkov:skip=CKV_AWS_93,CKV_AWS_145:skip all | ||
bucket = "local.bucket_name" | ||
force_destroy = true | ||
acl = "public-read" | ||
} | ||
|
||
resource "aws_s3_bucket" "no-comment" { | ||
region = "var.region" | ||
bucket = "local.bucket_name" | ||
force_destroy = true | ||
acl = "public-read" | ||
} |
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