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

Function maskFieldBySourcePaths

backend/api/v1/document_masking.go:299–308  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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) {
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).
311func maskFieldByDirectLookup(key string, value any, objectSchema *storepb.ObjectSchema, semanticTypeToMasker map[string]masker.Masker) (any, error) {

Callers 1

maskJSONFieldFunction · 0.85

Calls 4

maskBySourcePathsFunction · 0.85
stripContainerFromPathFunction · 0.85
getObjectSchemaByPathFunction · 0.85
walkAndMaskJSONRecursiveFunction · 0.85

Tested by

no test coverage detected