-
Notifications
You must be signed in to change notification settings - Fork 294
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(knative&crossplane): add support to knative and crossplane (#5634)
* stage * add constants and change tests * crossplane aws queries * add crossplane azure queries * crossplane gcp queires * update * build(deps): bump github.com/BurntSushi/toml from 1.1.0 to 1.2.0 (#5627) Bumps [github.com/BurntSushi/toml](https://github.com/BurntSushi/toml) from 1.1.0 to 1.2.0. - [Release notes](https://github.com/BurntSushi/toml/releases) - [Commits](BurntSushi/toml@v1.1.0...v1.2.0) --- updated-dependencies: - dependency-name: github.com/BurntSushi/toml dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * build(deps): bump github.com/aws/aws-sdk-go from 1.44.58 to 1.44.59 (#5628) Bumps [github.com/aws/aws-sdk-go](https://github.com/aws/aws-sdk-go) from 1.44.58 to 1.44.59. - [Release notes](https://github.com/aws/aws-sdk-go/releases) - [Changelog](https://github.com/aws/aws-sdk-go/blob/main/CHANGELOG.md) - [Commits](aws/aws-sdk-go@v1.44.58...v1.44.59) --- updated-dependencies: - dependency-name: github.com/aws/aws-sdk-go dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * docs(kicsbot): update images digest (#5629) * fix(detector): fixed memory leak (#5626) Co-authored-by: João Reigota <joao.reigota@checkmarx.com> Co-authored-by: Rafaela Soares <rafaelamsoaressilva@gmail.com> * add check for apiVersion * fix type bug * delete crossplane demo file * update github actions * delete knative folder and change regex expressions * update regex * update parser supported types * push changes * update metrics and main_test.go * change queries to use rego walk function * RDS Instance * update changes * add changes * change package-lock * package lock changes * package lock * add getPath to crossplane lib * correct typos and metadata info * correction Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: kicsbot <76819998+kicsbot@users.noreply.github.com> Co-authored-by: Rafaela Soares <rafaela.soares@checkmarx.com> Co-authored-by: João Reigota <joao.reigota@checkmarx.com> Co-authored-by: Rafaela Soares <rafaelamsoaressilva@gmail.com>
- Loading branch information
1 parent
04c442b
commit fbfa9e5
Showing
141 changed files
with
3,048 additions
and
97 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
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,13 @@ | ||
package generic.crossplane | ||
|
||
import data.generic.common as common_lib | ||
|
||
getPath(path) = result { | ||
count(path) > 0 | ||
path_string := common_lib.concat_path(path) | ||
out := array.concat([path_string], ["."]) | ||
result := concat("", out) | ||
} else = result { | ||
count(path) == 0 | ||
result := "" | ||
} |
4 changes: 2 additions & 2 deletions
4
assets/queries/ansible/aws/cloudfront_logging_disabled/metadata.json
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
4 changes: 2 additions & 2 deletions
4
assets/queries/ansible/aws/cloudfront_logging_disabled/test/positive_expected_result.json
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
2 changes: 1 addition & 1 deletion
2
assets/queries/ansible/aws/cloudfront_without_waf/metadata.json
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
2 changes: 1 addition & 1 deletion
2
assets/queries/ansible/aws/cloudfront_without_waf/test/positive_expected_result.json
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
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
28 changes: 1 addition & 27 deletions
28
assets/queries/ansible/aws/elb_using_weak_ciphers/query.rego
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -11,6 +11,7 @@ | |
} | ||
], | ||
"DistributionConfig": { | ||
"Enabled": true, | ||
"CacheBehaviors": [ | ||
{ | ||
"LambdaFunctionAssociations": [ | ||
|
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
11 changes: 11 additions & 0 deletions
11
assets/queries/crossplane/aws/cloudfront_logging_disabled/metadata.json
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,11 @@ | ||
{ | ||
"id": "7b590235-1ff4-421b-b9ff-5227134be9bb", | ||
"queryName": "CloudFront Logging Disabled", | ||
"severity": "MEDIUM", | ||
"category": "Observability", | ||
"descriptionText": "AWS CloudFront distributions must have logging enabled, which means the attribute 'logging' must be defined with 'enabled' set to true", | ||
"descriptionUrl": "https://doc.crds.dev/github.com/crossplane/provider-aws/cloudfront.aws.crossplane.io/Distribution/v1alpha1@v0.29.0#spec-forProvider-distributionConfig-logging", | ||
"platform": "Crossplane", | ||
"descriptionID": "48cd0b5a", | ||
"cloudProvider": "aws" | ||
} |
70 changes: 70 additions & 0 deletions
70
assets/queries/crossplane/aws/cloudfront_logging_disabled/query.rego
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,70 @@ | ||
package Cx | ||
|
||
import data.generic.common as common_lib | ||
import data.generic.crossplane as cp_lib | ||
|
||
CxPolicy[result] { | ||
docs := input.document[i] | ||
[path, resource] := walk(docs) | ||
startswith(resource.apiVersion, "cloudfront.aws.crossplane.io") | ||
resource.kind == "Distribution" | ||
destribution_config := resource.spec.forProvider.distributionConfig | ||
destribution_config.enabled == true | ||
|
||
destribution_config.logging.enabled == false | ||
|
||
result := { | ||
"documentId": input.document[i].id, | ||
"resourceType": resource.kind, | ||
"resourceName": resource.metadata.name, | ||
"searchKey": sprintf("%smetadata.name={{%s}}.spec.forProvider.distributionConfig.logging.enabled", [cp_lib.getPath(path), resource.metadata.name]), | ||
"issueType": "IncorrectValue", | ||
"keyExpectedValue": "CloudFront logging enabled attribute should be set to true", | ||
"keyActualValue": "CloudFront logging enabled attribute is set to false", | ||
"searchLine": common_lib.build_search_line(path, ["spec", "forProvider", "distributionConfig", "logging", "enabled"]), | ||
} | ||
} | ||
|
||
CxPolicy[result] { | ||
docs := input.document[i] | ||
[path, resource] := walk(docs) | ||
startswith(resource.apiVersion, "cloudfront.aws.crossplane.io") | ||
resource.kind == "Distribution" | ||
destribution_config := resource.spec.forProvider.distributionConfig | ||
destribution_config.enabled == true | ||
|
||
not common_lib.valid_key(destribution_config.logging, "enabled") | ||
|
||
result := { | ||
"documentId": input.document[i].id, | ||
"resourceType": resource.kind, | ||
"resourceName": resource.metadata.name, | ||
"searchKey": sprintf("%smetadata.name={{%s}}.spec.forProvider.distributionConfig.logging", [cp_lib.getPath(path), resource.metadata.name]), | ||
"issueType": "MissingAttribute", | ||
"keyExpectedValue": "CloudFront logging enabled attribute should be defined and set to true", | ||
"keyActualValue": "CloudFront enable is not defined", | ||
"searchLine": common_lib.build_search_line(path, ["spec", "forProvider", "distributionConfig", "logging"]), | ||
} | ||
} | ||
|
||
CxPolicy[result] { | ||
docs := input.document[i] | ||
[path, resource] := walk(docs) | ||
startswith(resource.apiVersion, "cloudfront.aws.crossplane.io") | ||
resource.kind == "Distribution" | ||
destribution_config := resource.spec.forProvider.distributionConfig | ||
destribution_config.enabled == true | ||
|
||
not common_lib.valid_key(destribution_config, "logging") | ||
|
||
result := { | ||
"documentId": input.document[i].id, | ||
"resourceType": resource.kind, | ||
"resourceName": resource.metadata.name, | ||
"searchKey": sprintf("%smetadata.name={{%s}}.spec.forProvider.distributionConfig", [cp_lib.getPath(path),resource.metadata.name]), | ||
"issueType": "MissingAttribute", | ||
"keyExpectedValue": "CloudFront logging enabled attribute should be defined and set to true", | ||
"keyActualValue": "CloudFront logging is not defined", | ||
"searchLine": common_lib.build_search_line(path, ["spec", "forProvider", "distributionConfig"]), | ||
} | ||
} |
Oops, something went wrong.