MCPcopy Create free account
hub / github.com/bytebase/bytebase / maskJSONField

Function maskJSONField

backend/api/v1/document_masking.go:291–296  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

289
290// maskJSONField masks a single field value based on its source field paths or direct schema lookup.
291func 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.
299func maskFieldBySourcePaths(value any, paths []*parserbase.PathAST, objectSchema *storepb.ObjectSchema, semanticTypeToMasker map[string]masker.Masker) (any, error) {

Callers 1

walkAndMaskJSONFunction · 0.85

Calls 2

maskFieldBySourcePathsFunction · 0.85
maskFieldByDirectLookupFunction · 0.85

Tested by

no test coverage detected