
Implementing Mobile Application Management
- 1 installs
- 27.3k repo stars
- Updated August 2, 2026
- mukul975/anthropic-cybersecurity-skills
Implement Mobile Application Management policies to protect enterprise data on BYOD devices with app-level DLP, selective wipe, and containerization.
About
Implements Mobile Application Management (MAM) policies that protect enterprise data on managed and unmanaged devices through app-level DLP, selective wipe, and containerization. A security team uses it to deploy Intune App Protection Policies and separate work from personal data on BYOD.
- App-level DLP, selective wipe, and containerization
- Intune App Protection Policies for BYOD data separation
Implementing Mobile Application Management by the numbers
- 1 all-time installs (skills.sh)
- Ranked #1,834 of 2,203 Security skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/mukul975/anthropic-cybersecurity-skills --skill implementing-mobile-application-managementAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 1 |
|---|---|
| repo stars | ★ 27.3k |
| Last updated | August 2, 2026 |
| Repository | mukul975/anthropic-cybersecurity-skills ↗ |
What it does
Implement Mobile Application Management policies to protect enterprise data on BYOD devices with app-level DLP, selective wipe, and containerization.
Files
Implementing Mobile Application Management
When to Use
Use this skill when:
- Deploying enterprise mobile app protection without full device management (MDM)
- Implementing BYOD policies that protect corporate data while respecting personal privacy
- Configuring Microsoft Intune App Protection Policies for iOS and Android
- Enforcing data loss prevention controls on managed mobile applications
Do not use when full device management (MDM) is already deployed and sufficient -- MAM adds complexity when MDM already provides the needed controls.
Prerequisites
- Microsoft Intune or equivalent MAM platform (VMware Workspace ONE, MobileIron)
- Azure AD for identity and conditional access policies
- Intune App SDK integrated into target applications (or Intune App Wrapping Tool)
- Test devices (Android 10+ and iOS 15+)
- Azure AD Premium P1 or P2 licenses for conditional access
Workflow
Step 1: Define App Protection Policy Requirements
Classify data sensitivity and define protection tiers:
| Tier | Data Type | Controls |
|---|---|---|
| Tier 1 - Basic | General corporate email | Require PIN, block screenshots |
| Tier 2 - Enhanced | Financial data, HR records | Encrypt app data, restrict cut/copy/paste |
| Tier 3 - High | PII, healthcare, legal | Selective wipe, offline access limits, DLP |
Step 2: Configure Intune App Protection Policies
Android App Protection Policy:
{
"displayName": "Corporate App Protection - Tier 2",
"platform": "android",
"dataProtectionSettings": {
"allowedDataStorageLocations": ["oneDriveForBusiness", "sharePoint"],
"blockDataTransferToOtherApps": "managedApps",
"blockDataTransferFromOtherApps": "managedApps",
"saveAsBlocked": true,
"clipboardSharingLevel": "managedAppsWithPasteIn",
"screenCaptureBlocked": true,
"encryptAppData": true,
"backupBlocked": true
},
"accessSettings": {
"pinRequired": true,
"minimumPinLength": 6,
"biometricEnabled": true,
"offlineGracePeriod": 720,
"offlineWipeInterval": 90
},
"conditionalLaunchSettings": {
"maxOsVersion": "15.0",
"minOsVersion": "12.0",
"jailbreakBlocked": true,
"maxPinRetries": 5
}
}Step 3: Implement App Configuration Policies
Deploy managed app configuration for automatic endpoint setup:
{
"displayName": "Email App Configuration",
"targetedManagedApps": ["com.microsoft.outlooklite"],
"settings": [
{"key": "com.microsoft.outlook.EmailProfile.AccountType", "value": "ModernAuth"},
{"key": "com.microsoft.outlook.EmailProfile.ServerName", "value": "outlook.office365.com"},
{"key": "com.microsoft.outlook.EmailProfile.AllowedDomains", "value": "corporate.com"}
]
}Step 4: Deploy Conditional Access Integration
Azure AD > Conditional Access > New Policy:
- Users: All users with corporate apps
- Cloud apps: Office 365, custom LOB apps
- Conditions: All platforms
- Grant: Require app protection policy
- Session: App enforced restrictionsStep 5: Test and Validate MAM Controls
Test each policy control on both platforms:
# Verify data transfer restrictions
1. Open managed app (Outlook)
2. Copy text from email body
3. Attempt paste in unmanaged app (Notes) -- should be blocked
4. Attempt paste in managed app (Teams) -- should work
# Verify selective wipe
1. Enroll test device with MAM
2. Access corporate data in managed apps
3. Trigger selective wipe from Intune portal
4. Verify corporate data removed, personal data intact
# Verify offline grace period
1. Access managed app while connected
2. Disconnect from network
3. After grace period expires, verify app access blockedStep 6: Monitor and Respond
Configure MAM monitoring dashboards:
- App protection policy assignment status
- Non-compliant device/user reports
- Selective wipe execution logs
- Jailbreak/root detection alerts
- Failed PIN attempt tracking
Key Concepts
| Term | Definition |
|---|---|
| MAM | Mobile Application Management - app-level policies without requiring full device enrollment |
| App Protection Policy | Set of rules enforcing data protection at the app level (encryption, DLP, access controls) |
| Selective Wipe | Removing only corporate data from managed apps while preserving personal data |
| App Wrapping | Post-build process applying MAM SDK policies to apps without source code modification |
| Containerization | Isolating corporate app data in an encrypted container separate from personal apps |
Tools & Systems
- Microsoft Intune: Cloud-based MAM/MDM platform with app protection policies
- Intune App SDK: SDK for integrating MAM controls into custom iOS/Android apps
- Intune App Wrapping Tool: Post-compilation tool for applying MAM policies without code changes
- VMware Workspace ONE: Alternative MAM platform with app containerization
- Azure AD Conditional Access: Policy engine for enforcing MAM enrollment as access condition
Common Pitfalls
- SDK version mismatch: Intune App SDK version must match the policy version. Outdated SDK versions may silently fail to enforce newer policies.
- iOS managed pasteboard: iOS enforces paste restrictions through managed pasteboard, which requires the app to opt-in via Intune SDK integration.
- App wrapping limitations: Wrapped apps cannot use certain features (push notifications on some platforms). SDK integration is preferred for full functionality.
- User experience friction: Overly restrictive policies cause user frustration and shadow IT. Start with Tier 1 and escalate based on data sensitivity.
MAM Implementation Report
Policy Configuration
| Setting | Value | Baseline | Compliant |
|---|---|---|---|
| PIN Required | [VALUE] | [EXPECTED] | [YES/NO] |
| Encryption | [VALUE] | [EXPECTED] | [YES/NO] |
| Clipboard Restriction | [VALUE] | [EXPECTED] | [YES/NO] |
| Screenshot Blocked | [VALUE] | [EXPECTED] | [YES/NO] |
| Jailbreak Blocked | [VALUE] | [EXPECTED] | [YES/NO] |
Managed Applications
| App | Platform | SDK Integrated | Policy Assigned |
|---|---|---|---|
| [APP] | [PLATFORM] | [YES/NO] | [YES/NO] |
Recommendations
1. [RECOMMENDATION]
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to the Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by the Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding any notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. Please do not remove or change
the license header comment from a contributed file except when
necessary.
Copyright 2026 mukul975
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
API Reference: Implementing Mobile Application Management
Microsoft Intune MAM API (Graph)
import requests
headers = {"Authorization": "Bearer <token>"}
# List MAM policies
policies = requests.get(
"https://graph.microsoft.com/v1.0/deviceAppManagement/managedAppPolicies",
headers=headers).json()
# List managed apps
apps = requests.get(
"https://graph.microsoft.com/v1.0/deviceAppManagement/managedAppRegistrations",
headers=headers).json()MAM Policy Settings
| Setting | Recommended | Description |
|---|---|---|
| pinRequired | true | Require app PIN |
| encryptAppData | true | Encrypt app data |
| dataBackupBlocked | true | Block iCloud/Google backup |
| screenCaptureBlocked | true | Block screenshots |
| managedBrowserRequired | true | Force managed browser |
| maxPinRetries | 5 | Wipe after failures |
Conditional Launch Settings
| Condition | Action | Value |
|---|---|---|
| Jailbreak/root | Block | true |
| Min OS version | Warn/Block | 16.0 |
| Offline wipe | Wipe | 30 days |
| Max PIN retries | Wipe | 5 |
References
- Intune MAM: https://learn.microsoft.com/en-us/mem/intune/apps/app-protection-policy
- Graph API MAM: https://learn.microsoft.com/en-us/graph/api/resources/intune-mam-conceptual
Standards Reference: Mobile Application Management
NIST SP 800-124 Rev 2 - Mobile Device Security
- Section 4: Enterprise mobile security technologies (MDM, MAM, MTD)
- Section 5: App vetting and management requirements
OWASP Mobile Top 10 2024
| ID | Risk | MAM Mitigation |
|---|---|---|
| M6 | Inadequate Privacy Controls | Data separation between personal and corporate |
| M8 | Security Misconfiguration | Enforced app configuration policies |
| M9 | Insecure Data Storage | App-level encryption and backup restrictions |
CIS Controls v8
| Control | MAM Relevance |
|---|---|
| 2.5 | Allowlist authorized mobile software |
| 3.6 | Encrypt data on end-user devices |
| 6.4 | Require MFA for remote access |
Workflows: Mobile Application Management
Workflow 1: MAM Deployment
[Define data classification] --> [Create protection tiers] --> [Configure policies]
| |
[Identify managed apps] [App protection policies]
[Integrate Intune SDK] [App configuration policies]
[Conditional access]
|
[Test on pilot devices]
[Validate DLP controls]
[Roll out to users]#!/usr/bin/env python3
"""Mobile Application Management Agent - audits MDM policies, app inventory, and compliance posture."""
import json
import argparse
import logging
import subprocess
from collections import defaultdict
from datetime import datetime
logging.basicConfig(level=logging.INFO, format="%(asctime)s [%(levelname)s] %(message)s")
logger = logging.getLogger(__name__)
def mdm_api_request(base_url, token, endpoint, method="GET"):
"""Execute MDM API request via curl."""
cmd = ["curl", "-s", "-X", method,
"-H", f"Authorization: Bearer {token}",
"-H", "Accept: application/json",
f"{base_url}{endpoint}"]
result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
return json.loads(result.stdout) if result.stdout else {}
def get_managed_devices(base_url, token):
"""Get all managed devices."""
return mdm_api_request(base_url, token, "/api/v1/devices")
def get_managed_apps(base_url, token):
"""Get managed application inventory."""
return mdm_api_request(base_url, token, "/api/v1/apps")
def get_compliance_policies(base_url, token):
"""Get device compliance policies."""
return mdm_api_request(base_url, token, "/api/v1/compliance/policies")
def get_app_protection_policies(base_url, token):
"""Get MAM app protection policies."""
return mdm_api_request(base_url, token, "/api/v1/app-protection-policies")
def audit_device_compliance(devices):
"""Audit device compliance status."""
compliant = 0
non_compliant = 0
issues = defaultdict(int)
for device in devices:
if device.get("compliance_state") == "compliant":
compliant += 1
else:
non_compliant += 1
for issue in device.get("compliance_issues", []):
issues[issue] += 1
return {
"total_devices": len(devices),
"compliant": compliant,
"non_compliant": non_compliant,
"compliance_rate": round(compliant / max(len(devices), 1) * 100, 1),
"top_issues": dict(sorted(issues.items(), key=lambda x: x[1], reverse=True)[:10]),
}
def audit_app_security(apps):
"""Audit managed app security configuration."""
findings = []
for app in apps:
app_name = app.get("name", "unknown")
if not app.get("managed"):
findings.append({"app": app_name, "issue": "unmanaged_app", "severity": "medium"})
if app.get("data_sharing_allowed"):
findings.append({"app": app_name, "issue": "data_sharing_enabled", "severity": "high"})
if not app.get("encryption_required"):
findings.append({"app": app_name, "issue": "encryption_not_required", "severity": "high"})
if not app.get("pin_required"):
findings.append({"app": app_name, "issue": "no_app_pin", "severity": "medium"})
if app.get("allow_backup_to_cloud"):
findings.append({"app": app_name, "issue": "cloud_backup_allowed", "severity": "medium"})
return findings
def audit_protection_policies(policies):
"""Audit MAM protection policy configuration."""
results = []
for policy in policies:
checks = {
"data_transfer_restricted": policy.get("restrict_cut_copy_paste", False),
"save_as_blocked": policy.get("block_save_as", False),
"screen_capture_blocked": policy.get("block_screen_capture", False),
"managed_browser_required": policy.get("require_managed_browser", False),
"min_os_version_set": bool(policy.get("minimum_os_version")),
"jailbreak_detection": policy.get("block_jailbroken", False),
"offline_grace_period_set": bool(policy.get("offline_interval")),
}
passed = sum(1 for v in checks.values() if v)
results.append({
"policy_name": policy.get("name", "unknown"),
"platform": policy.get("platform", "unknown"),
"checks": checks,
"score": round(passed / max(len(checks), 1) * 100, 1),
})
return results
def generate_report(devices, apps, policies, protection_policies):
device_audit = audit_device_compliance(devices)
app_findings = audit_app_security(apps)
policy_audit = audit_protection_policies(protection_policies)
report = {
"timestamp": datetime.utcnow().isoformat(),
"device_compliance": device_audit,
"app_security_findings": len(app_findings),
"high_severity_findings": len([f for f in app_findings if f["severity"] == "high"]),
"app_findings_detail": app_findings[:20],
"protection_policy_audit": policy_audit,
"overall_mam_score": round(
sum(p["score"] for p in policy_audit) / max(len(policy_audit), 1), 1),
}
return report
def main():
parser = argparse.ArgumentParser(description="Mobile Application Management Audit Agent")
parser.add_argument("--mdm-url", required=True, help="MDM/UEM API base URL")
parser.add_argument("--token", required=True, help="API bearer token")
parser.add_argument("--output", default="mam_audit_report.json")
args = parser.parse_args()
devices = get_managed_devices(args.mdm_url, args.token)
apps = get_managed_apps(args.mdm_url, args.token)
policies = get_compliance_policies(args.mdm_url, args.token)
protection = get_app_protection_policies(args.mdm_url, args.token)
report = generate_report(devices, apps, policies, protection)
with open(args.output, "w") as f:
json.dump(report, f, indent=2, default=str)
logger.info("MAM audit: %d devices (%.1f%% compliant), %d app findings, MAM score %.1f%%",
report["device_compliance"]["total_devices"],
report["device_compliance"]["compliance_rate"],
report["app_security_findings"], report["overall_mam_score"])
print(json.dumps(report, indent=2, default=str))
if __name__ == "__main__":
main()
#!/usr/bin/env python3
"""
MAM Policy Compliance Checker
Validates Intune App Protection Policy configurations against security baselines.
Usage:
python process.py --policy policy.json [--baseline tier2] [--output report.json]
"""
import argparse
import json
import sys
from datetime import datetime
from pathlib import Path
BASELINE_TIER2 = {
"pin_required": True,
"min_pin_length": 6,
"biometric_enabled": True,
"encrypt_app_data": True,
"screen_capture_blocked": True,
"backup_blocked": True,
"clipboard_restriction": "managedApps",
"jailbreak_blocked": True,
"offline_grace_period_max_minutes": 1440,
"max_pin_retries": 5,
}
BASELINE_TIER3 = {
**BASELINE_TIER2,
"min_pin_length": 8,
"clipboard_restriction": "blocked",
"offline_grace_period_max_minutes": 720,
"save_as_blocked": True,
"printing_blocked": True,
"max_pin_retries": 3,
}
def check_compliance(policy: dict, baseline: dict) -> list:
"""Check policy against baseline requirements."""
findings = []
data = policy.get("dataProtectionSettings", {})
access = policy.get("accessSettings", {})
conditional = policy.get("conditionalLaunchSettings", {})
checks = {
"pin_required": access.get("pinRequired"),
"min_pin_length": access.get("minimumPinLength", 0),
"biometric_enabled": access.get("biometricEnabled"),
"encrypt_app_data": data.get("encryptAppData"),
"screen_capture_blocked": data.get("screenCaptureBlocked"),
"backup_blocked": data.get("backupBlocked"),
"jailbreak_blocked": conditional.get("jailbreakBlocked"),
}
for control, expected in baseline.items():
actual = checks.get(control)
if actual is None:
findings.append({
"control": control,
"status": "MISSING",
"expected": expected,
"actual": None,
"severity": "HIGH",
})
elif isinstance(expected, bool) and actual != expected:
findings.append({
"control": control,
"status": "NON_COMPLIANT",
"expected": expected,
"actual": actual,
"severity": "HIGH",
})
elif isinstance(expected, int) and isinstance(actual, int) and actual < expected:
findings.append({
"control": control,
"status": "BELOW_MINIMUM",
"expected": f">= {expected}",
"actual": actual,
"severity": "MEDIUM",
})
return findings
def main():
parser = argparse.ArgumentParser(description="MAM Policy Compliance Checker")
parser.add_argument("--policy", required=True, help="Policy JSON file")
parser.add_argument("--baseline", choices=["tier2", "tier3"], default="tier2")
parser.add_argument("--output", default="mam_compliance.json")
args = parser.parse_args()
with open(args.policy) as f:
policy = json.load(f)
baseline = BASELINE_TIER3 if args.baseline == "tier3" else BASELINE_TIER2
findings = check_compliance(policy, baseline)
compliant_count = len(baseline) - len(findings)
report = {
"check": {"policy": args.policy, "baseline": args.baseline, "date": datetime.now().isoformat()},
"summary": {
"total_controls": len(baseline),
"compliant": compliant_count,
"non_compliant": len(findings),
},
"findings": findings,
}
with open(args.output, "w") as f:
json.dump(report, f, indent=2)
print(f"[+] Compliance: {compliant_count}/{len(baseline)} controls pass")
print(f"[+] Report saved: {args.output}")
if __name__ == "__main__":
main()