feat(go): report integrity anchor context
This commit is contained in:
parent
88d7a6e3b8
commit
a25c73ab1a
6 changed files with 68 additions and 8 deletions
|
|
@ -291,6 +291,7 @@ func (s *Store) applySlowEnrichment(job slowJob) {
|
|||
processes := enrichmentProcesses(report.Processes)
|
||||
paths := enrichmentPaths(report.Enrichment)
|
||||
updates := enrich.CollectSlow(processes, paths, provenance.PackageOwner)
|
||||
updates.Integrity = enrich.IntegrityAnchors(s.Dir)
|
||||
|
||||
// All slow I/O has completed. Take the lock only to merge into the newest
|
||||
// same-second report, so a concurrent alert capture never loses evidence.
|
||||
|
|
@ -361,6 +362,9 @@ func mergeSlow(report *Report, updates enrich.SlowResult) {
|
|||
}
|
||||
}
|
||||
}
|
||||
if updates.Integrity != nil {
|
||||
report.Enrichment["integrity"] = updates.Integrity
|
||||
}
|
||||
}
|
||||
|
||||
func nullToNil(value any) any {
|
||||
|
|
|
|||
|
|
@ -171,6 +171,11 @@ func TestSlowEnrichmentAddsBoundedHashAndFileMetadata(t *testing.T) {
|
|||
if file["exists"] != true || file["mode"] != float64(0o600) {
|
||||
t.Fatalf("file enrichment=%#v", file)
|
||||
}
|
||||
integrity := report.Enrichment["integrity"].(map[string]any)
|
||||
if integrity["go_assurance"].(map[string]any)["status"] != "present" ||
|
||||
integrity["rootcheck"].(map[string]any)["enabled"] != false {
|
||||
t.Fatalf("integrity enrichment=%#v", integrity)
|
||||
}
|
||||
logRaw, err := os.ReadFile(filepath.Join(store.Dir, "alert-20260722-101112.log"))
|
||||
if err != nil || !strings.Contains(string(logRaw), "ENODIA SENTINEL ALERT") {
|
||||
t.Fatalf("slow log err=%v text=%q", err, logRaw)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue