Skip to content

feat(intune): add device compliance policy marks noncompliant check#10599

Open
HugoPBrito wants to merge 9 commits intomasterfrom
PROWLER-855-mt-1054-intune-compliance-default
Open

feat(intune): add device compliance policy marks noncompliant check#10599
HugoPBrito wants to merge 9 commits intomasterfrom
PROWLER-855-mt-1054-intune-compliance-default

Conversation

@HugoPBrito
Copy link
Copy Markdown
Member

@HugoPBrito HugoPBrito commented Apr 7, 2026

Context

This PR adds a native Prowler Intune check to verify that devices without an assigned compliance policy are treated as non-compliant. This helps prevent unmanaged devices from being considered compliant by default and reduces the risk of those devices satisfying compliance-based access controls unexpectedly.

Related issue: https://prowlerpro.atlassian.net/browse/PROWLER-855

Description

  • Adds intune_device_compliance_policy_marks_noncompliant for the M365 provider
  • Evaluates the Intune deviceManagement/settings secureByDefault setting
  • Adds test coverage for secure_by_default=True, False, None, and missing settings
  • Maps the new check to CIS Microsoft 365 6.0 requirement 4.1
  • Adds the SDK changelog entry in prowler/CHANGELOG.md

Steps to review

  1. Review the check implementation in prowler/providers/m365/services/intune/intune_device_compliance_policy_marks_noncompliant/
  2. Review the compliance mapping in prowler/compliance/m365/cis_6.0_m365.json
  3. Review the changelog entry in prowler/CHANGELOG.md
  4. Run the tests:
    poetry run pytest tests/providers/m365/services/intune/intune_device_compliance_policy_marks_noncompliant/ -v
  5. Optionally validate the check against a real tenant:
    prowler m365 --check intune_device_compliance_policy_marks_noncompliant

Checklist

Community Checklist
  • This feature/issue is listed in here or roadmap.prowler.com
  • Is it assigned to me, if not, request it via the issue/feature in here or Prowler Community Slack

SDK/CLI

  • Are there new checks included in this PR? Yes
    • If so, do we need to update permissions for the provider? No, the check reads the existing Intune settings endpoint and does not require new provider permissions.

License

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@HugoPBrito HugoPBrito requested review from a team as code owners April 7, 2026 12:39
@github-actions github-actions bot added provider/m365 Issues/PRs related with the M365 provider metadata-review component/mcp-server labels Apr 7, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

✅ All necessary CHANGELOG.md files have been updated.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Conflict Markers Resolved

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

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

Compliance Mapping Review

This PR adds new checks. Please verify that they have been mapped to the relevant compliance framework requirements.

New checks already mapped in this PR

  • intune_device_compliance_policy_unassigned_devices_not_compliant_by_default (m365): cis_6.0_m365

Use the no-compliance-check label to skip this check.

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 88.08%. Comparing base (bc38104) to head (6cacef7).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #10599      +/-   ##
==========================================
+ Coverage   85.71%   88.08%   +2.36%     
==========================================
  Files          15      124     +109     
  Lines         504     5203    +4699     
==========================================
+ Hits          432     4583    +4151     
- Misses         72      620     +548     
Flag Coverage Δ
prowler-py3.10-googleworkspace ?
prowler-py3.10-m365 87.96% <100.00%> (?)
prowler-py3.11-googleworkspace ?
prowler-py3.11-m365 87.96% <100.00%> (?)
prowler-py3.12-googleworkspace ?
prowler-py3.12-m365 88.08% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
prowler 88.08% <100.00%> (+2.36%) ⬆️
api ∅ <ø> (∅)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 7, 2026

🔒 Container Security Scan

Image: prowler:d53e22b
Last scan: 2026-04-08 15:20:33 UTC

📊 Vulnerability Summary

Severity Count
🔴 Critical 4
Total 4

4 package(s) affected

⚠️ Action Required

Critical severity vulnerabilities detected. These should be addressed before merging:

  • Review the detailed scan results
  • Update affected packages to patched versions
  • Consider using a different base image if updates are unavailable

📋 Resources:

…MT.1054)

Implements Prowler check equivalent to Maester test MT.1054.
Verifies that the Intune built-in Device Compliance Policy marks
devices with no compliance policy assigned as 'Not compliant'
by checking the secureByDefault setting.
…nt check

Covers secure_by_default true/false/None and settings being None.
Uses exact string assertions following Prowler test conventions.
@HugoPBrito HugoPBrito force-pushed the PROWLER-855-mt-1054-intune-compliance-default branch from faba529 to a39863f Compare April 7, 2026 13:29
@HugoPBrito HugoPBrito changed the title feat(intune): add device compliance default check (MT.1054) feat(intune): add device compliance policy marks noncompliant check (MT.1054) Apr 7, 2026
@HugoPBrito HugoPBrito changed the title feat(intune): add device compliance policy marks noncompliant check (MT.1054) feat(intune): add device compliance policy marks noncompliant check Apr 7, 2026
@github-actions github-actions bot added compliance Issues/PRs related with the Compliance Frameworks and removed component/mcp-server labels Apr 8, 2026
…_policy_unassigned_devices_not_compliant_by_default

Rename from intune_device_compliance_policy_marks_noncompliant to better
reflect the check's purpose: verifying that unassigned devices are marked
as not compliant by default. Update metadata, compliance mapping, tests,
and changelog accordingly.
Replace mock.MagicMock (class) with mock.MagicMock() (instance) and
explicitly set verification_error=None to prevent state pollution
between tests when pytest runs them in alphabetical order.
@HugoPBrito HugoPBrito force-pushed the PROWLER-855-mt-1054-intune-compliance-default branch from c2137a3 to 1c9dd87 Compare April 8, 2026 15:10
Revert intune_service.py and intune_service_test.py to master state
(retry logic was not part of this check). Remove unnecessary __init__.py
from test directory.
Reverts the accidental removal of intune_service.py retry logic and
its corresponding tests in intune_service_test.py.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

compliance Issues/PRs related with the Compliance Frameworks metadata-review provider/m365 Issues/PRs related with the M365 provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant