Reuse parsed sensitivity paths

This commit is contained in:
2026-10-09 04:10:41 +00:00
parent 9323f89ad1
commit b37948cfea
4 changed files with 81 additions and 1 deletions

View File

@@ -83,6 +83,20 @@ func classifySecretPaths(schema *schemaDescriptor, predicate func(Path) bool, me
}
func addSecretPath(paths map[string]Path, pointer string) {
if existing, found := paths[pointer]; found && existing.valid() {
// Accumulator keys already match their paths' canonical spelling. History
// can install typed segments, which still need the parsed replacement.
parsed := true
for _, segment := range existing.segments {
if segment.kind != pathSegmentParsed {
parsed = false
break
}
}
if parsed {
return
}
}
if path, err := ParsePath(pointer); err == nil {
paths[pointer] = path
}