-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d578111
commit 385c56b
Showing
6 changed files
with
112 additions
and
81 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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"mock": { | ||
"enabled": { | ||
"resource_changes": [ | ||
{ | ||
"address": "azapi_resource.res", | ||
"mode": "managed", | ||
"name": "res", | ||
"type": "azapi_resource", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"after": { | ||
"body": { | ||
"properties": { | ||
"enableRBAC": true | ||
}, | ||
"type": "Microsoft.ContainerService/managedClusters@2024-05-01" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"invalid_disabled": { | ||
"resource_changes": [ | ||
{ | ||
"address": "azapi_resource.res", | ||
"mode": "managed", | ||
"name": "res", | ||
"type": "azapi_resource", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"after": { | ||
"body": { | ||
"properties": { | ||
"enableRBAC": false | ||
}, | ||
"type": "Microsoft.ContainerService/managedClusters@2024-05-01" | ||
} | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
} | ||
} |
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,15 @@ | ||
package checkov | ||
|
||
import rego.v1 | ||
|
||
valid_azapi_kubernetes_cluster_rbac_enabled(resource) if { | ||
resource.values.body.properties.enableRBAC == true | ||
} | ||
|
||
deny_CKV_AZURE_5 contains reason if { | ||
resource := data.utils.resource(input, "azapi_resource")[_] | ||
data.utils.is_azure_type(resource.values, "Microsoft.ContainerService/managedClusters") | ||
not valid_azapi_kubernetes_cluster_rbac_enabled(resource) | ||
|
||
reason := sprintf("checkov/CKV_AZURE_5: Ensure RBAC is enabled on AKS clusters %s https://github.com/bridgecrewio/checkov/blob/main/checkov/terraform/checks/resource/azure/AKSRbacEnabled.py", [resource.address]) | ||
} |
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,46 @@ | ||
{ | ||
"mock": { | ||
"enabled": { | ||
"resource_changes": [ | ||
{ | ||
"address": "azurerm_kubernetes_cluster.example", | ||
"mode": "managed", | ||
"type": "azurerm_kubernetes_cluster", | ||
"name": "example", | ||
"provider_name": "registry.terraform.io/hashicorp/azurerm", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"before": null, | ||
"after": { | ||
"role_based_access_control_enabled": true | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"enabled_v2": { | ||
"resource_changes": [ | ||
{ | ||
"address": "azurerm_kubernetes_cluster.example", | ||
"mode": "managed", | ||
"type": "azurerm_kubernetes_cluster", | ||
"name": "example", | ||
"provider_name": "registry.terraform.io/hashicorp/azurerm", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"before": null, | ||
"after": { | ||
"role_based_access_control": [{ | ||
"enabled": true | ||
}] | ||
} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.