-
Notifications
You must be signed in to change notification settings - Fork 2k
feat(m365): add defender_safe_attachments_policy_enabled security check #9833
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: master
Are you sure you want to change the base?
feat(m365): add defender_safe_attachments_policy_enabled security check #9833
Conversation
Add new security check defender_safe_attachments_policy_enabled for m365 provider. Includes check implementation, metadata, and unit tests.
|
✅ All necessary |
caa4de6 to
8eb2e7c
Compare
|
✅ Conflict Markers Resolved All conflict markers have been successfully resolved in this pull request. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #9833 +/- ##
===========================================
- Coverage 86.60% 76.41% -10.19%
===========================================
Files 222 177 -45
Lines 5645 9554 +3909
===========================================
+ Hits 4889 7301 +2412
- Misses 756 2253 +1497
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
🔒 Container Security ScanImage: 📊 Vulnerability Summary
3 package(s) affected
|
When Microsoft Defender for Office 365 licensing is not available, PowerShell cmdlets like Get-SafeAttachmentPolicy fail with "not recognized as a name of a cmdlet" errors. This change: - Detects cmdlet not found errors in the PowerShell layer - Logs a clear WARNING instead of ERROR with licensing guidance - Allows execution to continue gracefully, skipping affected checks
Test folders should not contain __init__.py files. Only check implementation folders require them for proper module loading.
When no Safe Attachments policies are found, the check now returns a FAIL finding instead of no findings. This aligns with Maester/CIS expectations that absence of required security features indicates non-compliance.
|
Please also map the check in the corresponding compliances. |
…iance Map the new defender_safe_attachments_policy_enabled check to: - CIS 4.0 M365 requirement 2.1.4 - CIS 6.0 M365 requirement 2.1.4
…fender-safe-attachments-policy-enabled
Move defender_safe_attachments_policy_enabled entry from v5.17.0 (already released) to v5.18.0 unreleased section.
tests/providers/m365/services/defender/defender_safe_attachments_policy_enabled/__init__.py
Outdated
Show resolved
Hide resolved
| else: | ||
| # For other policies, check if they have secure settings | ||
| if policy.enable and policy.action == "Block": | ||
| report.status = "PASS" | ||
| report.status_extended = f"Safe Attachments policy {policy.name} is enabled with Action=Block." | ||
| elif not policy.enable: | ||
| report.status = "FAIL" | ||
| report.status_extended = ( | ||
| f"Safe Attachments policy {policy.name} is not enabled." | ||
| ) | ||
| else: | ||
| report.status = "FAIL" | ||
| report.status_extended = f"Safe Attachments policy {policy.name} has Action={policy.action}, which is less secure than Block." | ||
|
|
||
| findings.append(report) | ||
|
|
||
| return findings |
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.
Default one applies to all users and domains, but custom ones may not. We have to check the higher priority one and ensure all users and domains are selected.
Please use defender_antispam_outbound_policy_configured as reference.
Context
Adds a new security check
defender_safe_attachments_policy_enabledfor the m365 provider.Description
This PR adds a new security check for m365:
defender_safe_attachments_policy_enabledSteps to review
prowler/providers/m365/services/defender/defender_safe_attachments_policy_enabled/poetry run pytest tests/providers/m365/services/defender/defender_safe_attachments_policy_enabled/ -vChecklist
Community Checklist
SDK/CLI
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.