Skip to content
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(arm): add CKV_AZURE_75 data explorer double encryption enabled convert policy to arm #6247

Merged
merged 27 commits into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
8d7c757
chore: update release notes
gruebel Apr 8, 2024
51dd3ce
chore: update release notes
goldyBH Apr 9, 2024
321f424
chore: update release notes
goldyBH Apr 9, 2024
37bb806
chore: update release notes
goldyBH Apr 9, 2024
c0ceb48
chore: update release notes
goldyBH Apr 11, 2024
4fe8c4b
chore: update release notes
goldyBH Apr 11, 2024
809c7f1
chore: update release notes
goldyBH May 5, 2024
68d1cd8
remove files
goldyBH May 5, 2024
0c9c572
remove files
goldyBH May 5, 2024
a6b6625
remove files
goldyBH May 5, 2024
869c020
remove files
goldyBH May 5, 2024
a244d79
remove files
goldyBH May 5, 2024
b4ea2da
remove files
goldyBH May 5, 2024
7ffda71
remove files
goldyBH May 5, 2024
12592f5
faild
goldyBH May 5, 2024
111b4cd
faild
goldyBH May 5, 2024
e1c938c
faild
goldyBH May 5, 2024
60ca72c
faild
goldyBH May 5, 2024
0887bf3
Update AzureDataExplorerDoubleEncryptionEnabled.py
goldyBH May 5, 2024
c61de72
Merge branch 'main' into mariaDBConvertToARM
goldyBH May 7, 2024
7efda90
Update AzureDataExplorerDoubleEncryptionEnabled.py
goldyBH May 12, 2024
312acfa
Merge branch 'main' into mariaDBConvertToARM
goldyBH May 12, 2024
efeb201
Merge branch 'main' into mariaDBConvertToARM
ChanochShayner Jul 4, 2024
9a4a79d
Apply suggestions from code review
ChanochShayner Jul 15, 2024
afb1dba
Apply suggestions from code review
ChanochShayner Jul 15, 2024
c0d28fa
Update tests/arm/checks/resource/test_AzureDataExplorerDoubleEncrypti…
ChanochShayner Jul 15, 2024
ce9fb72
Merge branch 'main' into mariaDBConvertToARM
ChanochShayner Jul 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
from typing import Any
from checkov.common.models.enums import CheckCategories
from checkov.arm.base_resource_value_check import BaseResourceValueCheck


class AzureDataExplorerDoubleEncryptionEnabled(BaseResourceValueCheck):
def __init__(self) -> None:
name: str = "Ensure that Azure Data Explorer uses double encryption"
id: str = "CKV_AZURE_75"
supported_resources = ("Microsoft.Kusto/clusters",)
categories = (CheckCategories.ENCRYPTION,)
super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)

def get_inspected_key(self) -> str:
return "properties/enableDoubleEncryption"

def get_expected_value(self) -> Any:
return True


check: Any = AzureDataExplorerDoubleEncryptionEnabled()
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"apiVersion": "2018-06-01",
"type": "Microsoft.Compute/disks",
ChanochShayner marked this conversation as resolved.
Show resolved Hide resolved
"location": "West Europe",
"name": "fail",
"sku": {
"name": "B_Gen5_2",
"size": "5120"
},
"properties": {
"version": "10.3",
"administratorLogin": "admin",
"administratorLoginPassword": "admin123",
"enableDoubleEncryption": false,
"storageProfile": {
"storageMB": "5120"
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"resources": [
{
"apiVersion": "2018-06-01",
"type": "Microsoft.Compute/disks",
ChanochShayner marked this conversation as resolved.
Show resolved Hide resolved
"location": "West Europe",
"name": "pass",
"sku": {
"name": "B_Gen5_2",
"size": "5120"
},
"properties": {
"version": "10.3",
"administratorLogin": "admin",
"administratorLoginPassword": "admin123",
"enableDoubleEncryption": true,
"storageProfile": {
"storageMB": "5120"
}
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import unittest
from pathlib import Path
from checkov.arm.checks.resource.AzureDataExplorerDoubleEncryptionEnabled import check
from checkov.arm.runner import Runner
from checkov.runner_filter import RunnerFilter


class TestAzureDataExplorerDoubleEncryptionEnabled(unittest.TestCase):
def test_summary(self):
test_files_dir = Path(__file__).parent / "example_AzureDataExplorerDoubleEncryptionEnabled"
report = Runner().run(root_folder=str(test_files_dir), runner_filter=RunnerFilter(checks=[check.id]))
summary = report.get_summary()
passing_resources = {
"Microsoft.Compute/disks.pass"
ChanochShayner marked this conversation as resolved.
Show resolved Hide resolved
}
failing_resources = {
"Microsoft.Compute/disks.fail"
ChanochShayner marked this conversation as resolved.
Show resolved Hide resolved
}

passed_check_resources = {c.resource for c in report.passed_checks}
failed_check_resources = {c.resource for c in report.failed_checks}

assert summary["passed"] == len(passing_resources)
assert summary["failed"] == len(failing_resources)
assert summary["skipped"] == 0
assert summary["parsing_errors"] == 0

assert passed_check_resources == passing_resources
assert failed_check_resources == failing_resources


if __name__ == "__main__":
unittest.main()
Loading