feat(go): report integrity anchor context

This commit is contained in:
Luna 2026-07-22 04:04:58 -07:00
parent 88d7a6e3b8
commit a25c73ab1a
No known key found for this signature in database
6 changed files with 68 additions and 8 deletions

View file

@ -74,3 +74,19 @@ func TestCollectSlowAddsInjectedPackageOwnership(t *testing.T) {
t.Fatalf("result=%#v", result)
}
}
func TestIntegrityAnchorsAreTruthfulAndReadOnly(t *testing.T) {
directory := t.TempDir()
anchors := IntegrityAnchors(directory)
if anchors["fim_baseline"].(map[string]any)["status"] != "missing" ||
anchors["rootcheck"].(map[string]any)["enabled"] != false {
t.Fatalf("anchors=%#v", anchors)
}
if err := os.WriteFile(filepath.Join(directory, "hash-chain.jsonl"), []byte("{}\n"), 0o600); err != nil {
t.Fatal(err)
}
anchors = IntegrityAnchors(directory)
if anchors["go_assurance"].(map[string]any)["status"] != "present" {
t.Fatalf("anchors=%#v", anchors)
}
}