feat(scanner): add enterprise security operations rules - #274
Open
TFT444 wants to merge 3 commits into
Open
Conversation
Signed-off-by: Tanvir Farhad <tamimtarafder12@gmail.com>
…262) Implements the ten AZ-SECOPS controls on top of the issue #262 collection foundation (fe172ce): activity-log export and category coverage, critical resource diagnostics, log retention and destination-ownership checks, Defender for Cloud plan coverage and recommendation SLA, and Microsoft Sentinel connector health, analytics coverage, and incident-response notification destinations. - Extends scanner/security_operations.py with Defender pricing/assessments collectors and Sentinel auto-discovery: every Log Analytics workspace is enumerated subscription-wide, then checked individually for Sentinel onboarding, so scope is discovered rather than configured. Adds a PARTIAL CollectionStatus for this per-workspace fan-out so a permission failure on one workspace doesn't discard evidence from every other workspace. - Adds ten rule modules (AZ-SECOPS-001..010) under scanner/rules/, each reading its policy from OPENSHIELD_SECURITY_OPERATIONS_POLICY and representing PASS/NOT_APPLICABLE/UNKNOWN as an empty findings list with a log line (matching the existing az_dl_00x/az_kv_003 convention) so engine.py's findings-list contract needs no changes. FAIL findings carry scope, destination, retention, ownership, evidence timestamp, permissions, and an explicit unknown_reason field in metadata. - Adds a CLI remediation playbook per rule under playbooks/cli/. - Adds real, researched CIS Azure Foundations Benchmark v2.0, NIST CSF v1.1, ISO 27001:2013, and SOC 2 mappings for all ten rules in compliance/frameworks/*.json. Three controls (log-destination ownership, Sentinel connector health, Sentinel analytics coverage) have no dedicated CIS benchmark control and use the existing N/A-<RULE_ID> convention rather than a fabricated match. - Adds unit tests covering complete/incomplete diagnostics, category matching, retention boundaries, destination ownership, Defender pricing tiers and SLA age (including the no-timestamp case), Sentinel connector and analytics states, action-group/automation-rule alternatives, empty inventories, approved exclusions, and permission/API failures. - Updates docs/security-operations-rules.md with per-rule documentation and documents the findings-list outcome model as a known limitation. Signed-off-by: Tanvir Farhad <tamimtarafder12@gmail.com>
Signed-off-by: Tanvir Farhad <tamimtarafder12@gmail.com>
TFT444
requested review from
SHAURYAKSHARMA24,
Vishnu2707,
parthrohit22 and
ritiksah141
as code owners
August 13, 2026 23:23
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.OpenSSF Scorecard
Scanned Files
|
TFT444
requested review from
m-khan-97
and removed request for
SHAURYAKSHARMA24 and
parthrohit22
August 13, 2026 23:27
Collaborator
Author
m-khan-97
approved these changes
Aug 14, 2026
m-khan-97
left a comment
Collaborator
There was a problem hiding this comment.
Large PR, reviewed thoroughly — fetched the branch, installed the missing azure-mgmt-monitor dependency, and ran all 84 tests (pass). This is genuinely strong engineering, worth calling out specifically:
- Fail-safe policy loading is correctly threaded end-to-end.
load_policy_from_envnever raises — unset env var, missing file, or failed strict validation all collapse toNone, and every rule treatsNoneas UNKNOWN (empty list, no finding) rather than silently claiming compliance. Traced this through AZ-SECOPS-001 to confirm the contract actually holds in a real rule, not just in the docstring. CollectionResult's PARTIAL status is a genuinely useful addition for the Sentinel per-workspace collectors — distinguishing "workspace confirmed not onboarded" from "workspace onboarding state unknown" is exactly the right nuance for a security tool, andfailed_scopesis threaded through so callers can't accidentally conflate the two.- Compliance JSON completeness is correct this time — verified all 10 AZ-SECOPS rules present in all 4 framework JSONs with matching keys, learning from the gap in the earlier resilience-rules round.
load_security_operations_policy's strict validation (exact field-set match, positive-integer checks, non-empty-string list validation) means a malformed policy file fails loudly at load time rather than silently producing wrong results downstream.- Good honesty in the module docstring about the engine's real limitation (no side-channel for PASS/UNKNOWN/NOT_APPLICABLE) rather than hacking around it — and reusing the existing az_dl_00x/az_kv_003 convention instead of inventing a fourth pattern.
One minor, non-blocking gap: OPENSHIELD_SECURITY_OPERATIONS_POLICY is documented in docs/security-operations-rules.md but not mentioned in .env.example. Since all 10 rules are silently inert (always UNKNOWN) until this is set, someone skimming .env.example for what to configure could miss that this whole rule pack needs activating. Worth a one-line addition in a follow-up.
Approving.
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.

Summary
Implements issue #262 as a policy-driven Azure security-operations rule pack covering subscription logging, critical-resource diagnostics, retention, Defender for Cloud operational coverage, and Microsoft Sentinel detection and response readiness.
What changed
AZ-SECOPS-001throughAZ-SECOPS-010with explicit fail-closed collection behavior.Validation
Validation limits
The student subscription contained no in-scope Key Vault, SQL, or Storage resources, so controls 003-005 still require representative enterprise-resource validation. Control 007 also requires a high-severity unhealthy Defender assessment with usable age evidence to validate the complete SLA path. This preliminary test is integration evidence, not final enterprise acceptance certification.
Closes #262