Skip to content

Add entra_conditional_access_policy_no_exclusion_gaps check#11375

Open
arieleli01212 wants to merge 1 commit into
prowler-cloud:masterfrom
arieleli01212:feat/entra-ca-no-exclusion-gaps
Open

Add entra_conditional_access_policy_no_exclusion_gaps check#11375
arieleli01212 wants to merge 1 commit into
prowler-cloud:masterfrom
arieleli01212:feat/entra-ca-no-exclusion-gaps

Conversation

@arieleli01212
Copy link
Copy Markdown

Summary

Closes #11062.

Adds the entra_conditional_access_policy_no_exclusion_gaps check under prowler/providers/m365/services/entra/. The check catches Conditional Access exclusions that leave principals or applications with no CA coverage at all.

How it works:

  1. Collects all enabled Conditional Access policies (report-only and disabled are ignored).
  2. Builds a per-type global include set by unioning every included_users, included_groups, included_roles, and included_applications list across those policies.
  3. For each enabled policy, walks every exclude collection and checks whether each entry appears in the global include set of the same type.
  4. Reports PASS when every excluded object is found in the global include set, or when no enabled policy uses any exclusion. Reports FAIL when at least one excluded object is absent from the global include set, listing the orphaned IDs grouped by type.

Intentional exceptions skipped automatically:

  • The Directory Synchronization Accounts role (d29b2b05-8046-44ba-8758-1e26182fcf32) — already validated by entra_conditional_access_policy_directory_sync_account_excluded.
  • Confirmed emergency-access accounts — accounts excluded from every enabled blocking policy, using the same definition as entra_emergency_access_exclusion.

Files added:

  • prowler/providers/m365/services/entra/entra_conditional_access_policy_no_exclusion_gaps/entra_conditional_access_policy_no_exclusion_gaps.py
  • prowler/providers/m365/services/entra/entra_conditional_access_policy_no_exclusion_gaps/entra_conditional_access_policy_no_exclusion_gaps.metadata.json
  • prowler/providers/m365/services/entra/entra_conditional_access_policy_no_exclusion_gaps/__init__.py
  • tests/providers/m365/services/entra/entra_conditional_access_policy_no_exclusion_gaps/entra_conditional_access_policy_no_exclusion_gaps_test.py

No changes to entra_service.py or any other existing file — the existing ConditionalAccessPolicy model already exposes all the fields this check needs.

Test plan

  • pytest tests/providers/m365/services/entra/entra_conditional_access_policy_no_exclusion_gaps/ — all 19 cases cover: no policies, disabled/report-only policies skipped, no exclusions → PASS, excluded objects covered by another policy → PASS, dir-sync role skipped, emergency accounts skipped, "All" in include set covers any specific ID, uncovered user/group/role/app → FAIL, multiple gap types reported together, mixed PASS/FAIL across policies.

Implements the check proposed in issue prowler-cloud#11062. An exclusion gap exists
when a user, group, role, or application is excluded from an enabled
Conditional Access policy but does not appear in the include set of any
other enabled policy for that object type — leaving it entirely outside
CA enforcement.

The check builds a global include set by unioning every include*
collection across all enabled policies, then walks each policy's
exclude* collections and reports objects with no matching entry
elsewhere.  The Directory Synchronization Accounts role and confirmed
emergency-access accounts are skipped automatically, as those are
intentional gaps validated by dedicated sibling checks.
@arieleli01212 arieleli01212 requested a review from a team as a code owner May 27, 2026 10:08
@github-actions github-actions Bot added provider/m365 Issues/PRs related with the M365 provider metadata-review labels May 27, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Conflict Markers Resolved

All conflict markers have been successfully resolved in this pull request.

@github-actions github-actions Bot added the community Opened by the Community label May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Opened by the Community metadata-review new-check provider/m365 Issues/PRs related with the M365 provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[New Check]: Conditional Access excluded objects must be covered by another policy (no exclusion gaps)

2 participants