-
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
5c3ec59
commit 672f061
Showing
8 changed files
with
156 additions
and
125 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,69 @@ | ||
{ | ||
"mock" : { | ||
"default": { | ||
"resource_changes": [{ | ||
"address": "azurerm_kubernetes_cluster.example", | ||
"mode": "managed", | ||
"type": "azapi_resource", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"after": { | ||
"type": "Microsoft.ContainerService/managedClusters@2024-05-01", | ||
"body": { | ||
"properties": { | ||
"networkProfile": { | ||
"networkPolicy": "calico" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}] | ||
}, | ||
"known_after_apply": { | ||
"resource_changes": [{ | ||
"address": "azurerm_kubernetes_cluster.example", | ||
"mode": "managed", | ||
"type": "azapi_resource", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"after": { | ||
"type": "Microsoft.ContainerService/managedClusters@2024-05-01" | ||
}, | ||
"after_unknown": { | ||
"body": { | ||
"properties": { | ||
"networkProfile": { | ||
"networkPolicy": true | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}] | ||
}, | ||
"invalid_omitted": { | ||
"resource_changes": [{ | ||
"address": "azurerm_kubernetes_cluster.example", | ||
"mode": "managed", | ||
"type": "azapi_resource", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"after": { | ||
"type": "Microsoft.ContainerService/managedClusters@2024-05-01", | ||
"body": { | ||
"properties": { | ||
} | ||
} | ||
} | ||
} | ||
}] | ||
}, | ||
} | ||
} |
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,20 @@ | ||
package checkov | ||
|
||
import rego.v1 | ||
|
||
|
||
valid_azapi_kubernetes_cluster_has_network_policy(resource) if { | ||
resource.values.body.properties.networkProfile.networkPolicy == resource.values.body.properties.networkProfile.networkPolicy | ||
} | ||
|
||
valid_azapi_kubernetes_cluster_has_network_policy(resource) if { | ||
resource.after_unknown.body.properties.networkProfile.networkPolicy == resource.after_unknown.body.properties.networkProfile.networkPolicy | ||
} | ||
|
||
deny_CKV_AZURE_7 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_has_network_policy(resource) | ||
|
||
reason := sprintf("checkov/CKV_AZURE_7: Ensure AKS cluster has Network Policy configured %s https://github.com/bridgecrewio/checkov/blob/main/checkov/terraform/checks/resource/azure/AKSNetworkPolicy.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,62 @@ | ||
{ | ||
"mock": { | ||
"default": { | ||
"resource_changes": [ | ||
{ | ||
"address": "azurerm_kubernetes_cluster.example", | ||
"mode": "managed", | ||
"type": "azurerm_kubernetes_cluster", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"after": { | ||
"network_profile": [ | ||
{ | ||
"network_policy": "calico" | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"known_after_apply": { | ||
"resource_changes": [ | ||
{ | ||
"address": "azurerm_kubernetes_cluster.example", | ||
"mode": "managed", | ||
"type": "azurerm_kubernetes_cluster", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"after": {}, | ||
"after_unknown": { | ||
"network_profile": [ | ||
{ | ||
"network_policy": true | ||
} | ||
] | ||
} | ||
} | ||
} | ||
] | ||
}, | ||
"invalid_omitted": { | ||
"resource_changes": [ | ||
{ | ||
"address": "azurerm_kubernetes_cluster.example", | ||
"mode": "managed", | ||
"type": "azurerm_kubernetes_cluster", | ||
"change": { | ||
"actions": [ | ||
"create" | ||
], | ||
"after": {} | ||
} | ||
} | ||
] | ||
} | ||
} | ||
} |
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.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.