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: check slice overlap (#9274)
ecmadao19782ca15170
diff --git a/backend/api/v1/setting_service.go b/backend/api/v1/setting_service.goindex 84d3d735c3..4e2308ca20 100644--- a/backend/api/v1/setting_service.go+++ b/backend/api/v1/setting_service.go@@ -1111,9 +1111,21 @@ func validateMaskingAlgorithm(algorithm *v1pb.MaskingAlgorithmSetting_Algorithm)if algorithm.Mask == nil {return nil}- switch algorithm.Mask.(type) {+ switch m := algorithm.Mask.(type) {case *v1pb.MaskingAlgorithmSetting_Algorithm_FullMask_:case *v1pb.MaskingAlgorithmSetting_Algorithm_RangeMask_:+ for i, slice := range m.RangeMask.Slices {+ if slice.Start >= slice.End {+ return status.Errorf(codes.InvalidArgument, "the slice end must smaller than the start: [%d,%d)", slice.Start, slice.End)+ }+ for j := 0; j < i; j++ {+ pre := m.RangeMask.Slices[j]+ if slice.Start >= pre.End || pre.Start >= slice.End {+ continue+ }+ return status.Errorf(codes.InvalidArgument, "the slice range cannot overlap: [%d,%d) and [%d,%d)", pre.Start, pre.End, slice.Start, slice.End)+ }+ }default:return status.Errorf(codes.InvalidArgument, "mismatch masking algorithm category and mask type: %T, %s", algorithm.Mask, algorithm.Category)}diff --git a/frontend/src/components/SensitiveData/components/MaskingAlgorithmsCreateDrawer.vue b/frontend/src/components/SensitiveData/components/MaskingAlgorithmsCreateDrawer.vueindex 5ad7a8b850..58d857226b 100644--- a/frontend/src/components/SensitiveData/components/MaskingAlgorithmsCreateDrawer.vue+++ b/frontend/src/components/SensitiveData/components/MaskingAlgorithmsCreateDrawer.vue@@ -447,9 +447,9 @@ const onUpsert = async () => {style: "SUCCESS",title: t("common.updated"),});+ emit("dismiss");} finally {state.processing = false;- emit("dismiss");}};