feat(scanner): add enterprise App Registration and Managed Identity rules#197
Merged
Conversation
TFT444
requested review from
SHAURYAKSHARMA24,
Vishnu2707,
parthrohit22 and
ritiksah141
as code owners
July 15, 2026 12:52
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
TFT444
requested review from
m-khan-97
and removed request for
SHAURYAKSHARMA24,
parthrohit22 and
ritiksah141
July 15, 2026 12:54
m-khan-97
approved these changes
Jul 17, 2026
m-khan-97
left a comment
Collaborator
There was a problem hiding this comment.
Reviewed thoroughly — fetched the branch and ran the tests locally (34 passed), plus checked the redirect-URI classifier against edge cases directly.
Strong work:
get_service_principals()refactor preserves behavior. It now delegates to the cachedget_subscription_role_assignments(), and still returns[]on failure (when assignments isNone), so no regression for existing callers. The_UNSETsentinel correctly distinguishes "not yet fetched" from "fetched and failed (None)".- AZ-IDN-006 correctly reuses the shared
get_applications()instead of its own inline Graph fetch, and handles theNone(inventory-unavailable) case rather than silently treating it as "no findings." - Redirect-URI logic (AZ-IDN-011) is correct. Verified
http://[::1],http://127.0.0.1:8080, andhttp://localhostare all treated as loopback (not flagged), whilehttp://evil.comis flagged andmsalclient://(non-http scheme) is ignored.ipaddress.ip_address()on the bracket-stripped IPv6 host works as intended. - Data minimization is enforced and tested — findings carry counts/booleans only, and the tests explicitly assert the raw URI and a sentinel
keyIdnever appear in metadata. Good follow-through on the #178 lesson. - Every rule has a matching confirmation-gated playbook; the destructive ones (secret deletion, implicit-grant disable) are print-only or
APPLY-gated.
Minor cosmetic note, non-blocking: the new rules use TBD-IDN-0xx as the CIS control_id, while the existing AKS rules used N/A-AKS-006. Since the descriptions say these genuinely aren't in CIS Foundations 2.0.0, N/A- reads as more accurate than TBD- (which implies "coming soon"). Not worth a round-trip.
Approving.
This was referenced Jul 17, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds a cohesive enterprise identity security pack for Microsoft Entra App Registrations and Azure Managed Identities, while consolidating App Registration inventory so all related rules share one cached, paginated Graph request per scan.
Rules
AZ-IDN-010AZ-IDN-011AZ-IDN-012AZ-IDN-013AZ-IDN-014AZ-IDN-015Existing rule improvement
AZ-IDN-006now reusesAzureClient.get_applications()instead of performing its own Graph request. The accessor:@odata.nextLink;Noneon Graph failure so rules cannot mistake an incomplete scan for compliance.Managed Identity detection uses Graph's immutable
servicePrincipalType=ManagedIdentityfilter and correlates principal IDs with cached subscription RBAC assignments. Privileged roles are matched by immutable built-in role-definition GUIDs and exact subscription scope.Data minimization
Findings do not include:
Only counts, boolean states, role names, principal IDs, and required resource identifiers are retained.
Assignment restriction decision
The proposed
AZ-IDN-016resource-provider assignment-restriction rule is intentionally deferred. Microsoft documents the new portal feature, but the current public Managed Identity REST response reliably exposesisolationScope, not the configured resource-provider restriction collection. This PR does not infer or invent an undocumented field.Permissions
Read-only scanning requires:
Application.Read.All;Microsoft.Authorization/roleAssignments/read.No Graph write permission is requested by the scanner.
Compliance
Mappings were added for the repository's NIST CSF 1.1, ISO/IEC 27001:2013, and SOC 2 schemas. The current CIS Azure Foundations 2.0.0 file has no direct controls for these checks, so mappings are explicitly numbered
TBD-IDN-*placeholders rather than claiming unsupported CIS coverage.Testing
Related issue
Closes #193