Preserve header sensitivity across colliding path shapes
This commit is contained in:
@@ -75,6 +75,19 @@ func classifySecretPathsWithEvidence(schema *schemaDescriptor, predicate func(Pa
|
||||
classifyProjection(tree)
|
||||
}
|
||||
classifyProjection(final)
|
||||
classifyPath := func(path Path) {
|
||||
if root, ok := schemaSecretRoot(schema, path); ok {
|
||||
secret[root.String()] = true
|
||||
}
|
||||
if predicate != nil && predicate(path.clone()) {
|
||||
secret[path.String()] = true
|
||||
}
|
||||
}
|
||||
for _, path := range paths {
|
||||
classifyPath(path)
|
||||
}
|
||||
// Classify each original evidence shape before folding results into pointer
|
||||
// sensitivity. Numeric mapping keys and sequence indices can share a pointer.
|
||||
for _, item := range evidence {
|
||||
if item == nil {
|
||||
continue
|
||||
@@ -83,25 +96,18 @@ func classifySecretPathsWithEvidence(schema *schemaDescriptor, predicate func(Pa
|
||||
if !candidate.valid() {
|
||||
candidate = item.path
|
||||
}
|
||||
addSecretEvidencePath(paths, item.destination, candidate)
|
||||
classifyPath(addSecretEvidencePath(paths, item.destination, candidate))
|
||||
for _, ancestor := range item.ancestors {
|
||||
addSecretEvidencePath(paths, item.destination, ancestor.path)
|
||||
}
|
||||
}
|
||||
for pointer, path := range paths {
|
||||
if root, ok := schemaSecretRoot(schema, path); ok {
|
||||
secret[root.String()] = true
|
||||
}
|
||||
if predicate != nil && predicate(path.clone()) {
|
||||
secret[pointer] = true
|
||||
classifyPath(addSecretEvidencePath(paths, item.destination, ancestor.path))
|
||||
}
|
||||
}
|
||||
return closeSecretDependencies(paths, secret, dependencies, inherited)
|
||||
}
|
||||
|
||||
func addSecretEvidencePath(paths map[string]Path, destination, local Path) {
|
||||
func addSecretEvidencePath(paths map[string]Path, destination, local Path) Path {
|
||||
path := appendDestination(destination, local)
|
||||
paths[path.String()] = path.clone()
|
||||
addSecretPath(paths, path.String())
|
||||
return path
|
||||
}
|
||||
|
||||
func addSecretPath(paths map[string]Path, pointer string) {
|
||||
|
||||
Reference in New Issue
Block a user