maskJSONField masks a single field value based on its source field paths or direct schema lookup.
(key string, value any, fieldPaths map[string][]*parserbase.PathAST, objectSchema *storepb.ObjectSchema, semanticTypeToMasker map[string]masker.Masker)
| 289 | |
| 290 | // maskJSONField masks a single field value based on its source field paths or direct schema lookup. |
| 291 | func maskJSONField(key string, value any, fieldPaths map[string][]*parserbase.PathAST, objectSchema *storepb.ObjectSchema, semanticTypeToMasker map[string]masker.Masker) (any, error) { |
| 292 | if paths, ok := fieldPaths[key]; ok && len(paths) > 0 { |
| 293 | return maskFieldBySourcePaths(value, paths, objectSchema, semanticTypeToMasker) |
| 294 | } |
| 295 | return maskFieldByDirectLookup(key, value, objectSchema, semanticTypeToMasker) |
| 296 | } |
| 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) { |
no test coverage detected