Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: baby version of built-in semantic types (#14898)
Danny Xuc8b55f5f755a
diff --git a/backend/api/v1/query_result_masker.go b/backend/api/v1/query_result_masker.goindex 73a8de5140..49276145d2 100644--- a/backend/api/v1/query_result_masker.go+++ b/backend/api/v1/query_result_masker.go@@ -213,8 +213,12 @@ func (s *QueryResultMasker) getMaskerForColumnResource(if err != nil {return nil, errors.Wrapf(err, "failed to evaluate masking level of database %q, schema %q, table %q, column %q", sourceColumn.Database, sourceColumn.Schema, sourceColumn.Table, sourceColumn.Column)}- // TODO(d): hack about existing default-partial algorithm.- if semanticTypeID == "default-partial" {++ // Built-in algorithm.+ switch semanticTypeID {+ case "bb.default":+ return masker.NewDefaultFullMasker(), nil+ case "bb.default-partial":return masker.NewDefaultRangeMasker(), nil}diff --git a/backend/migrator/migration/prod/3.2/0006##global_rules.sql b/backend/migrator/migration/prod/3.2/0006##global_rules.sqlindex 19fac6a19e..4727da8ce6 100644--- a/backend/migrator/migration/prod/3.2/0006##global_rules.sql+++ b/backend/migrator/migration/prod/3.2/0006##global_rules.sql@@ -1,6 +1,6 @@UPDATE policy-SET payload = replace(payload::TEXT, '"maskingLevel": "FULL"', '"semanticType": "default"')::JSONB+SET payload = replace(payload::TEXT, '"maskingLevel": "FULL"', '"semanticType": "bb.default"')::JSONBWHERE type = 'bb.policy.masking-rule';UPDATE policy-SET payload = replace(payload::TEXT, '"maskingLevel": "PARTIAL"', '"semanticType": "default-partial"')::JSONB+SET payload = replace(payload::TEXT, '"maskingLevel": "PARTIAL"', '"semanticType": "bb.default-partial"')::JSONBWHERE type = 'bb.policy.masking-rule';\ No newline at end of filediff --git a/backend/migrator/migration/prod/3.2/0007##default_semantic.sql b/backend/migrator/migration/prod/3.2/0007##default_semantic.sqlindex 89f3fc0a60..c56eae33c7 100644--- a/backend/migrator/migration/prod/3.2/0007##default_semantic.sql+++ b/backend/migrator/migration/prod/3.2/0007##default_semantic.sql@@ -1,3 +1,3 @@UPDATE setting-SET value = jsonb_build_object('types', '[{"id":"default","title":"Default","description":"Default type with full masking","algorithm":{"id":"default","title":"Default","fullMask":{"substitution":"******"}}},{"id":"default-partial","title":"Default Partial","description":"Default partial type with partial masking","algorithm":{"id":"default-partial","title":"Default Partial"}}]'::jsonb || coalesce(value::jsonb->'types', '[]'::jsonb))+SET value = jsonb_build_object('types', '[{"id":"bb.default","title":"Default","description":"Default type with full masking"},{"id":"bb.default-partial","title":"Default Partial","description":"Default partial type with partial masking"}]'::jsonb || coalesce(value::jsonb->'types', '[]'::jsonb))WHERE name = 'bb.workspace.semantic-types';\ No newline at end of filediff --git a/backend/server/init.go b/backend/server/init.goindex bd8d07114c..46390f5f78 100644--- a/backend/server/init.go+++ b/backend/server/init.go@@ -337,14 +337,14 @@ func (s *Server) migrateCatalog(ctx context.Context) error {if col.GetFullMaskingAlgorithmId() != "" {col.SemanticType = col.GetFullMaskingAlgorithmId()} else {- col.SemanticType = "default"+ col.SemanticType = "bb.default"}updated = truecase storepb.MaskingLevel_PARTIAL:if col.GetPartialMaskingAlgorithmId() != "" {col.SemanticType = col.GetPartialMaskingAlgorithmId()} else {- col.SemanticType = "default-partial"+ col.SemanticType = "bb.default-partial"}updated = true}