Skip to content

Commit

Permalink
🧹 Report checks by mrn when used by controls
Browse files Browse the repository at this point in the history
For frameworks reporting, we want the ability to display how checks
scored for a control. We aggregate the information by check. In some
cases, we have checks that have different MRNs but the same code. This
makes it difficult to separate these. This change modifies the reporting
structure for controls. We don't directly send the check score to the control.
Instead, a new reporting job is inserted that reports to the query mrn.
And then that reports to the control.
  • Loading branch information
jaym committed Aug 1, 2023
1 parent 352eec9 commit d7c2b24
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions policy/resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -1536,6 +1536,18 @@ func (s *LocalServices) jobsToControls(cache *frameworkResolverCache, framework
continue
}

// Create a reporting job from the query code id to one with the mrn.
// This isn't 100% correct. We don't keep track of all the queries that
// have the same code id.
uuid := cache.relativeChecksum(query.Mrn)
queryJob := &ReportingJob{
Uuid: uuid,
QrId: query.Mrn,
ChildJobs: map[string]*explorer.Impact{},
Type: ReportingJob_CHECK,
}
nuJobs[uuid] = queryJob

for i := range targets {
controlMrn := targets[i]
// skip controls which are part of a FrameworkGroup with type DISABLE
Expand All @@ -1546,8 +1558,11 @@ func (s *LocalServices) jobsToControls(cache *frameworkResolverCache, framework
}
controlJob := ensureControlJob(cache, nuJobs, controlMrn, framework, frameworkGroupByControlMrn)

controlJob.ChildJobs[rj.Uuid] = nil
rj.Notify = append(rj.Notify, controlJob.Uuid)
queryJob.ChildJobs[rj.Uuid] = nil
rj.Notify = append(rj.Notify, queryJob.Uuid)

controlJob.ChildJobs[queryJob.Uuid] = nil
queryJob.Notify = append(queryJob.Notify, controlJob.Uuid)
}
}

Expand Down

0 comments on commit d7c2b24

Please sign in to comment.