Skip to content

Commit 42a2719

Browse files
authored
fix: check all platform mrns (#1498)
1 parent 457c08f commit 42a2719

File tree

1 file changed

+15
-10
lines changed

1 file changed

+15
-10
lines changed

policy/scan/local_scanner.go

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -372,18 +372,23 @@ func (s *LocalScanner) distributeJob(job *Job, ctx context.Context, upstream *up
372372
cur := batch[i]
373373
asset := cur.Asset
374374
log.Debug().Str("asset", asset.Name).Strs("platform-ids", asset.PlatformIds).Msg("update asset")
375-
platformMrn := asset.PlatformIds[0]
376-
if details, ok := platformAssetMapping[platformMrn]; ok {
377-
asset.Mrn = details.AssetMrn
378-
asset.Url = details.Url
379-
asset.Labels["mondoo.com/project-id"] = details.ProjectId
380-
err = cur.Runtime.SetRecording(s.recording)
381-
if err != nil {
382-
// we do not want to stop the scan if we cannot set the recording
383-
log.Error().Err(err).Msg("could not set recording")
375+
376+
for _, platformMrn := range asset.PlatformIds {
377+
if details, ok := platformAssetMapping[platformMrn]; ok {
378+
asset.Mrn = details.AssetMrn
379+
asset.Url = details.Url
380+
asset.Labels["mondoo.com/project-id"] = details.ProjectId
381+
err = cur.Runtime.SetRecording(s.recording)
382+
if err != nil {
383+
// we do not want to stop the scan if we cannot set the recording
384+
log.Error().Err(err).Msg("could not set recording")
385+
break
386+
}
387+
cur.Runtime.AssetUpdated(asset)
388+
break
384389
}
385-
cur.Runtime.AssetUpdated(asset)
386390
}
391+
387392
}
388393
} else {
389394
// ensure we have non-empty asset MRNs

0 commit comments

Comments
 (0)