MCPcopy Create free account
hub / github.com/clouditor/clouditor / IsRelevantFor

Method IsRelevantFor

api/orchestrator/orchestrator.go:169–186  ·  view source on GitHub ↗

IsRelevantFor checks, whether this control is relevant for the given audit scope. For now this mainly checks, whether the assurance level matches, if the Audit Scope has one. In the future, this could also include checks, if the control is somehow out of scope.

(auditScope *AuditScope, catalog *Catalog)

Source from the content-addressed store, hash-verified

167// checks, whether the assurance level matches, if the Audit Scope has one. In the future, this could also include checks, if
168// the control is somehow out of scope.
169func (c *Control) IsRelevantFor(auditScope *AuditScope, catalog *Catalog) bool {
170 // If the catalog does not have an assurance level, we are good to go
171 if len(catalog.AssuranceLevels) == 0 {
172 return true
173 }
174
175 // If the control does not explicitly specify an assurance level, we are also ok
176 if c.AssuranceLevel == nil || auditScope.AssuranceLevel == nil {
177 return true
178 }
179
180 // Otherwise, we need to retrieve the possible assurance levels (in order) from the catalogs and compare the
181 // indices
182 idxControl := slices.Index(catalog.AssuranceLevels, *c.AssuranceLevel)
183 idxToe := slices.Index(catalog.AssuranceLevels, *auditScope.AssuranceLevel)
184
185 return idxControl <= idxToe
186}

Callers 2

evaluateCatalogMethod · 0.80
evaluateControlMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected