Repository navigation
P6: publish per-rule quality and make calibration evidence-based - #35
Merged
Merged
Conversation
Predictive security roadmap P6 (calibration and feedback): - buildRuleQuality() (packages/risk-engine/src/rule-quality.ts): from a rule's open/suppressed/resolved issue counts it computes handled = suppressed + resolved, dismissalRate = suppressed / handled, and a verdict — reliable under 20% over at least RULE_QUALITY_MIN_HANDLED (10) closed issues, noisy at 50% or more, mixed between, insufficient-data before that — sorted noisy-first. The doc comment is explicit that suppression is the recorded human judgement (reason, actor, expiry live in the status history) and the rate is a noise proxy, not precision: ground truth needs outcome labels from GuardDuty/Security Hub and incidents, which remain a later phase. - DynamoDBIssueRepository.getRuleStatusCounts() reads the counts through the same bounded StatusIndex projections the severity summary uses, projecting ruleId instead of severity. - GET /rules/quality (Viewer, static route before /rules/:id) joins the counts with the catalogue (name, team, severity, enabled, auto-ticket, inCatalogue for retired rules) and returns the thresholds alongside, so the verdict rule is visible rather than implied. A /rules page under Risks renders the table sorted noisy-first with the proxy and threshold explained. - Calibration policy: severity, scoring-weight, and auto-ticket changes cite the report as evidence; AGENTS.md 2.3 now says so, and the thresholds are constants so the change is an edit with recorded evidence. Per the parity port decision, RULE-006/031-034 stay off auto-ticket until their measured rate supports turning it on — the first live enablement waits for production data, and the CHANGELOG note says exactly that rather than guessing a change. Why this is safe: strictly additive and read-only — no issue, severity, or published claim changes; the endpoint is Viewer-gated, bounded by the same reads the issue summary already makes, and unknown rule ids are flagged instead of hidden.
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
Predictive security roadmap P6 (calibration and feedback). 19 files, +573/−4.
buildRuleQuality()— from each rule's open/suppressed/resolved issue counts:handled = suppressed + resolved,dismissalRate = suppressed ÷ handled, and a verdict (reliable<20% over ≥10 closed,noisy≥50%,mixedbetween,insufficient-databefore that), sorted noisy-first. Documented explicitly as a noise proxy, not precision — suppression is the recorded human judgement (reason/actor/expiry live in status history); ground truth needs outcome labels from GuardDuty/Security Hub/incidents (later phase).getRuleStatusCounts()— same boundedStatusIndexprojections the severity summary uses, projectingruleId.GET /rules/quality(Viewer; static route registered before/rules/:id) joins counts with the catalogue (name, team, severity, enabled, auto-ticket,inCataloguefor retired rules) and returns the thresholds, so the verdict rule is visible rather than implied./rulespage under Risks — table sorted noisy-first with the proxy and thresholds explained; nav + nav test updated.Why this is safe
/issues/summaryalready makes.inCatalogue: false) rather than silently hidden.Test plan
npx jest --runInBand— 17 projects / 1723 tests passednpm run typecheck; full workspace lint;npm run format:checknpm run ci:build;npm run package:lambdas && npm run smoke:lambdas