Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix: sanitize comments in diff metadata api (#8749)
boojacke073a16452ee
diff --git a/backend/api/v1/schema_design_service.go b/backend/api/v1/schema_design_service.goindex 3a7be76629..59d22d8ab0 100644--- a/backend/api/v1/schema_design_service.go+++ b/backend/api/v1/schema_design_service.go@@ -542,6 +542,9 @@ func (*SchemaDesignService) DiffMetadata(_ context.Context, request *v1pb.DiffMereturn nil, status.Errorf(codes.InvalidArgument, fmt.Sprintf("invalid target metadata: %v", err))}+ sanitizeCommentForSchemaMetadata(request.SourceMetadata)+ sanitizeCommentForSchemaMetadata(request.TargetMetadata)+sourceSchema, err := transformDatabaseMetadataToSchemaString(request.Engine, request.SourceMetadata)if err != nil {return nil, err@@ -742,22 +745,19 @@ func convertProtectionFromStore(protection *storepb.SheetPayload_SchemaDesign_Prfunc sanitizeSchemaDesignSchemaMetadata(design *v1pb.SchemaDesign) {if dbSchema := design.GetBaselineSchemaMetadata(); dbSchema != nil {- for _, schema := range dbSchema.Schemas {- for _, table := range schema.Tables {- table.Comment = common.GetCommentFromClassificationAndUserComment(table.Classification, table.UserComment)- for _, col := range table.Columns {- col.Comment = common.GetCommentFromClassificationAndUserComment(col.Classification, col.UserComment)- }- }- }+ sanitizeCommentForSchemaMetadata(dbSchema)}if dbSchema := design.GetSchemaMetadata(); dbSchema != nil {- for _, schema := range dbSchema.Schemas {- for _, table := range schema.Tables {- table.Comment = common.GetCommentFromClassificationAndUserComment(table.Classification, table.UserComment)- for _, col := range table.Columns {- col.Comment = common.GetCommentFromClassificationAndUserComment(col.Classification, col.UserComment)- }+ sanitizeCommentForSchemaMetadata(dbSchema)+ }+}++func sanitizeCommentForSchemaMetadata(dbSchema *v1pb.DatabaseMetadata) {+ for _, schema := range dbSchema.Schemas {+ for _, table := range schema.Tables {+ table.Comment = common.GetCommentFromClassificationAndUserComment(table.Classification, table.UserComment)+ for _, col := range table.Columns {+ col.Comment = common.GetCommentFromClassificationAndUserComment(col.Classification, col.UserComment)}}}