Skip to content

Commit

Permalink
Implement AAD 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Crutchfield authored and crutchfield committed Jul 21, 2023
1 parent 411e15b commit 33b4380
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 11 deletions.
4 changes: 4 additions & 0 deletions PowerShell/ScubaGear/Modules/Providers/ExportAADProvider.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ function Export-AADProvider {
# 2.7 Policy Bullet 2]
$AdminConsentReqPolicies = ConvertTo-Json @($Tracker.TryCommand("Get-MgPolicyAdminConsentRequestPolicy"))

# Read the properties and relationships of an authentication method policy
$AuthenticationMethodPolicy = ConvertTo-Json @($Tracker.TryCommand("Get-MgPolicyAuthenticationMethodPolicy"))

$SuccessfulCommands = ConvertTo-Json @($Tracker.GetSuccessfulCommands())
$UnSuccessfulCommands = ConvertTo-Json @($Tracker.GetUnSuccessfulCommands())

Expand All @@ -113,6 +116,7 @@ function Export-AADProvider {
"privileged_roles": $PrivilegedRoles,
"service_plans": $ServicePlans,
"directory_settings": $DirectorySettings,
"authentication_method": $AuthenticationMethodPolicy,
"aad_successful_commands": $SuccessfulCommands,
"aad_unsuccessful_commands": $UnSuccessfulCommands,
"@
Expand Down
16 changes: 8 additions & 8 deletions Rego/AADConfig.rego
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,15 @@ tests[{
#--
# At this time we are unable to test for X because of NEW POLICY
tests[{
"PolicyId": PolicyId,
"Criticality" : "Should/Not-Implemented",
"Commandlet" : [],
"ActualValue" : [],
"ReportDetails" : NotCheckedDetails(PolicyId),
"RequirementMet" : false
"PolicyId": "MS.AAD.3.4v1",
"Criticality" : "Shall",
"Commandlet" : ["Get-MgPolicyAuthenticationMethodPolicy"],
"ActualValue" : [Policy.PolicyMigrationState],
"ReportDetails" : ReportDetailsBoolean(Status),
"RequirementMet" : Status
}] {
PolicyId := "MS.AAD.3.4v1"
true
Policy := input.authentication_method[_]
Status := Policy.PolicyMigrationState == "migrationComplete"
}
#--

Expand Down
31 changes: 28 additions & 3 deletions Testing/Unit/Rego/AAD/AADConfig_03_test.rego
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package aad
import future.keywords
import data.report.utils.NotCheckedDetails
import data.report.utils.ReportDetailsBoolean


#
Expand Down Expand Up @@ -1285,16 +1286,40 @@ test_NotImplemented_Correct_V2 if {
#
# MS.AAD.3.4v1
#--
test_NotImplemented_Correct_V3 if {
test_Migrated_Correct if {
PolicyId := "MS.AAD.3.4v1"

Output := tests with input as { }
Output := tests with input as {
"authentication_method": [
{
"PolicyMigrationState": "migrationComplete"
}
]
}

RuleOutput := [Result | Result = Output[_]; Result.PolicyId == PolicyId]

count(RuleOutput) == 1
RuleOutput[0].RequirementMet
RuleOutput[0].ReportDetails == ReportDetailsBoolean(true)
}

test_Migrated_Incorrect if {
PolicyId := "MS.AAD.3.4v1"

Output := tests with input as {
"authentication_method": [
{
"PolicyMigrationState": "preMigration"
}
]
}

RuleOutput := [Result | Result = Output[_]; Result.PolicyId == PolicyId]

count(RuleOutput) == 1
not RuleOutput[0].RequirementMet
RuleOutput[0].ReportDetails == NotCheckedDetails(PolicyId)
RuleOutput[0].ReportDetails == ReportDetailsBoolean(false)
}
#--

Expand Down

0 comments on commit 33b4380

Please sign in to comment.