-
Notifications
You must be signed in to change notification settings - Fork 284
Add fix for invalid JSON primitive issues related to risky service principals #1682
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
base: main
Are you sure you want to change the base?
Conversation
…h to SignInAudience property for checking third party SPs instead of comparison
Is it just me or did the PSLinter get more strict? It's complaining about a lot of things that are unrelated to these changes. |
Noticed that as well. I think PSScriptAnalyzer is set to fail for severity "error" and "warning", the 173 "informational" are due to the lack of help comments for each cmdlet. Tests are all passing now. |
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.
I tested as described in the testing section. I was able to replicate the issue on main and switching to this branch fixed the issue.
🗣 Description
We received public reports of the Entra ID report failing to compile due to an invalid JSON primitive issue. If a tenant has no risky third party applications, then the original code was returning $null, resulting in the culprit key value
risky_third_party_service_principals: ,
in either ProviderSettingsExport.json or ScubaResults_.json.The check for finding 3rd party service principals was also improved with the addition of Get-MgBetaOrganization commandlet in Format-RiskyThirdPartyServicePrincipals.
💭 Motivation and context
Resolves #1607
Resolves #1658
🧪 Testing
We determined there are four cases that occur regarding risky application/service principal data:
We tested each one of these cases and replicated the invalid JSON primitive error in the last case, "risky apps exist but no risky 3rd party SPs exist."
To replicate, we modified RiskyPermissions.json with a single permission (ideally something no applications are assigned):
Add the "AccessReview.Read.All" permission to at least one application registration in a tenant and check that no service principals have the permission assigned.
Test this across a few different test tenants, e.g. G3, G5, E5.
Run the new unit tests:
✅ 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