Collect sensitivity directly from document trees

This commit is contained in:
2026-10-09 03:39:12 +00:00
parent 528495c75a
commit ca1ba04676
3 changed files with 35 additions and 16 deletions

View File

@@ -0,0 +1,23 @@
package engine
import "testing"
func TestSecretPredicateReceivesDetachedHistoricalPath(t *testing.T) {
path := Keys("records").Key("1")
metadata := Metadata{history: map[string][]Change{
path.String(): {{Path: path}},
}}
seen := false
classified := classifySecretPaths(nil, func(candidate Path) bool {
if candidate.String() != path.String() {
return false
}
seen = true
candidate.segments[0].key = "changed"
return true
}, metadata, nil, nil)
if !seen || !classified[path.String()] || classified["/changed/1"] {
t.Fatalf("classification after predicate mutation = %#v, predicate called: %v", classified, seen)
}
}