maskFieldBySourcePaths checks all source paths for sensitivity, then falls back to recursive walk.
(value any, paths []*parserbase.PathAST, objectSchema *storepb.ObjectSchema, semanticTypeToMasker map[string]masker.Masker)
| 297 | |
| 298 | // maskFieldBySourcePaths checks all source paths for sensitivity, then falls back to recursive walk. |
| 299 | func maskFieldBySourcePaths(value any, paths []*parserbase.PathAST, objectSchema *storepb.ObjectSchema, semanticTypeToMasker map[string]masker.Masker) (any, error) { |
| 300 | if maskedValue, masked, err := maskBySourcePaths(value, paths, objectSchema, semanticTypeToMasker); err != nil { |
| 301 | return nil, err |
| 302 | } else if masked { |
| 303 | return maskedValue, nil |
| 304 | } |
| 305 | ast := stripContainerFromPath(paths[0]) |
| 306 | o, _ := getObjectSchemaByPath(objectSchema, ast) |
| 307 | return walkAndMaskJSONRecursive(value, o, semanticTypeToMasker) |
| 308 | } |
| 309 | |
| 310 | // maskFieldByDirectLookup looks up the key directly in the schema (used when no field paths are recorded). |
| 311 | func maskFieldByDirectLookup(key string, value any, objectSchema *storepb.ObjectSchema, semanticTypeToMasker map[string]masker.Masker) (any, error) { |
no test coverage detected