generated from cisagov/ScubaGear
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
commoncontrols: implement 1.1 - 1.3 & 16.2
- Loading branch information
Showing
7 changed files
with
449 additions
and
144 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
151 changes: 151 additions & 0 deletions
151
scubagoggles/Testing/RegoTests/commoncontrols/commoncontrols_api01_test.rego
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,151 @@ | ||
package commoncontrols | ||
|
||
import future.keywords | ||
import data.utils | ||
import data.utils.FailTestOUNonCompliant | ||
import data.utils.PassTestResult | ||
|
||
GoodCaseInputApi01 := { | ||
"policies": { | ||
"topOU": { | ||
"security_two_step_verification_device_trust": { | ||
"allowTrustingDevice": false | ||
}, | ||
"security_two_step_verification_enforcement": { | ||
"enforcedFrom": "2024-02-16T23:22:21.732Z" | ||
}, | ||
"security_two_step_verification_enforcement_factor": { | ||
"allowedSignInFactorSet": "PASSKEY_ONLY" | ||
}, | ||
"security_two_step_verification_enrollment": { | ||
"allowEnrollment": true | ||
}, | ||
"security_two_step_verification_grace_period": { | ||
"enrollmentGracePeriod": "168h"} | ||
}, | ||
"nextOU": { | ||
"security_two_step_verification_grace_period": { | ||
"enrollmentGracePeriod": "604800s"} | ||
} | ||
}, | ||
"tenant_info": { | ||
"topLevelOU": "topOU" | ||
} | ||
} | ||
|
||
BadCaseInputApi01 := { | ||
"policies": { | ||
"topOU": { | ||
"security_two_step_verification_device_trust": { | ||
"allowTrustingDevice": true | ||
}, | ||
"security_two_step_verification_enforcement": { | ||
"enforcedFrom": "2025-02-16T23:22:21.732Z" | ||
}, | ||
"security_two_step_verification_enforcement_factor": { | ||
"allowedSignInFactorSet": "ALL" | ||
}, | ||
"security_two_step_verification_enrollment": { | ||
"allowEnrollment": false | ||
}, | ||
"security_two_step_verification_grace_period": { | ||
"enrollmentGracePeriod": "0s"} | ||
}, | ||
"nextOU": { | ||
"security_two_step_verification_enforcement": { | ||
"enforcedFrom": "2028-02-16T23:22:21.732Z" | ||
}, | ||
"security_two_step_verification_enforcement_factor": { | ||
"allowedSignInFactorSet": "ALL" | ||
}, | ||
"security_two_step_verification_enrollment": { | ||
"allowEnrollment": true | ||
} | ||
}, | ||
"thirdOU": { | ||
"security_two_step_verification_enforcement": { | ||
"enforcedFrom": "2035-02-16T23:22:21.732Z" | ||
}, | ||
"security_two_step_verification_enforcement_factor": { | ||
"allowedSignInFactorSet": "PASSKEY_ONLY" | ||
}, | ||
"security_two_step_verification_enrollment": { | ||
"allowEnrollment": true | ||
} | ||
} | ||
}, | ||
"tenant_info": { | ||
"topLevelOU": "topOU" | ||
} | ||
} | ||
|
||
BadCaseInputApi01a := { | ||
"policies": { | ||
"topOU": { | ||
"security_login_challenges": { | ||
"enableEmployeeIdChallenge": true | ||
} | ||
}, | ||
"nextOU": { | ||
"security_login_challenges": { | ||
"enableEmployeeIdChallenge": false | ||
} | ||
} | ||
}, | ||
"tenant_info": { | ||
"topLevelOU": "topOU" | ||
} | ||
} | ||
|
||
test_2SV_Correct_1 if { | ||
PolicyId := CommonControlsId1_1 | ||
Output := tests with input as GoodCaseInputApi01 | ||
|
||
PassTestResult(PolicyId, Output) | ||
} | ||
|
||
test_2SV_Incorrect_1 if { | ||
PolicyId := CommonControlsId1_1 | ||
Output := tests with input as BadCaseInputApi01 | ||
|
||
failedOU := [{"Name": "nextOU", | ||
"Value": NonComplianceMessage1_1b(GetFriendlyMethods("ALL"))}, | ||
{"Name": "thirdOU", | ||
"Value": NonComplianceMessage1_1c}, | ||
{"Name": "topOU", | ||
"Value": NonComplianceMessage1_1a}] | ||
FailTestOUNonCompliant(PolicyId, Output, failedOU) | ||
} | ||
|
||
test_EnrollPeriod_Correct_1 if { | ||
PolicyId := CommonControlsId1_2 | ||
Output := tests with input as GoodCaseInputApi01 | ||
|
||
PassTestResult(PolicyId, Output) | ||
} | ||
|
||
test_EnrollPeriod_Incorrect_1 if { | ||
PolicyId := CommonControlsId1_2 | ||
Output := tests with input as BadCaseInputApi01 | ||
|
||
failedOU := [{"Name": "topOU", | ||
"Value": NonComplianceMessage1_2(0, | ||
utils.DurationToSeconds("7d"))}] | ||
FailTestOUNonCompliant(PolicyId, Output, failedOU) | ||
} | ||
|
||
test_DeviceTrust_Correct_1 if { | ||
PolicyId := CommonControlsId1_3 | ||
Output := tests with input as GoodCaseInputApi01 | ||
|
||
PassTestResult(PolicyId, Output) | ||
} | ||
|
||
test_DeviceTrust_Incorrect_1 if { | ||
PolicyId := CommonControlsId1_3 | ||
Output := tests with input as BadCaseInputApi01 | ||
|
||
failedOU := [{"Name": "topOU", | ||
"Value": NonComplianceMessage1_3}] | ||
FailTestOUNonCompliant(PolicyId, Output, failedOU) | ||
} |
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
Oops, something went wrong.