Skip to content

Map controls directly to Azure Policy instead of a 10-control MCSB stub - #56

Merged
warrendt merged 2 commits into
mainfrom
warrendt-fuzzy-potato
Aug 10, 2026
Merged

Map controls directly to Azure Policy instead of a 10-control MCSB stub#56
warrendt merged 2 commits into
mainfrom
warrendt-fuzzy-potato

Conversation

@warrendt

Copy link
Copy Markdown
Owner

What changed

The MCSB intermediate taxonomy (MCSBService) never shipped its real ~200-control benchmark file in any deployment (docs/BACKLOG.md B4) — every run silently fell through to a hardcoded 10-control demo set, capping mapping accuracy at whatever those 10 buckets could approximate, regardless of how good retrieval or the model were.

  1. Removed the MCSB bottleneck entirely. Deleted MCSBService, MCSBControl, the mcsb_control_id/name/domain fields on ControlMapping/ControlPolicyMapping, and the GET /mapping/mcsb/{controls,domains} endpoints. Controls now map directly against the full ~2,467-definition Azure Policy catalog — which retrieval already searched, only the MCSB label was ever gating anything. Added a deterministic, server-computed policy_category field (from the catalog's own category of the selected policies) as the replacement grouping label in CSV exports, the manual register, and the frontend.

  2. Rewrote the confidence-scoring rubric. confidence_score is now graded against how closely the selected Azure Policy definition's own text matches the control's literal wording, anchored with real worked examples pulled from the NCSP gold mapping workbook (HYOK→CMK policies ≈0.95, multi-resource encryption ≈0.75, MFA-via-Entra-Config ≈0.5-0.6, pure governance = 0.0) — instead of abstract "0.9-1.0: exact match" bullets scored against MCSB fit.

  3. Surfaced Defender for Cloud's built-in initiatives. The catalog's 150 built-in initiatives (Microsoft cloud security benchmark, ASC Default, other Defender-backing initiatives) were loaded but never retrievable. _search_azure_policies now calls initiatives_containing() per candidate so the model sees which initiative(s) already bundle it. defender_recommendations correctly stays forced-empty (no live subscription to verify free-text recommendations against).

Verification

Ran the full pytest suite before/after via git stash diff on both backend and frontend paths:

  • Backend: 405/405 pass
  • Frontend: 846 pass, 14 fail — identical failure set (same test names) on baseline and after these changes, confirming all 14 are pre-existing environment issues unrelated to this change.

No regressions introduced.

Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com
Copilot-Session: 322e5e54-ab2e-43b0-956c-5ec01cd955e7

warrendt and others added 2 commits August 10, 2026 11:14
compliance-pipeline/ was a fourth, fully standalone mapping stack with
its own policy_mapper.py hardcoding a 64-GUID menu (32 overlapping the
backend's pre-B1 34-GUID menu) - the same defect B1 fixed in the
backend pipeline, at larger scale, in a copy nothing in app/ imports
or references (confirmed: no code or test under app/ touches it).

Deleted the whole directory rather than reworking it to delegate to
AIMappingService: it has its own requirements.txt and entry point,
never shared a runtime with the backend, and nothing depends on it.
Hardcoding a policy shortlist is exactly the failure mode the AI
mapping engine exists to avoid - a curated list caps recall at whatever
its author thought of, against a catalogue of 2,467 shipped
definitions. Removed its two remaining references in README.md and
docs/FUNCTIONAL_SPEC.md.

There is now exactly one mapping engine in the repository
(AIMappingService), reached by both the services path and the pipeline
path (B1).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 39bc839d-c643-40f2-b8a7-a7e524d91ed6
…SB stub

The MCSB intermediate taxonomy (MCSBService) never shipped its real ~200-
control benchmark file in any deployment (docs/BACKLOG.md B4) - every run
silently fell through to a hardcoded 10-control demo set, capping mapping
accuracy at whatever those 10 buckets could approximate regardless of how
good retrieval or the model were.

- Removed MCSBService, MCSBControl, and the mcsb_control_id/name/domain
  fields from ControlMapping/ControlPolicyMapping. Controls now map
  directly against the full ~2,467-definition Azure Policy catalog, which
  retrieval already used - only the MCSB label was ever gating anything.
  Added a deterministic, server-computed policy_category field (from the
  catalog's own category of the selected policies) as the replacement
  grouping label in CSV exports, the manual register, and the frontend.
- Rewrote the confidence-scoring rubric in SYSTEM_PROMPT to grade
  confidence_score against how closely the selected Azure Policy
  definition's own text matches the control's literal wording, anchored
  with real worked examples from the NCSP gold mapping workbook, instead
  of abstract "0.9-1.0: exact match" bullets scored against MCSB fit.
- Surfaced built-in initiatives (Microsoft cloud security benchmark, ASC
  Default, other Defender for Cloud initiatives) as retrieval context via
  policy_catalog_service.initiatives_containing(), so Defender's own
  policies/configs/initiatives are considered as legitimate mapping
  candidates. defender_recommendations stays forced-empty (no live
  subscription to verify free-text recommendations against).
- Removed the GET /mapping/mcsb/{controls,domains} endpoints and the MCSB
  gate on the /health status field.

Verified: full backend pytest suite (405/405) and frontend suite (846
pass) both regression-clean against baseline (git stash diff showed an
identical pre-existing 14-test failure set on both, none introduced here).

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 322e5e54-ab2e-43b0-956c-5ec01cd955e7
@warrendt
warrendt merged commit dae8925 into main Aug 10, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant