-
Notifications
You must be signed in to change notification settings - Fork 251
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
Add Check for Application Exclusions for Conditional Access Policies #1537
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 🐄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like some unit tests are missing for specific non-compliant states that PolicyConditionsMatch is checking for.
Missing unit tests for ExcludeRoles for 1.1, 3.1, 3.7, 3.8
Missing unit tests for ExcludeApplications for 1.1, 2.1, 2.3, 3.2, 3.6, 3.7, 3.8
@dagarwal-mitre I see 6 instances of the comment below in AADConfig.Rego and it doesn't make sense to me in any of the contexts where it is placed. I'm wondering if we should remove it? Kindly take a look
|
… 3.6 which does not require the inclusion of all users
The unit tests for policy 3.6 use an invalid JSON from AADBaseConfig.rego. In that JSON there is an IncludeUsers = All and then the unit tests add an IncludeRoles element as well. In a real tenant this can never happen because when you select the option to include roles you cannot then select the option to include all users as well. I think we should correct this to ensure that the policy and unit tests are aligned with practical scenarios. Given how finicky Rego is, we want to align the states we are testing with as closely to the real world as possible. |
Some instances of calling PolicyConditionsMatch look like below whereas other cases the == true is omitted. Change them so they are all consistent to whatever you think is easier to maintain.
|
I think you should delete the line count(PrivRolesSet & ConvertToSet(CAPolicy.Conditions.Users.ExcludeRoles)) == 0 in AADConfig.rego for policy 3.6 because PolicyConditionsMatch verifies that the ExcludeRoles is empty so I think that line becomes OBE? I commented it out for now with my changes but take a look and see if you agree. |
🗣 Description
This PR adds the ability to ensure that conditional access policies do not contain guest user exclusions, and ensures that every policy checking conditional access uses the PolicyConditionsMatch for consistency.
💭 Motivation and context
Closes #1170
Closes #1323
🧪 Testing
To test, within the conditional access policies, inside of users, inside the ExternalGuestorExternalUsers, update the MembershipKind and the GuestOrExternalUserTypes, and update it to look like the image. The default for these is null, feel free to take a look at the AADBaseConfig.rego file to see the default around line 25. Test with the different tenants.
✅ Pre-approval checklist
✅ Pre-merge checklist
PR passed smoke test check.
Feature branch has been rebased against changes from parent branch, as needed
Use
Rebase branch
button below or use this reference to rebase from the command line.Resolved all merge conflicts on branch
Notified merge coordinator that PR is ready for merge via comment mention
Demonstrate changes to the team for questions and comments.
(Note: Only required for issues of size
Medium
or larger)✅ Post-merge checklist