Repository navigation
Conversation
… read Four Azure monitoring fetchers (activity_log_alerts, diagnostic_settings, resource_diagnostic_settings, log_analytics_workspaces) read 0 or false for every count and verdict built from a list that was refused or failed. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
An unread alert processing rule list no longer reads as no suppression. The operation totals stay numbers when the alert list is unread, the resource inventory read flag is explicit, and a read-and-empty workspace test is added. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
# Conflicts: # CHANGELOG.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
bruceweygandt
left a comment
There was a problem hiding this comment.
The main change is correct in all four fetchers. An unread alert list,
diagnostic setting list, Resource Graph inventory or workspace list now gives
null counts, maps and verdicts, not 0 or false. A list that was read and is
empty still gives 0 and false. The fixed totals stay. The version bumps
(activity_log_alerts 0.4.0, diagnostic_settings 0.2.0,
log_analytics_workspaces 0.4.0, resource_diagnostic_settings 0.5.0), the
CHANGELOG entry and the field text match the code. It merges cleanly with main,
and the tests pass. One gap remains, in the shared routing code.
1. fetchers/azure/_shared/alert_routing.py:227-228 and :238 (should fix)
Problem: A processing rule can add an action group to an alert. When the
processing rule list was not read, route() still decides routing from the
alert's own action groups only. An alert with no own action group, or with no
own deliverable one, gets routes_to_enabled_receiver: false, and line 238
makes reaches_human false, not null. I checked this: with_routing(alert, {}, None) for an enabled alert with no action group gives
routes_to_enabled_receiver: false and reaches_human: false.
Why this is a problem: The alert record says "does not reach a person" when
this is not known. The PR text says an unread processing rule list makes
reaches_human null per alert; that is true only for alerts with a deliverable
own group. In the summary (activity_log_alerts/fetcher.py:327-332), the alert
is in neither alerts_routing_to_enabled_receiver nor alerts_routing_unknown,
and it is not in alerts_reaching_human_unknown. These three fields are not in
SUPPRESSION_FIELDS (line 268), so they read as known counts.
Fix: In route(), when rules is None and the alert is enabled, change a
False from _tri to None for routes and to_person. A True can stay,
because a known own group already delivers. Then reaches_human becomes null
too, and the unknown counts include the alert. Also return None, not [], for
processing_rule_matches and suppressed_by_processing_rules. Add a test with
an enabled alert that has no own action group. #370 has the same route()
change, so make the fix in both PRs.
# Conflicts: # CHANGELOG.md
…ert without its own group unknown With the processing rule list unread, an enabled alert with no deliverable own action group read false for routes_to_enabled_receiver, routes_to_person and reaches_human, and was missing from the unknown counts. A False from the own groups is now null, a True stays, and processing_rule_matches and suppressed_by_processing_rules are null, not []. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes FDE-1201
Part of FDE-1190
Summary
Four Azure monitoring fetchers read 0 or false for every count and verdict built from a list that was refused or failed. They now give null, the same rule as the policy compliance, managed identity and data services fixes. The run still exits 1 as
partial_failure.azure_activity_log_alerts0.4.0: an unread alert rule list nulls every alert count, both coverage maps and the coverage verdicts (the two operation totals stay 12 and 4). An unread processing rule list makessuppressedandreaches_humannull per alert and nullsalerts_suppressed,alerts_possibly_suppressed,alerts_reaching_human, the change coverage fields andmonitored_operation_coverage_reaching_human. Before: 0 and false, and alerts read as not suppressed.alert_routing.route()takesrules=Nonefor an unread list.azure_diagnostic_settings0.2.0: unread settings nullactivity_log_exported, the counts, the coverage map and the required-category verdicts. Before:activity_log_exportedfalse.azure_resource_diagnostic_settings0.5.0: an unread Resource Graph inventory nulls the resource, coverage, destination and ingestion counts and verdicts, plusin_scope_resourcesandexcluded_resources. Before: 0.azure_log_analytics_workspaces0.4.0: an unread workspace list nulls every count,in_scope_workspacesandexcluded_workspaces. A workspace whose tables or data exports are unread nullstotal_tables,min_table_total_retention_in_daysand the data export counts.sentinel_onboardedis null while any workspace's solutions are unread and none is known to have Sentinel (before: false).A list that was read and is empty still counts 0 and false. The plain-text instructions say which fields are null and when. Changelog entry added under Unreleased > Fixed.
Tests
tests/test_azure_monitoring_null_counts.py(new): per fetcher, runsmain()with the list refused (and the sub-lists refused for workspaces) and asserts every field built from it is null, plus a read-and-empty case that still counts 0/false. Added a refused processing-rule test, a fixed-totals test and a read-and-empty workspace test. With the fetcher.py files reverted to main, the refused-list tests fail and the read-case guards pass; the processing-rule test also fails against the first commit of this branch.Ran under
nice: the new file, the existing tests for these fetchers (text, verdicts, exclusions), the contract tests and the status lib tests: 1233 passed. No full suite (CI runs it).Validator check
No validator on main reads these evidence sets. On
added-validators, each validator that reads a changed field was checked against a null value:partial_failuretrue):azure_activity_log_alerts_cover_operations_routed,azure_activity_log_required_categories_exported(its regex capturesnulland the rules wanttrue),azure_diag_all_resources_ingesting_recently,azure_diag_inventory_fully_assessed,azure_diag_log_analytics_coverage_complete,azure_diag_logs_only_to_approved_workspaces.azure_diag_*,log_analytics_*andazure_activity_log_required_categories_to_log_analyticsvalidators.azure_diag_no_resource_missing_log_settingreadsresources_emitting_logs_without_settingas\d+. On an unread inventory it passed on 0; it now has no match and fails its presence rule. That pass was false (the run's collection validator fails anyway). It is not edited here; it is the user's call whether it goes back for review.The processing-rule nulls (
alerts_suppressed,alerts_possibly_suppressed,change_operation*) were checked againstazure_activity_log_alerts_cover_operations_routedwith an ECMAScript evaluation of its regex on a refused-processing-rule run: no match before (partial_failure true) and no match after (null, even with partial_failure forced false). Verdict unchanged.Changed after review
route()in_shared/alert_routing.py: with the processing rule list unread (rules is None), an enabled alert whose own action groups giveFalseforroutes_to_enabled_receiverorroutes_to_personnow gets null, because a processing rule may add a group. ATruestays.reaches_humanfollows, so the alert lands inalerts_routing_unknownandalerts_reaching_human_unknown. Disabled alerts stay false.processing_rule_matchesandsuppressed_by_processing_rulesare null, not[], when the list was not read. A list that was read and is empty still gives[]and false.route()(enabled, no own group, rules unread / read-empty / known own group / disabled) and an end-to-end run with an alert that has no action group and a refused processing rule list.alert_routing.pyis byte-identical to the one in theazure_alert_rulesPR (azure_alert_rules: suppression fields and processing rule counts are null when processing rules weren't read #370).🤖 Generated with Claude Code