Skip to content

Commit

Permalink
added "Cloud Storage Bucket Versioning Disabled" (Checkmarx#4593)
Browse files Browse the repository at this point in the history
  • Loading branch information
rafaela-soares authored Dec 16, 2021
1 parent 867e231 commit d5ae6a7
Show file tree
Hide file tree
Showing 18 changed files with 109 additions and 26 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "7814ddda-e758-4a56-8be3-289a81ded929",
"queryName": "Object Versioning Not Enabled",
"queryName": "Cloud Storage Bucket Versioning Disabled",
"severity": "HIGH",
"category": "Observability",
"descriptionText": "Object Versioning not fully enabled on Cloud Storage Bucket",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"queryName": "Cloud Storage Bucket Versioning Disabled",
"severity": "HIGH",
"line": 3
},
{
"queryName": "Cloud Storage Bucket Versioning Disabled",
"severity": "HIGH",
"line": 17
}
]

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"id": "ad0875c1-0b39-4890-9149-173158ba3bba",
"queryName": "Cloud Storage Bucket Versioning Disabled",
"severity": "HIGH",
"category": "Observability",
"descriptionText": "Cloud Storage Bucket should be enabled",
"descriptionUrl": "https://cloud.google.com/storage/docs/json_api/v1/buckets",
"platform": "GoogleDeploymentManager",
"descriptionID": "9b7ba7de",
"cloudProvider": "gcp"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package Cx

import data.generic.common as common_lib

CxPolicy[result] {
resource := input.document[i].resources[idx]
resource.type == "storage.v1.bucket"

not common_lib.valid_key(resource.properties, "versioning")

result := {
"documentId": input.document[i].id,
"searchKey": sprintf("resources.name={{%s}}.properties", [resource.name]),
"issueType": "MissingAttribute",
"keyExpectedValue": "'versioning' is defined and not null",
"keyActualValue": "'versioning' is undefined or null",
"searchLine": common_lib.build_search_line(["resources", idx, "properties"], []),
}
}

CxPolicy[result] {
resource := input.document[i].resources[idx]
resource.type == "storage.v1.bucket"

resource.properties.versioning.enabled == false

result := {
"documentId": input.document[i].id,
"searchKey": sprintf("resources.name={{%s}}.properties.versioning.enabled", [resource.name]),
"issueType": "IncorrectValue",
"keyExpectedValue": "'enabled' is set to true",
"keyActualValue": "'enabled' is set to false",
"searchLine": common_lib.build_search_line(["resources", idx, "properties", "versioning", "enabled"], []),
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resources:
- name: a-new-pubsub-topic3
type: storage.v1.bucket
properties:
storageClass: STANDARD
location: EUROPE-WEST3
versioning:
enabled: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
resources:
- name: a-new-pubsub-topic
type: storage.v1.bucket
properties:
storageClass: STANDARD
location: EUROPE-WEST3
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
resources:
- name: a-new-pubsub-topic2
type: storage.v1.bucket
properties:
storageClass: STANDARD
location: EUROPE-WEST3
versioning:
enabled: false
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[
{
"queryName": "Cloud Storage Bucket Versioning Disabled",
"severity": "HIGH",
"line": 4,
"filename": "positive1.yaml"
},
{
"queryName": "Cloud Storage Bucket Versioning Disabled",
"severity": "HIGH",
"line": 8,
"filename": "positive2.yaml"
}
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "e7e961ac-d17e-4413-84bc-8a1fbe242944",
"queryName": "Object Versioning Not Enabled",
"queryName": "Cloud Storage Bucket Versioning Disabled",
"severity": "HIGH",
"category": "Observability",
"descriptionText": "Object Versioning Not Enabled on Cloud Storage Bucket",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[
{
"queryName": "Cloud Storage Bucket Versioning Disabled",
"severity": "HIGH",
"line": 6
},
{
"queryName": "Cloud Storage Bucket Versioning Disabled",
"severity": "HIGH",
"line": 10
}
]

This file was deleted.

0 comments on commit d5ae6a7

Please sign in to comment.