Skip to content

Commit

Permalink
fix(terraform): Changed a couple of checks from negative to positive …
Browse files Browse the repository at this point in the history
…check, behavior is the same (#6063)

Changed a couple of checks from negative to positive check
  • Loading branch information
bo156 committed Mar 4, 2024
1 parent fb26fc2 commit b1b5a45
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

from typing import Any

from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.terraform.checks.resource.base_resource_negative_value_check import BaseResourceNegativeValueCheck
from checkov.common.models.enums import CheckCategories
from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck


class StorageAccountDisablePublicAccess(BaseResourceNegativeValueCheck):
class StorageAccountDisablePublicAccess(BaseResourceValueCheck):
def __init__(self) -> None:
name = "Ensure that Storage accounts disallow public access"
id = "CKV_AZURE_59"
Expand All @@ -17,14 +17,13 @@ def __init__(self) -> None:
id=id,
categories=categories,
supported_resources=supported_resources,
missing_attribute_result=CheckResult.FAILED,
)

def get_inspected_key(self) -> str:
return "public_network_access_enabled"

def get_forbidden_values(self) -> list[Any]:
return [True]
def get_expected_values(self) -> list[Any]:
return [False]


check = StorageAccountDisablePublicAccess()
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

from typing import Any

from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.terraform.checks.resource.base_resource_negative_value_check import BaseResourceNegativeValueCheck
from checkov.common.models.enums import CheckCategories
from checkov.terraform.checks.resource.base_resource_value_check import BaseResourceValueCheck


class StorageBlobRestrictPublicAccess(BaseResourceNegativeValueCheck):
class StorageBlobRestrictPublicAccess(BaseResourceValueCheck):
def __init__(self) -> None:
name = "Ensure that Storage blobs restrict public access"
id = "CKV_AZURE_190"
Expand All @@ -17,14 +17,13 @@ def __init__(self) -> None:
id=id,
categories=categories,
supported_resources=supported_resources,
missing_attribute_result=CheckResult.FAILED,
)

def get_inspected_key(self) -> str:
return "allow_nested_items_to_be_public"

def get_forbidden_values(self) -> list[Any]:
return [True]
def get_expected_values(self) -> list[Any]:
return [False]


check = StorageBlobRestrictPublicAccess()

0 comments on commit b1b5a45

Please sign in to comment.