feat: surface cross-SSP inherited controls in compliance + lineage#457
feat: surface cross-SSP inherited controls in compliance + lineage#457ccf-lisa[bot] wants to merge 3 commits into
Conversation
|
This PR has been green across several automated review passes (build, unit + integration suites, lint, swagger) with no inline review threads or CI failures raised. Requesting a human review to move it forward. lisa will keep addressing any inline threads and CI failures as they come in. |
gusfcarvalho
left a comment
There was a problem hiding this comment.
Findings inline (3, none blocking). Clean import-cycle extraction into the neutral leverage package, behavior-preserving aliases keep every existing endpoint byte-for-byte, good unit + integration coverage, all CI green.
Headline: one Medium (the /leverage drawer builds the whole lineage engine — full evidence corpus included — to use just two fields) and two Low semantic/consistency flags (vacuous-full links now count toward the compliance %, and a parent control's posture badge doesn't reflect inherited children the way it reflects satisfied ones). All three are worth a look but none block merge.
gusfcarvalho
left a comment
There was a problem hiding this comment.
Re-reviewed at d48dcb9 — all three prior findings resolved, nothing new, all CI green (build/vet/gofmt/unit local + lint/unit/integration/check-diff on CI).
- Medium (drawer engine cost): fixed.
LeverageDetaildropsbuildEngine(nil,nil)entirely — control existence is now a targetedrelational.Controllookup on (catalog_id, id) with a properErrRecordNotFound→404, and downstream+upstream SSP titles come from a singlePreload("Metadata")keyed on the idsProjectForControlalready returns (deduped, nil-guarded). No more full-corpus load per drawer open. - Low (vacuous credit): fixed.
AggregateByControlnow gatesCreditonTotalResponsibilities > 0, so a dangling/empty link no longer inflates the compliance %.DeriveSatisfaction's vacuous-full is intentionally unchanged (Subscribe relies on it), and aTestAggregateByControl_ZeroResponsibilitiesNoCreditcase locks in the new behavior. - Low (posture badge vs bar): confirmed deliberate — the API emits both
node.SSP.Posture(own badge) andnode.PostureCounts/SSPBreakdown(roll-up bar) on purpose, and the UI renders the bar for structural nodes. No API change warranted.
Nice work. LGTM.
|
PR approved. Marking ready for e2e. |
What
Makes cross-SSP leveraged authorization first-class in the two compliance read surfaces. Today an inherited control (downstream subscribes to an upstream export offering, recorded in
ssp_leverage_links) shows no "inherited" indication and, when fully guaranteed upstream with no downstream evidence, reads asunknown(compliance) /attention⚠ (lineage). This adds a first-classinheritedbucket, leverage badge metadata, and a drawer endpoint.Changes
internal/service/leveragepackage — the leverage projection/aggregation was extracted here sointernal/api/handler(lineage) can read it without an import cycle (handler/oscalimportshandler, not vice-versa).oscalkeeps behavior-preserving type aliases + delegating wrappers, so every existing endpoint/test is unchanged. Shared evidence status-count/collapse logic moved torelational/evidence.go.Summarize+AggregateByControl— bulk cross-SSP link summary (live-derived satisfaction, never the stored column; ~7 queries regardless of link count) folded into per-(SSP, control-id)aggregates with the pinned credit rule (≥1 link, all active, all live-full).GET /oscal/profiles/:id/compliance-progress?sspId=) — newinheritedcount in summary + groups,computedStatus:"inherited", and a per-controlleveragebadge payload.inheritedcounts as compliant + assessed. Evidence always wins.PostureInheritedrung (above not-applicable/planned, below evidence),inheritedincompliance/postureCounts/sspBreakdown, and an optionalleveragebadge on control-node overlays and/sspsrows.derivePosturegained aninheritedCreditarg.GET /api/lineage/nodes/:key/leverage— per-downstream-SSP inherited detail (link, upstream origin + titles, responsibilities, per-responsibility posture, drift risk), read-guarded like/ssps.make swag).Semantics (pinned)
implStatusBySSP.activeAND all links live-derivedfullAND evidence collapses tounknownAND control in scope. Evidence wins both directions; partial/drifted/revoked links get no credit but still surface a badge.inheritedjoinssatisfiedincompliancePercent; joinssatisfied+notSatisfiedinassessedPercent.Tests
internal/service/leverage/leverage_test.go(credit rules, worst-status precedence, statement-scope collapse, case-fold, origin dedupe,DriftDedupeKey, vacuous-full).lineage_test.goTestDerivePosturefor the 4-arg signature + inherited-ladder cases.lineage_leverage_integration_test.go(credit/roots/breakdown//ssps//leveragedrawer, drift, evidence-wins, partial→no-credit) andoscal/profile_compliance_leverage_integration_test.go(credit, partial, no-sspId).Verification
go build ./...,make test,make test-integration(new + regression leverage/shared-responsibility/lineage/compliance suites + perf guard),make swag,make lint— all green.🤖 Generated with Claude Code