Skip to content

Commit

Permalink
fix dog food
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesWoolfenden committed Aug 29, 2023
1 parent 56693d4 commit 5f300c3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions checkov/arm/checks/resource/VMDisablePasswordAuthentication.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from typing import Any

from checkov.common.models.enums import CheckCategories, CheckResult
from checkov.arm.base_resource_check import BaseResourceCheck

Expand All @@ -11,20 +11,20 @@ def __init__(self) -> None:
categories = [CheckCategories.ENCRYPTION]
super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources)

def scan_resource_conf(self, conf: dict[str, Any]) -> CheckResult:
def scan_resource_conf(self, conf) -> CheckResult:

if conf.get('properties') and isinstance(conf.get('properties'), dict):
properties = conf.get('properties')
if properties.get("virtualMachineProfile") and isinstance(properties.get("virtualMachineProfile"), dict):
profile = properties.get("virtualMachineProfile")
if profile.get("osProfile") and isinstance(profile.get("osProfile"), dict):
osProfile = profile.get("osProfile")
osprofile = profile.get("osProfile")
if properties.get("osProfile") and isinstance(properties.get("osProfile"), dict):
osProfile = properties.get("osProfile")
if osProfile is None:
osprofile = properties.get("osProfile")
if osprofile is None:
return CheckResult.UNKNOWN
if osProfile.get("linuxConfiguration") and isinstance(osProfile.get("linuxConfiguration"), dict):
config = osProfile.get("linuxConfiguration")
if osprofile.get("linuxConfiguration") and isinstance(osprofile.get("linuxConfiguration"), dict):
config = osprofile.get("linuxConfiguration")
if config.get("disablePasswordAuthentication") and isinstance(config.get("disablePasswordAuthentication"), bool):
return CheckResult.PASSED
return CheckResult.FAILED
Expand Down

0 comments on commit 5f300c3

Please sign in to comment.