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

Implement MS.AAD.7.2v1 Policy to check Secure Score #453

Merged
merged 15 commits into from
Aug 17, 2023
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
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
10 changes: 5 additions & 5 deletions .github/workflows/run_markdown_check.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
on:
on:
workflow_dispatch:
pull_request:
types: [opened, reopened]
branches:
- "main"
- "main"
pull_request_review:
types: [submitted]
types: [submitted]
push:
branches:
- "main"
Expand All @@ -14,13 +14,13 @@ on:
- "baselines/*.md"

name: Markdown Check

jobs:
Run-Markdown-Check:
runs-on: windows-latest
defaults:
run:
shell: powershell
shell: powershell
permissions:
contents: read
steps:
Expand Down
1 change: 1 addition & 0 deletions PowerShell/ScubaGear/Modules/Connection/Connection.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function Connect-Tenant {
'UserAuthenticationMethod.Read.All',
'RoleManagement.Read.Directory',
'GroupMember.Read.All',
'SecurityEvents.Read.All',
'Directory.Read.All'
)
$GraphParams = @{
Expand Down
18 changes: 9 additions & 9 deletions PowerShell/ScubaGear/Modules/Providers/ExportAADProvider.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@ function Export-AADProvider {
$Tracker = Get-CommandTracker

# The below cmdlet covers the following baselines
# - 1.1
# - 2.1
# - 2.2
# - 2.3 First Policy bullet
# - 2.4 First Policy bullet
# - 2.9
# - 2.10
# - 2.17 first part
# - 3.1
# - 4.2
# - 3.7
$AllPolicies = $Tracker.TryCommand("Get-MgIdentityConditionalAccessPolicy")

Import-Module $PSScriptRoot/ProviderHelpers/AADConditionalAccessHelper.psm1
Expand Down Expand Up @@ -91,13 +89,14 @@ function Export-AADProvider {
}
$ServicePlans = ConvertTo-Json -Depth 3 @($ServicePlans)

# 2.6, 2.7, & 2.18 1st/3rd Policy Bullets
# 5.1, 5.2, 8.1 & 8.3
$AuthZPolicies = ConvertTo-Json @($Tracker.TryCommand("Get-MgPolicyAuthorizationPolicy"))
$SecureScore = ConvertTo-Json -Depth 2 @($Tracker.TryCommand("Get-MgSecuritySecureScore", @{"Top"=1}).ControlScores | Where-Object {$_.ControlName -eq 'RoleOverlap'})

# 2.7 third bullet
# 5.4
$DirectorySettings = ConvertTo-Json -Depth 10 @($Tracker.TryCommand("Get-MgDirectorySetting"))

# 2.7 Policy Bullet 2]
# 5.3
$AdminConsentReqPolicies = ConvertTo-Json @($Tracker.TryCommand("Get-MgPolicyAdminConsentRequestPolicy"))

# Read the properties and relationships of an authentication method policy
Expand All @@ -111,6 +110,7 @@ function Export-AADProvider {
"conditional_access_policies": $AllPolicies,
"cap_table_data": $CapTableData,
"authorization_policies": $AuthZPolicies,
"secure_score": $SecureScore,
"admin_consent_policies": $AdminConsentReqPolicies,
"privileged_users": $PrivilegedUsers,
"privileged_roles": $PrivilegedRoles,
Expand Down
5 changes: 5 additions & 0 deletions PowerShell/ScubaGear/RequiredVersions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ $ModuleList = @(
ModuleVersion = [version] '1.14.0'
MaximumVersion = [version] '1.99.99999'
},
@{
ModuleName = 'Microsoft.Graph.Security'
ModuleVersion = [version] '1.14.0'
MaximumVersion = [version] '1.99.99999'
},
@{
ModuleName = 'Microsoft.Graph.Teams' #TODO: Verify is needed
ModuleVersion = [version] '1.14.0'
Expand Down
24 changes: 13 additions & 11 deletions Rego/AADConfig.rego
Original file line number Diff line number Diff line change
Expand Up @@ -705,22 +705,24 @@ tests[{
}
#--

#
# MS.AAD.7.2v1
#--
# At this time we are unable to test for user association to fine-grained privileged roles
# rather than Global Administrator due to runtime and data response size constraints
# Check for secure score value for RoleOverlap Control Category
# Requirements is met if score is equal to 1 (100%) and fails if it is less than 1
#--

tests[{
"PolicyId" : PolicyId,
"Criticality" : "Shall/Not-Implemented",
"Commandlet" : [],
"ActualValue" : [],
"ReportDetails" : NotCheckedDetails(PolicyId),
"RequirementMet" : false
"PolicyId" : "MS.AAD.7.2v1",
"Criticality" : "Shall",
"Commandlet" : ["Get-MgSecuritySecureScore"],
"ActualValue" : SecureScorePolicy,
"ReportDetails" : ReportDetailsBoolean(Status),
"RequirementMet" : Status
}] {
PolicyId := "MS.AAD.7.2v1"
true
SecureScorePolicy := input.secure_score[_]
Status := SecureScorePolicy.Score == 1.0
}

#--

#
Expand Down
Loading