Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

refactor: rename MaskingException to MaskingExemption (#18457)

Danny Xue05240aa4f81
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 911c9c30c8..e792d2b2ac 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -12554,29 +12554,29 @@ components:
title: LogoutRequest
additionalProperties: false
description: Request to logout current user session.
- bytebase.v1.MaskingExceptionPolicy:
+ bytebase.v1.MaskingExemptionPolicy:
type: object
properties:
- maskingExceptions:
+ exemptions:
type: array
items:
- $ref: '#/components/schemas/bytebase.v1.MaskingExceptionPolicy.MaskingException'
- title: masking_exceptions
- description: The list of masking exceptions.
- title: MaskingExceptionPolicy
+ $ref: '#/components/schemas/bytebase.v1.MaskingExemptionPolicy.Exemption'
+ title: exemptions
+ title: MaskingExemptionPolicy
additionalProperties: false
- description: MaskingExceptionPolicy is the allowlist of users who can access sensitive data.
- bytebase.v1.MaskingExceptionPolicy.MaskingException:
+ description: MaskingExemptionPolicy is the allowlist of users who can access sensitive data.
+ bytebase.v1.MaskingExemptionPolicy.Exemption:
type: object
properties:
- member:
- type: string
- title: member
+ members:
+ type: array
+ items:
+ type: string
+ title: members
description: |-
- Member is the principal who bind to this exception policy instance.
+ Members who bind to this exemption.
- - `user:{email}`: An email address that represents a specific Bytebase account. For example, `[email protected]`.
- - `group:{email}`: An email address for group.
+ Format: users/{email} or groups/{group email}
condition:
title: condition
description: |-
@@ -12597,9 +12597,8 @@ components:
resource.instance_id == "local" && resource.database_name == "employee" && request.time < timestamp("2025-04-30T11:10:39.000Z")
resource.instance_id == "local" && resource.database_name == "employee"
$ref: '#/components/schemas/google.type.Expr'
- title: MaskingException
+ title: Exemption
additionalProperties: false
- description: An exception allowing specific users to access masked data.
bytebase.v1.MaskingReason:
type: object
properties:
@@ -13511,12 +13510,12 @@ components:
required:
- dataSourceQueryPolicy
- properties:
- maskingExceptionPolicy:
- title: masking_exception_policy
- $ref: '#/components/schemas/bytebase.v1.MaskingExceptionPolicy'
- title: masking_exception_policy
+ maskingExemptionPolicy:
+ title: masking_exemption_policy
+ $ref: '#/components/schemas/bytebase.v1.MaskingExemptionPolicy'
+ title: masking_exemption_policy
required:
- - maskingExceptionPolicy
+ - maskingExemptionPolicy
- properties:
maskingRulePolicy:
title: masking_rule_policy
@@ -13575,7 +13574,7 @@ components:
- POLICY_TYPE_UNSPECIFIED
- ROLLOUT_POLICY
- MASKING_RULE
- - MASKING_EXCEPTION
+ - MASKING_EXEMPTION
- TAG
- DATA_SOURCE_QUERY
- DATA_QUERY
diff --git a/backend/api/v1/masking_evaluator.go b/backend/api/v1/masking_evaluator.go
index 64adee0db6..5b68497d9d 100644
--- a/backend/api/v1/masking_evaluator.go
+++ b/backend/api/v1/masking_evaluator.go
@@ -81,7 +81,7 @@ func (m *maskingLevelEvaluator) evaluateSemanticTypeOfColumn(
schemaName, tableName, columnName,
databaseProjectDataClassificationID string,
columnConfig *storepb.ColumnCatalog,
- filteredMaskingExceptions []*storepb.MaskingExceptionPolicy_MaskingException,
+ filteredMaskingExemptions []*storepb.MaskingExemptionPolicy_Exemption,
) (*MaskingEvaluation, error) {
eval, err := m.evaluateGlobalMaskingLevelOfColumn(databaseMessage, schemaName, tableName, columnName, databaseProjectDataClassificationID, columnConfig)
if err != nil {
@@ -113,7 +113,7 @@ func (m *maskingLevelEvaluator) evaluateSemanticTypeOfColumn(
}
if eval != nil && eval.SemanticTypeID != "" {
- pass, err := evaluateExceptionOfColumn(databaseMessage, schemaName, tableName, columnName, filteredMaskingExceptions)
+ pass, err := evaluateExemptionOfColumn(databaseMessage, schemaName, tableName, columnName, filteredMaskingExemptions)
if err != nil {
return nil, err
}
@@ -187,9 +187,9 @@ func (m *maskingLevelEvaluator) evaluateGlobalMaskingLevelOfColumn(
return nil, nil
}
-func evaluateExceptionOfColumn(databaseMessage *store.DatabaseMessage, schemaName, tableName, columnName string, filteredMaskingExceptions []*storepb.MaskingExceptionPolicy_MaskingException) (bool, error) {
- for _, filteredMaskingException := range filteredMaskingExceptions {
- maskingExceptionAttributes := map[string]any{
+func evaluateExemptionOfColumn(databaseMessage *store.DatabaseMessage, schemaName, tableName, columnName string, filteredMaskingExemptions []*storepb.MaskingExemptionPolicy_Exemption) (bool, error) {
+ for _, filteredMaskingExemption := range filteredMaskingExemptions {
+ maskingExemptionAttributes := map[string]any{
"resource": map[string]any{
"instance_id": databaseMessage.InstanceID,
"database_name": databaseMessage.DatabaseName,
@@ -201,9 +201,9 @@ func evaluateExceptionOfColumn(databaseMessage *store.DatabaseMessage, schemaNam
"time": time.Now(),
},
}
- pass, err := evaluateMaskingExceptionPolicyCondition(filteredMaskingException.Condition, maskingExceptionAttributes)
+ pass, err := evaluateMaskingExemptionPolicyCondition(filteredMaskingExemption.Condition, maskingExemptionAttributes)
if err != nil {
- return false, errors.Wrapf(err, "failed to evaluate masking exception policy condition")
+ return false, errors.Wrapf(err, "failed to evaluate masking exemption policy condition")
}
if pass {
return true, nil
@@ -228,37 +228,37 @@ func getClassificationLevelOfColumn(columnClassificationID string, classificatio
return *classification.LevelId
}
-func evaluateMaskingExceptionPolicyCondition(expression *expr.Expr, attributes map[string]any) (bool, error) {
+func evaluateMaskingExemptionPolicyCondition(expression *expr.Expr, attributes map[string]any) (bool, error) {
// nil expression means allow to access all databases
if expression == nil || expression.Expression == "" {
return true, nil
}
- maskingExceptionPolicyEnv, err := cel.NewEnv(
+ maskingExemptionPolicyEnv, err := cel.NewEnv(
cel.Variable("resource", cel.MapType(cel.StringType, cel.AnyType)),
cel.Variable("request", cel.MapType(cel.StringType, cel.AnyType)),
)
if err != nil {
- return false, errors.Wrapf(err, "failed to create CEL environment for masking exception policy")
+ return false, errors.Wrapf(err, "failed to create CEL environment for masking exemption policy")
}
- ast, issues := maskingExceptionPolicyEnv.Compile(expression.Expression)
+ ast, issues := maskingExemptionPolicyEnv.Compile(expression.Expression)
if issues != nil && issues.Err() != nil {
- return false, errors.Wrapf(issues.Err(), "failed to get the ast of CEL program for masking exception policy")
+ return false, errors.Wrapf(issues.Err(), "failed to get the ast of CEL program for masking exemption policy")
}
- prg, err := maskingExceptionPolicyEnv.Program(ast)
+ prg, err := maskingExemptionPolicyEnv.Program(ast)
if err != nil {
- return false, errors.Wrapf(err, "failed to create CEL program for masking exception policy")
+ return false, errors.Wrapf(err, "failed to create CEL program for masking exemption policy")
}
out, _, err := prg.Eval(attributes)
if err != nil {
- return false, errors.Wrapf(err, "failed to eval CEL program for masking exception policy")
+ return false, errors.Wrapf(err, "failed to eval CEL program for masking exemption policy")
}
val, err := out.ConvertToNative(reflect.TypeFor[bool]())
if err != nil {
- return false, errors.Wrap(err, "expect bool result for masking exception policy")
+ return false, errors.Wrap(err, "expect bool result for masking exemption policy")
}
boolVar, ok := val.(bool)
if !ok {
- return false, errors.Wrap(err, "expect bool result for masking exception policy")
+ return false, errors.Wrap(err, "expect bool result for masking exemption policy")
}
return boolVar, nil
}
diff --git a/backend/api/v1/masking_evaluator_test.go b/backend/api/v1/masking_evaluator_test.go
index bd9ab9f560..48f524f6b7 100644
--- a/backend/api/v1/masking_evaluator_test.go
+++ b/backend/api/v1/masking_evaluator_test.go
@@ -77,7 +77,7 @@ func TestEvalMaskingLevelOfColumn(t *testing.T) {
columnName string
columnCatalog *storepb.ColumnCatalog
maskingRulePolicy *storepb.MaskingRulePolicy
- filteredMaskingExceptions []*storepb.MaskingExceptionPolicy_MaskingException
+ filteredMaskingExemptions []*storepb.MaskingExemptionPolicy_Exemption
dataClassification *storepb.DataClassificationSetting
want string
@@ -103,7 +103,7 @@ func TestEvalMaskingLevelOfColumn(t *testing.T) {
},
},
},
- filteredMaskingExceptions: []*storepb.MaskingExceptionPolicy_MaskingException{},
+ filteredMaskingExemptions: []*storepb.MaskingExemptionPolicy_Exemption{},
dataClassification: defaultClassification,
databaseProjectDatabaseClassificationID: defaultProjectDatabaseDataClassificationID,
@@ -129,12 +129,12 @@ func TestEvalMaskingLevelOfColumn(t *testing.T) {
},
},
},
- filteredMaskingExceptions: []*storepb.MaskingExceptionPolicy_MaskingException{
+ filteredMaskingExemptions: []*storepb.MaskingExemptionPolicy_Exemption{
{
Condition: &expr.Expr{
Expression: `(resource.instance_id == "neon-host") && (resource.database_name == "bb") && (resource.schema_name == "hiring") && (resource.table_name == "employees") && (resource.column_name == "salary")`,
},
- Member: "users/1234",
+ Members: []string{"users/1234"},
},
},
dataClassification: defaultClassification,
@@ -164,7 +164,7 @@ func TestEvalMaskingLevelOfColumn(t *testing.T) {
for _, tc := range testCases {
m := newEmptyMaskingLevelEvaluator().withMaskingRulePolicy(tc.maskingRulePolicy).withDataClassificationSetting(tc.dataClassification).withSemanticTypeSetting(defaultSemanticType)
- result, err := m.evaluateSemanticTypeOfColumn(tc.databaseMessage, tc.schemaName, tc.tableName, tc.columnName, tc.databaseProjectDatabaseClassificationID, tc.columnCatalog, tc.filteredMaskingExceptions)
+ result, err := m.evaluateSemanticTypeOfColumn(tc.databaseMessage, tc.schemaName, tc.tableName, tc.columnName, tc.databaseProjectDatabaseClassificationID, tc.columnCatalog, tc.filteredMaskingExemptions)
a.NoError(err, tc.description)
if tc.want == "" {
a.Nil(result, tc.description)
diff --git a/backend/api/v1/org_policy_service.go b/backend/api/v1/org_policy_service.go
index 32b60bbfb1..94cb9b9a58 100644
--- a/backend/api/v1/org_policy_service.go
+++ b/backend/api/v1/org_policy_service.go
@@ -25,7 +25,7 @@ var (
storepb.Policy_TAG: {storepb.Policy_ENVIRONMENT, storepb.Policy_PROJECT},
storepb.Policy_QUERY_DATA: {storepb.Policy_WORKSPACE, storepb.Policy_ENVIRONMENT, storepb.Policy_PROJECT},
storepb.Policy_MASKING_RULE: {storepb.Policy_WORKSPACE},
- storepb.Policy_MASKING_EXCEPTION: {storepb.Policy_PROJECT},
+ storepb.Policy_MASKING_EXEMPTION: {storepb.Policy_PROJECT},
storepb.Policy_IAM: {storepb.Policy_WORKSPACE},
storepb.Policy_DATA_SOURCE_QUERY: {storepb.Policy_ENVIRONMENT, storepb.Policy_PROJECT},
}
@@ -172,7 +172,7 @@ func (s *OrgPolicyService) UpdatePolicy(ctx context.Context, req *connect.Reques
"rollout_policy",
"disable_copy_data_policy",
"masking_rule_policy",
- "masking_exception_policy",
+ "masking_exemption_policy",
"restrict_issue_creation_for_sql_review_policy",
"tag_policy",
"data_source_query_policy",
@@ -215,8 +215,8 @@ func pathMatchType(path string, policyType storepb.Policy_Type) bool {
return path == "rollout_policy"
case storepb.Policy_MASKING_RULE:
return path == "masking_rule_policy"
- case storepb.Policy_MASKING_EXCEPTION:
- return path == "masking_exception_policy"
+ case storepb.Policy_MASKING_EXEMPTION:
+ return path == "masking_exemption_policy"
case storepb.Policy_TAG:
return path == "tag_policy"
case storepb.Policy_DATA_SOURCE_QUERY:
@@ -424,20 +424,22 @@ func validatePolicyPayload(policyType storepb.Policy_Type, policy *v1pb.Policy)
return connect.NewError(connect.CodeInvalidArgument, errors.Wrap(err, "invalid masking rule expression"))
}
}
- case storepb.Policy_MASKING_EXCEPTION:
- maskingExceptionPolicy, ok := policy.Policy.(*v1pb.Policy_MaskingExceptionPolicy)
+ case storepb.Policy_MASKING_EXEMPTION:
+ maskingExemptionPolicy, ok := policy.Policy.(*v1pb.Policy_MaskingExemptionPolicy)
if !ok {
return connect.NewError(connect.CodeInvalidArgument, errors.Errorf("unmatched policy type %v and policy %v", policyType, policy.Policy))
}
- if maskingExceptionPolicy.MaskingExceptionPolicy == nil {
+ if maskingExemptionPolicy.MaskingExemptionPolicy == nil {
return connect.NewError(connect.CodeInvalidArgument, errors.New("masking exception policy must be set"))
}
- for _, exception := range maskingExceptionPolicy.MaskingExceptionPolicy.MaskingExceptions {
- if _, err := common.ValidateMaskingExceptionCELExpr(exception.Condition); err != nil {
- return connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid masking exception expression: %v", err))
+ for _, exemption := range maskingExemptionPolicy.MaskingExemptionPolicy.Exemptions {
+ if _, err := common.ValidateMaskingExemptionCELExpr(exemption.Condition); err != nil {
+ return connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid masking exemption expression: %v", err))
}
- if err := validateMember(exception.Member); err != nil {
- return err
+ for _, member := range exemption.Members {
+ if err := validateMember(member); err != nil {
+ return err
+ }
}
}
default:
@@ -489,17 +491,17 @@ func (s *OrgPolicyService) convertPolicyPayloadToString(ctx context.Context, pol
return "", errors.Wrap(err, "failed to marshal masking rule policy")
}
return string(payloadBytes), nil
- case v1pb.PolicyType_MASKING_EXCEPTION:
+ case v1pb.PolicyType_MASKING_EXEMPTION:
if err := s.licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_DATA_MASKING); err != nil {
return "", connect.NewError(connect.CodePermissionDenied, err)
}
- payload, err := s.convertToStorePBMaskingExceptionPolicyPayload(ctx, policy.GetMaskingExceptionPolicy())
+ payload, err := s.convertToStorePBMaskingExemptionPolicyPayload(ctx, policy.GetMaskingExemptionPolicy())
if err != nil {
return "", connect.NewError(connect.CodeInvalidArgument, err)
}
payloadBytes, err := protojson.Marshal(payload)
if err != nil {
- return "", errors.Wrap(err, "failed to marshal masking exception policy")
+ return "", errors.Wrap(err, "failed to marshal masking exemption policy")
}
return string(payloadBytes), nil
case v1pb.PolicyType_DATA_SOURCE_QUERY:
@@ -563,14 +565,14 @@ func (s *OrgPolicyService) convertToPolicy(ctx context.Context, policyMessage *s
policy.Policy = &v1pb.Policy_MaskingRulePolicy{
MaskingRulePolicy: payload,
}
- case storepb.Policy_MASKING_EXCEPTION:
- maskingRulePolicy := &storepb.MaskingExceptionPolicy{}
- if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(policyMessage.Payload), maskingRulePolicy); err != nil {
- return nil, errors.Wrap(err, "failed to unmarshal masking exception policy")
+ case storepb.Policy_MASKING_EXEMPTION:
+ maskingExemptionPolicy := &storepb.MaskingExemptionPolicy{}
+ if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(policyMessage.Payload), maskingExemptionPolicy); err != nil {
+ return nil, errors.Wrap(err, "failed to unmarshal masking exemption policy")
}
- payload := s.convertToV1PBMaskingExceptionPolicyPayload(ctx, maskingRulePolicy)
- policy.Policy = &v1pb.Policy_MaskingExceptionPolicy{
- MaskingExceptionPolicy: payload,
+ payload := s.convertToV1PBMaskingExemptionPolicyPayload(ctx, maskingExemptionPolicy)
+ policy.Policy = &v1pb.Policy_MaskingExemptionPolicy{
+ MaskingExemptionPolicy: payload,
}
case storepb.Policy_DATA_SOURCE_QUERY:
payload, err := convertToV1PBDataSourceQueryPolicy(policyMessage.Payload)
diff --git a/backend/api/v1/org_policy_service_converter.go b/backend/api/v1/org_policy_service_converter.go
index da5245df27..d2c172ec6a 100644
--- a/backend/api/v1/org_policy_service_converter.go
+++ b/backend/api/v1/org_policy_service_converter.go
@@ -248,50 +248,62 @@ func convertToV1PBMaskingRulePolicy(policy *storepb.MaskingRulePolicy) *v1pb.Mas
}
}
-func (s *OrgPolicyService) convertToStorePBMaskingExceptionPolicyPayload(ctx context.Context, policy *v1pb.MaskingExceptionPolicy) (*storepb.MaskingExceptionPolicy, error) {
- var exceptions []*storepb.MaskingExceptionPolicy_MaskingException
- for _, exception := range policy.MaskingExceptions {
- member, err := convertToStoreIamPolicyMember(ctx, s.store, exception.Member)
- if err != nil {
- return nil, err
+func (s *OrgPolicyService) convertToStorePBMaskingExemptionPolicyPayload(ctx context.Context, policy *v1pb.MaskingExemptionPolicy) (*storepb.MaskingExemptionPolicy, error) {
+ var exemptions []*storepb.MaskingExemptionPolicy_Exemption
+ for _, exemption := range policy.Exemptions {
+ var members []string
+ for _, v1Member := range exemption.Members {
+ member, err := convertToStoreIamPolicyMember(ctx, s.store, v1Member)
+ if err != nil {
+ return nil, err
+ }
+ members = append(members, member)
}
- exceptions = append(exceptions, &storepb.MaskingExceptionPolicy_MaskingException{
- Member: member,
+ exemptions = append(exemptions, &storepb.MaskingExemptionPolicy_Exemption{
+ Members: members,
Condition: &expr.Expr{
- Title: exception.Condition.Title,
- Expression: exception.Condition.Expression,
- Description: exception.Condition.Description,
- Location: exception.Condition.Location,
+ Title: exemption.Condition.Title,
+ Expression: exemption.Condition.Expression,
+ Description: exemption.Condition.Description,
+ Location: exemption.Condition.Location,
},
})
}
- return &storepb.MaskingExceptionPolicy{
- MaskingExceptions: exceptions,
+ return &storepb.MaskingExemptionPolicy{
+ Exemptions: exemptions,
}, nil
}
-func (s *OrgPolicyService) convertToV1PBMaskingExceptionPolicyPayload(ctx context.Context, policy *storepb.MaskingExceptionPolicy) *v1pb.MaskingExceptionPolicy {
- var exceptions []*v1pb.MaskingExceptionPolicy_MaskingException
- for _, exception := range policy.MaskingExceptions {
- memberInBinding := convertToV1MemberInBinding(ctx, s.store, exception.Member)
- if memberInBinding == "" {
+func (s *OrgPolicyService) convertToV1PBMaskingExemptionPolicyPayload(ctx context.Context, policy *storepb.MaskingExemptionPolicy) *v1pb.MaskingExemptionPolicy {
+ var exemptions []*v1pb.MaskingExemptionPolicy_Exemption
+ for _, exemption := range policy.Exemptions {
+ var members []string
+ for _, storeMember := range exemption.Members {
+ memberInBinding := convertToV1MemberInBinding(ctx, s.store, storeMember)
+ if memberInBinding == "" {
+ continue
+ }
+ members = append(members, memberInBinding)
+ }
+
+ if len(members) == 0 {
continue
}
- exceptions = append(exceptions, &v1pb.MaskingExceptionPolicy_MaskingException{
- Member: memberInBinding,
+ exemptions = append(exemptions, &v1pb.MaskingExemptionPolicy_Exemption{
+ Members: members,
Condition: &expr.Expr{
- Title: exception.Condition.Title,
- Expression: exception.Condition.Expression,
- Description: exception.Condition.Description,
- Location: exception.Condition.Location,
+ Title: exemption.Condition.Title,
+ Expression: exemption.Condition.Expression,
+ Description: exemption.Condition.Description,
+ Location: exemption.Condition.Location,
},
})
}
- return &v1pb.MaskingExceptionPolicy{
- MaskingExceptions: exceptions,
+ return &v1pb.MaskingExemptionPolicy{
+ Exemptions: exemptions,
}
}
@@ -326,8 +338,8 @@ func convertV1PBToStorePBPolicyType(pType v1pb.PolicyType) (storepb.Policy_Type,
return storepb.Policy_TAG, nil
case v1pb.PolicyType_MASKING_RULE:
return storepb.Policy_MASKING_RULE, nil
- case v1pb.PolicyType_MASKING_EXCEPTION:
- return storepb.Policy_MASKING_EXCEPTION, nil
+ case v1pb.PolicyType_MASKING_EXEMPTION:
+ return storepb.Policy_MASKING_EXEMPTION, nil
case v1pb.PolicyType_DATA_QUERY:
return storepb.Policy_QUERY_DATA, nil
case v1pb.PolicyType_DATA_SOURCE_QUERY:
@@ -345,8 +357,8 @@ func convertStorePBToV1PBPolicyType(pType storepb.Policy_Type) v1pb.PolicyType {
return v1pb.PolicyType_TAG
case storepb.Policy_MASKING_RULE:
return v1pb.PolicyType_MASKING_RULE
- case storepb.Policy_MASKING_EXCEPTION:
- return v1pb.PolicyType_MASKING_EXCEPTION
+ case storepb.Policy_MASKING_EXEMPTION:
+ return v1pb.PolicyType_MASKING_EXEMPTION
case storepb.Policy_QUERY_DATA:
return v1pb.PolicyType_DATA_QUERY
case storepb.Policy_DATA_SOURCE_QUERY:
diff --git a/backend/api/v1/predicate_columns_check.go b/backend/api/v1/predicate_columns_check.go
index 37a4d9f180..1e6462b28a 100644
--- a/backend/api/v1/predicate_columns_check.go
+++ b/backend/api/v1/predicate_columns_check.go
@@ -34,7 +34,7 @@ func (s *QueryResultMasker) ExtractSensitivePredicateColumns(ctx context.Context
withDataClassificationSetting(classificationSetting).
withSemanticTypeSetting(semanticTypesSetting)
- maskingExceptionPolicyMap := make(map[string]*storepb.MaskingExceptionPolicy)
+ maskingExemptionPolicyMap := make(map[string]*storepb.MaskingExemptionPolicy)
for _, span := range spans {
sensitiveColumns, err := s.getSensitiveColumnsForPredicate(
@@ -42,7 +42,7 @@ func (s *QueryResultMasker) ExtractSensitivePredicateColumns(ctx context.Context
m,
instance,
span.PredicateColumns,
- maskingExceptionPolicyMap,
+ maskingExemptionPolicyMap,
user,
)
if err != nil {
@@ -59,7 +59,7 @@ func (s *QueryResultMasker) getSensitiveColumnsForPredicate(
m *maskingLevelEvaluator,
instance *store.InstanceMessage,
predicateColumns base.SourceColumnSet,
- maskingExceptionPolicyMap map[string]*storepb.MaskingExceptionPolicy,
+ maskingExemptionPolicyMap map[string]*storepb.MaskingExemptionPolicy,
currentPrincipal *store.UserMessage,
) ([]base.ColumnResource, error) {
if instance != nil && !isPredicateColumnsCheckEnabled(instance.Metadata.GetEngine()) {
@@ -99,25 +99,28 @@ func (s *QueryResultMasker) getSensitiveColumnsForPredicate(
return nil, nil
}
- if _, ok := maskingExceptionPolicyMap[database.ProjectID]; !ok {
- policy, err := s.store.GetMaskingExceptionPolicyByProject(ctx, project.ResourceID)
+ if _, ok := maskingExemptionPolicyMap[database.ProjectID]; !ok {
+ policy, err := s.store.GetMaskingExemptionPolicyByProject(ctx, project.ResourceID)
if err != nil {
- return nil, errors.Wrapf(err, "failed to find masking exception policy for project %q", project.ResourceID)
+ return nil, errors.Wrapf(err, "failed to find masking exemption policy for project %q", project.ResourceID)
}
- maskingExceptionPolicyMap[database.ProjectID] = policy
+ maskingExemptionPolicyMap[database.ProjectID] = policy
}
- maskingExceptionPolicy := maskingExceptionPolicyMap[database.ProjectID]
-
- var maskingExceptionContainsCurrentPrincipal []*storepb.MaskingExceptionPolicy_MaskingException
- if maskingExceptionPolicy != nil {
- for _, maskingException := range maskingExceptionPolicy.MaskingExceptions {
- if utils.MemberContainsUser(ctx, s.store, maskingException.Member, currentPrincipal) {
- maskingExceptionContainsCurrentPrincipal = append(maskingExceptionContainsCurrentPrincipal, maskingException)
+ maskingExemptionPolicy := maskingExemptionPolicyMap[database.ProjectID]
+
+ var maskingExemptionContainsCurrentPrincipal []*storepb.MaskingExemptionPolicy_Exemption
+ if maskingExemptionPolicy != nil {
+ for _, maskingExemption := range maskingExemptionPolicy.Exemptions {
+ for _, member := range maskingExemption.Members {
+ if utils.MemberContainsUser(ctx, s.store, member, currentPrincipal) {
+ maskingExemptionContainsCurrentPrincipal = append(maskingExemptionContainsCurrentPrincipal, maskingExemption)
+ break
+ }
}
}
}
- isSensitive, err := m.isSensitiveColumn(database, column, project.DataClassificationConfigID, config, maskingExceptionContainsCurrentPrincipal)
+ isSensitive, err := m.isSensitiveColumn(database, column, project.DataClassificationConfigID, config, maskingExemptionContainsCurrentPrincipal)
if err != nil {
return nil, errors.Wrapf(err, "failed to check if column is sensitive")
}
@@ -129,7 +132,7 @@ func (s *QueryResultMasker) getSensitiveColumnsForPredicate(
return result, nil
}
-func (m *maskingLevelEvaluator) isSensitiveColumn(database *store.DatabaseMessage, column base.ColumnResource, classificationConfigID string, columnConfig *storepb.ColumnCatalog, exception []*storepb.MaskingExceptionPolicy_MaskingException) (bool, error) {
+func (m *maskingLevelEvaluator) isSensitiveColumn(database *store.DatabaseMessage, column base.ColumnResource, classificationConfigID string, columnConfig *storepb.ColumnCatalog, exception []*storepb.MaskingExemptionPolicy_Exemption) (bool, error) {
evaluation, err := m.evaluateSemanticTypeOfColumn(database, column.Schema, column.Table, column.Column, classificationConfigID, columnConfig, exception)
if err != nil {
return false, errors.Wrapf(err, "failed to evaluate semantic type of column")
diff --git a/backend/api/v1/query_result_masker.go b/backend/api/v1/query_result_masker.go
index e186db8184..d6a13048c9 100644
--- a/backend/api/v1/query_result_masker.go
+++ b/backend/api/v1/query_result_masker.go
@@ -131,8 +131,7 @@ func (s *QueryResultMasker) getMaskersForQuerySpan(ctx context.Context, m *maski
return nil, nil, errors.Wrapf(err, "failed to build semantic type to masker map")
}
// Multiple databases may belong to the same project, to reduce the protojson unmarshal cost,
- // we store the projectResourceID - maskingExceptionPolicy in a map.
- maskingExceptionPolicyMap := make(map[string]*storepb.MaskingExceptionPolicy)
+ maskingExemptionPolicyMap := make(map[string]*storepb.MaskingExemptionPolicy)
for _, spanResult := range span.Results {
// Likes constant expression, we use the none masker.
@@ -145,7 +144,7 @@ func (s *QueryResultMasker) getMaskersForQuerySpan(ctx context.Context, m *maski
var effectiveMaskers []masker.Masker
var effectiveReasons []*MaskingEvaluation
for column := range spanResult.SourceColumns {
- newMasker, reason, err := s.getMaskerForColumnResource(ctx, m, instance, column, maskingExceptionPolicyMap, user, semanticTypesToMasker)
+ newMasker, reason, err := s.getMaskerForColumnResource(ctx, m, instance, column, maskingExemptionPolicyMap, user, semanticTypesToMasker)
if err != nil {
return nil, nil, err
}
@@ -219,7 +218,7 @@ func (s *QueryResultMasker) getMaskerForColumnResource(
m *maskingLevelEvaluator,
instance *store.InstanceMessage,
sourceColumn parserbase.ColumnResource,
- maskingExceptionPolicyMap map[string]*storepb.MaskingExceptionPolicy,
+ maskingExemptionPolicyMap map[string]*storepb.MaskingExemptionPolicy,
currentPrincipal *store.UserMessage,
semanticTypeToMasker map[string]masker.Masker,
) (masker.Masker, *MaskingEvaluation, error) {
@@ -256,30 +255,33 @@ func (s *QueryResultMasker) getMaskerForColumnResource(
return masker.NewNoneMasker(), nil, nil
}
- var maskingExceptionPolicy *storepb.MaskingExceptionPolicy
- // If we cannot find the maskingExceptionPolicy before, we need to find it from the database and record it in cache.
+ var maskingExemptionPolicy *storepb.MaskingExemptionPolicy
+ // If we cannot find the maskingExemptionPolicy before, we need to find it from the database and record it in cache.
- if _, ok := maskingExceptionPolicyMap[database.ProjectID]; !ok {
- policy, err := s.store.GetMaskingExceptionPolicyByProject(ctx, project.ResourceID)
+ if _, ok := maskingExemptionPolicyMap[database.ProjectID]; !ok {
+ policy, err := s.store.GetMaskingExemptionPolicyByProject(ctx, project.ResourceID)
if err != nil {
- return nil, nil, errors.Wrapf(err, "failed to find masking exception policy for project %q", project.ResourceID)
+ return nil, nil, errors.Wrapf(err, "failed to find masking exemption policy for project %q", project.ResourceID)
}
// It is safe if policy is nil.
- maskingExceptionPolicyMap[database.ProjectID] = policy
- }
- maskingExceptionPolicy = maskingExceptionPolicyMap[database.ProjectID]
-
- // Build the filtered maskingExceptionPolicy for current principal.
- var maskingExceptionContainsCurrentPrincipal []*storepb.MaskingExceptionPolicy_MaskingException
- if maskingExceptionPolicy != nil {
- for _, maskingException := range maskingExceptionPolicy.MaskingExceptions {
- if utils.MemberContainsUser(ctx, s.store, maskingException.Member, currentPrincipal) {
- maskingExceptionContainsCurrentPrincipal = append(maskingExceptionContainsCurrentPrincipal, maskingException)
+ maskingExemptionPolicyMap[database.ProjectID] = policy
+ }
+ maskingExemptionPolicy = maskingExemptionPolicyMap[database.ProjectID]
+
+ // Build the filtered maskingExemptionPolicy for current principal.
+ var maskingExemptionContainsCurrentPrincipal []*storepb.MaskingExemptionPolicy_Exemption
+ if maskingExemptionPolicy != nil {
+ for _, maskingExemption := range maskingExemptionPolicy.Exemptions {
+ for _, member := range maskingExemption.Members {
+ if utils.MemberContainsUser(ctx, s.store, member, currentPrincipal) {
+ maskingExemptionContainsCurrentPrincipal = append(maskingExemptionContainsCurrentPrincipal, maskingExemption)
+ break
+ }
}
}
}
- evaluation, err := m.evaluateSemanticTypeOfColumn(database, sourceColumn.Schema, sourceColumn.Table, sourceColumn.Column, project.DataClassificationConfigID, config, maskingExceptionContainsCurrentPrincipal)
+ evaluation, err := m.evaluateSemanticTypeOfColumn(database, sourceColumn.Schema, sourceColumn.Table, sourceColumn.Column, project.DataClassificationConfigID, config, maskingExemptionContainsCurrentPrincipal)
if err != nil {
return nil, 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)
}
diff --git a/backend/common/cel.go b/backend/common/cel.go
index 98e61081ec..87cc936fe9 100644
--- a/backend/common/cel.go
+++ b/backend/common/cel.go
@@ -91,8 +91,8 @@ var MaskingRulePolicyCELAttributes = []cel.EnvOption{
cel.ParserExpressionSizeLimit(celLimit),
}
-// MaskingExceptionPolicyCELAttributes are the variables when evaluating masking exception.
-var MaskingExceptionPolicyCELAttributes = []cel.EnvOption{
+// MaskingExemptionPolicyCELAttributes are the variables when evaluating masking exemption.
+var MaskingExemptionPolicyCELAttributes = []cel.EnvOption{
cel.Variable(CELAttributeResourceInstanceID, cel.StringType),
cel.Variable(CELAttributeResourceDatabaseName, cel.StringType),
cel.Variable(CELAttributeResourceTableName, cel.StringType),
@@ -168,9 +168,9 @@ func ValidateMaskingRuleCELExpr(expr string) (cel.Program, error) {
return prog, nil
}
-// ValidateMaskingExceptionCELExpr validates masking exception expr.
-func ValidateMaskingExceptionCELExpr(expression *expr.Expr) (cel.Program, error) {
- return validateCELExpr(expression, MaskingExceptionPolicyCELAttributes)
+// ValidateMaskingExemptionCELExpr validates masking exemption expr.
+func ValidateMaskingExemptionCELExpr(expression *expr.Expr) (cel.Program, error) {
+ return validateCELExpr(expression, MaskingExemptionPolicyCELAttributes)
}
func ValidateProjectMemberCELExpr(expression *expr.Expr) (cel.Program, error) {
diff --git a/backend/generated-go/store/policy.pb.go b/backend/generated-go/store/policy.pb.go
index 8d149246d2..1d92a2d270 100644
--- a/backend/generated-go/store/policy.pb.go
+++ b/backend/generated-go/store/policy.pb.go
@@ -28,7 +28,7 @@ type Policy_Type int32
const (
Policy_TYPE_UNSPECIFIED Policy_Type = 0
Policy_ROLLOUT Policy_Type = 1
- Policy_MASKING_EXCEPTION Policy_Type = 2
+ Policy_MASKING_EXEMPTION Policy_Type = 2
Policy_QUERY_DATA Policy_Type = 5
Policy_MASKING_RULE Policy_Type = 6
Policy_IAM Policy_Type = 8
@@ -41,7 +41,7 @@ var (
Policy_Type_name = map[int32]string{
0: "TYPE_UNSPECIFIED",
1: "ROLLOUT",
- 2: "MASKING_EXCEPTION",
+ 2: "MASKING_EXEMPTION",
5: "QUERY_DATA",
6: "MASKING_RULE",
8: "IAM",
@@ -51,7 +51,7 @@ var (
Policy_Type_value = map[string]int32{
"TYPE_UNSPECIFIED": 0,
"ROLLOUT": 1,
- "MASKING_EXCEPTION": 2,
+ "MASKING_EXEMPTION": 2,
"QUERY_DATA": 5,
"MASKING_RULE": 6,
"IAM": 8,
@@ -327,28 +327,28 @@ func (x *RolloutPolicy) GetRoles() []string {
return nil
}
-// MaskingExceptionPolicy is the allowlist of users who can access sensitive data.
-type MaskingExceptionPolicy struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- MaskingExceptions []*MaskingExceptionPolicy_MaskingException `protobuf:"bytes,1,rep,name=masking_exceptions,json=maskingExceptions,proto3" json:"masking_exceptions,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+// MaskingExemptionPolicy is the allowlist of users who can access sensitive data.
+type MaskingExemptionPolicy struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Exemptions []*MaskingExemptionPolicy_Exemption `protobuf:"bytes,1,rep,name=exemptions,proto3" json:"exemptions,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
-func (x *MaskingExceptionPolicy) Reset() {
- *x = MaskingExceptionPolicy{}
+func (x *MaskingExemptionPolicy) Reset() {
+ *x = MaskingExemptionPolicy{}
mi := &file_store_policy_proto_msgTypes[2]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *MaskingExceptionPolicy) String() string {
+func (x *MaskingExemptionPolicy) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*MaskingExceptionPolicy) ProtoMessage() {}
+func (*MaskingExemptionPolicy) ProtoMessage() {}
-func (x *MaskingExceptionPolicy) ProtoReflect() protoreflect.Message {
+func (x *MaskingExemptionPolicy) ProtoReflect() protoreflect.Message {
mi := &file_store_policy_proto_msgTypes[2]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -360,14 +360,14 @@ func (x *MaskingExceptionPolicy) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use MaskingExceptionPolicy.ProtoReflect.Descriptor instead.
-func (*MaskingExceptionPolicy) Descriptor() ([]byte, []int) {
+// Deprecated: Use MaskingExemptionPolicy.ProtoReflect.Descriptor instead.
+func (*MaskingExemptionPolicy) Descriptor() ([]byte, []int) {
return file_store_policy_proto_rawDescGZIP(), []int{2}
}
-func (x *MaskingExceptionPolicy) GetMaskingExceptions() []*MaskingExceptionPolicy_MaskingException {
+func (x *MaskingExemptionPolicy) GetExemptions() []*MaskingExemptionPolicy_Exemption {
if x != nil {
- return x.MaskingExceptions
+ return x.Exemptions
}
return nil
}
@@ -776,32 +776,47 @@ func (x *DataSourceQueryPolicy) GetDisallowDml() bool {
return false
}
-type MaskingExceptionPolicy_MaskingException struct {
+type MaskingExemptionPolicy_Exemption struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // Member is the principal who binds to this exception policy instance.
+ // Members who bind to this exemption.
//
// Format: users/{email} or groups/{group email}
- Member string `protobuf:"bytes,4,opt,name=member,proto3" json:"member,omitempty"`
+ Members []string `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty"`
// The condition that is associated with this exception policy instance.
- Condition *expr.Expr `protobuf:"bytes,5,opt,name=condition,proto3" json:"condition,omitempty"`
+ // The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+ // If the condition is empty, means the user can access all databases without expiration.
+ //
+ // Support variables:
+ // resource.instance_id: the instance resource id. Only support "==" operation.
+ // resource.database_name: the database name. Only support "==" operation.
+ // resource.schema_name: the schema name. Only support "==" operation.
+ // resource.table_name: the table name. Only support "==" operation.
+ // resource.column_name: the column name. Only support "==" operation.
+ // request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`
+ // All variables should join with "&&" condition.
+ //
+ // For example:
+ // resource.instance_id == "local" && resource.database_name == "employee" && request.time < timestamp("2025-04-30T11:10:39.000Z")
+ // resource.instance_id == "local" && resource.database_name == "employee"
+ Condition *expr.Expr `protobuf:"bytes,2,opt,name=condition,proto3" json:"condition,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
-func (x *MaskingExceptionPolicy_MaskingException) Reset() {
- *x = MaskingExceptionPolicy_MaskingException{}
+func (x *MaskingExemptionPolicy_Exemption) Reset() {
+ *x = MaskingExemptionPolicy_Exemption{}
mi := &file_store_policy_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *MaskingExceptionPolicy_MaskingException) String() string {
+func (x *MaskingExemptionPolicy_Exemption) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*MaskingExceptionPolicy_MaskingException) ProtoMessage() {}
+func (*MaskingExemptionPolicy_Exemption) ProtoMessage() {}
-func (x *MaskingExceptionPolicy_MaskingException) ProtoReflect() protoreflect.Message {
+func (x *MaskingExemptionPolicy_Exemption) ProtoReflect() protoreflect.Message {
mi := &file_store_policy_proto_msgTypes[10]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -813,19 +828,19 @@ func (x *MaskingExceptionPolicy_MaskingException) ProtoReflect() protoreflect.Me
return mi.MessageOf(x)
}
-// Deprecated: Use MaskingExceptionPolicy_MaskingException.ProtoReflect.Descriptor instead.
-func (*MaskingExceptionPolicy_MaskingException) Descriptor() ([]byte, []int) {
+// Deprecated: Use MaskingExemptionPolicy_Exemption.ProtoReflect.Descriptor instead.
+func (*MaskingExemptionPolicy_Exemption) Descriptor() ([]byte, []int) {
return file_store_policy_proto_rawDescGZIP(), []int{2, 0}
}
-func (x *MaskingExceptionPolicy_MaskingException) GetMember() string {
+func (x *MaskingExemptionPolicy_Exemption) GetMembers() []string {
if x != nil {
- return x.Member
+ return x.Members
}
- return ""
+ return nil
}
-func (x *MaskingExceptionPolicy_MaskingException) GetCondition() *expr.Expr {
+func (x *MaskingExemptionPolicy_Exemption) GetCondition() *expr.Expr {
if x != nil {
return x.Condition
}
@@ -902,7 +917,7 @@ const file_store_policy_proto_rawDesc = "" +
"\x04Type\x12\x14\n" +
"\x10TYPE_UNSPECIFIED\x10\x00\x12\v\n" +
"\aROLLOUT\x10\x01\x12\x15\n" +
- "\x11MASKING_EXCEPTION\x10\x02\x12\x0e\n" +
+ "\x11MASKING_EXEMPTION\x10\x02\x12\x0e\n" +
"\n" +
"QUERY_DATA\x10\x05\x12\x10\n" +
"\fMASKING_RULE\x10\x06\x12\a\n" +
@@ -917,12 +932,14 @@ const file_store_policy_proto_rawDesc = "" +
"\aPROJECT\x10\x03\"C\n" +
"\rRolloutPolicy\x12\x1c\n" +
"\tautomatic\x18\x01 \x01(\bR\tautomatic\x12\x14\n" +
- "\x05roles\x18\x02 \x03(\tR\x05roles\"\xdd\x01\n" +
- "\x16MaskingExceptionPolicy\x12f\n" +
- "\x12masking_exceptions\x18\x01 \x03(\v27.bytebase.store.MaskingExceptionPolicy.MaskingExceptionR\x11maskingExceptions\x1a[\n" +
- "\x10MaskingException\x12\x16\n" +
- "\x06member\x18\x04 \x01(\tR\x06member\x12/\n" +
- "\tcondition\x18\x05 \x01(\v2\x11.google.type.ExprR\tcondition\"\xcd\x01\n" +
+ "\x05roles\x18\x02 \x03(\tR\x05roles\"\xc2\x01\n" +
+ "\x16MaskingExemptionPolicy\x12P\n" +
+ "\n" +
+ "exemptions\x18\x01 \x03(\v20.bytebase.store.MaskingExemptionPolicy.ExemptionR\n" +
+ "exemptions\x1aV\n" +
+ "\tExemption\x12\x18\n" +
+ "\amembers\x18\x01 \x03(\tR\amembers\x12/\n" +
+ "\tcondition\x18\x02 \x01(\v2\x11.google.type.ExprR\tcondition\"\xcd\x01\n" +
"\x11MaskingRulePolicy\x12C\n" +
"\x05rules\x18\x01 \x03(\v2-.bytebase.store.MaskingRulePolicy.MaskingRuleR\x05rules\x1as\n" +
"\vMaskingRule\x12\x0e\n" +
@@ -978,28 +995,28 @@ func file_store_policy_proto_rawDescGZIP() []byte {
var file_store_policy_proto_enumTypes = make([]protoimpl.EnumInfo, 4)
var file_store_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_store_policy_proto_goTypes = []any{
- (Policy_Type)(0), // 0: bytebase.store.Policy.Type
- (Policy_Resource)(0), // 1: bytebase.store.Policy.Resource
- (EnvironmentTierPolicy_EnvironmentTier)(0), // 2: bytebase.store.EnvironmentTierPolicy.EnvironmentTier
- (DataSourceQueryPolicy_Restriction)(0), // 3: bytebase.store.DataSourceQueryPolicy.Restriction
- (*Policy)(nil), // 4: bytebase.store.Policy
- (*RolloutPolicy)(nil), // 5: bytebase.store.RolloutPolicy
- (*MaskingExceptionPolicy)(nil), // 6: bytebase.store.MaskingExceptionPolicy
- (*MaskingRulePolicy)(nil), // 7: bytebase.store.MaskingRulePolicy
- (*TagPolicy)(nil), // 8: bytebase.store.TagPolicy
- (*Binding)(nil), // 9: bytebase.store.Binding
- (*IamPolicy)(nil), // 10: bytebase.store.IamPolicy
- (*EnvironmentTierPolicy)(nil), // 11: bytebase.store.EnvironmentTierPolicy
- (*QueryDataPolicy)(nil), // 12: bytebase.store.QueryDataPolicy
- (*DataSourceQueryPolicy)(nil), // 13: bytebase.store.DataSourceQueryPolicy
- (*MaskingExceptionPolicy_MaskingException)(nil), // 14: bytebase.store.MaskingExceptionPolicy.MaskingException
- (*MaskingRulePolicy_MaskingRule)(nil), // 15: bytebase.store.MaskingRulePolicy.MaskingRule
- nil, // 16: bytebase.store.TagPolicy.TagsEntry
- (*expr.Expr)(nil), // 17: google.type.Expr
- (*durationpb.Duration)(nil), // 18: google.protobuf.Duration
+ (Policy_Type)(0), // 0: bytebase.store.Policy.Type
+ (Policy_Resource)(0), // 1: bytebase.store.Policy.Resource
+ (EnvironmentTierPolicy_EnvironmentTier)(0), // 2: bytebase.store.EnvironmentTierPolicy.EnvironmentTier
+ (DataSourceQueryPolicy_Restriction)(0), // 3: bytebase.store.DataSourceQueryPolicy.Restriction
+ (*Policy)(nil), // 4: bytebase.store.Policy
+ (*RolloutPolicy)(nil), // 5: bytebase.store.RolloutPolicy
+ (*MaskingExemptionPolicy)(nil), // 6: bytebase.store.MaskingExemptionPolicy
+ (*MaskingRulePolicy)(nil), // 7: bytebase.store.MaskingRulePolicy
+ (*TagPolicy)(nil), // 8: bytebase.store.TagPolicy
+ (*Binding)(nil), // 9: bytebase.store.Binding
+ (*IamPolicy)(nil), // 10: bytebase.store.IamPolicy
+ (*EnvironmentTierPolicy)(nil), // 11: bytebase.store.EnvironmentTierPolicy
+ (*QueryDataPolicy)(nil), // 12: bytebase.store.QueryDataPolicy
+ (*DataSourceQueryPolicy)(nil), // 13: bytebase.store.DataSourceQueryPolicy
+ (*MaskingExemptionPolicy_Exemption)(nil), // 14: bytebase.store.MaskingExemptionPolicy.Exemption
+ (*MaskingRulePolicy_MaskingRule)(nil), // 15: bytebase.store.MaskingRulePolicy.MaskingRule
+ nil, // 16: bytebase.store.TagPolicy.TagsEntry
+ (*expr.Expr)(nil), // 17: google.type.Expr
+ (*durationpb.Duration)(nil), // 18: google.protobuf.Duration
}
var file_store_policy_proto_depIdxs = []int32{
- 14, // 0: bytebase.store.MaskingExceptionPolicy.masking_exceptions:type_name -> bytebase.store.MaskingExceptionPolicy.MaskingException
+ 14, // 0: bytebase.store.MaskingExemptionPolicy.exemptions:type_name -> bytebase.store.MaskingExemptionPolicy.Exemption
15, // 1: bytebase.store.MaskingRulePolicy.rules:type_name -> bytebase.store.MaskingRulePolicy.MaskingRule
16, // 2: bytebase.store.TagPolicy.tags:type_name -> bytebase.store.TagPolicy.TagsEntry
17, // 3: bytebase.store.Binding.condition:type_name -> google.type.Expr
@@ -1007,7 +1024,7 @@ var file_store_policy_proto_depIdxs = []int32{
2, // 5: bytebase.store.EnvironmentTierPolicy.environment_tier:type_name -> bytebase.store.EnvironmentTierPolicy.EnvironmentTier
18, // 6: bytebase.store.QueryDataPolicy.timeout:type_name -> google.protobuf.Duration
3, // 7: bytebase.store.DataSourceQueryPolicy.admin_data_source_restriction:type_name -> bytebase.store.DataSourceQueryPolicy.Restriction
- 17, // 8: bytebase.store.MaskingExceptionPolicy.MaskingException.condition:type_name -> google.type.Expr
+ 17, // 8: bytebase.store.MaskingExemptionPolicy.Exemption.condition:type_name -> google.type.Expr
17, // 9: bytebase.store.MaskingRulePolicy.MaskingRule.condition:type_name -> google.type.Expr
10, // [10:10] is the sub-list for method output_type
10, // [10:10] is the sub-list for method input_type
diff --git a/backend/generated-go/store/policy_equal.pb.go b/backend/generated-go/store/policy_equal.pb.go
index 612ed34bb1..cf97f4a837 100644
--- a/backend/generated-go/store/policy_equal.pb.go
+++ b/backend/generated-go/store/policy_equal.pb.go
@@ -39,16 +39,21 @@ func (x *RolloutPolicy) Equal(y *RolloutPolicy) bool {
return true
}
-func (x *MaskingExceptionPolicy_MaskingException) Equal(y *MaskingExceptionPolicy_MaskingException) bool {
+func (x *MaskingExemptionPolicy_Exemption) Equal(y *MaskingExemptionPolicy_Exemption) bool {
if x == y {
return true
}
if x == nil || y == nil {
return x == nil && y == nil
}
- if x.Member != y.Member {
+ if len(x.Members) != len(y.Members) {
return false
}
+ for i := 0; i < len(x.Members); i++ {
+ if x.Members[i] != y.Members[i] {
+ return false
+ }
+ }
if equal, ok := interface{}(x.Condition).(interface{ Equal(*expr.Expr) bool }); !ok || !equal.Equal(y.Condition) {
return false
} else if !proto.Equal(x.Condition, y.Condition) {
@@ -57,18 +62,18 @@ func (x *MaskingExceptionPolicy_MaskingException) Equal(y *MaskingExceptionPolic
return true
}
-func (x *MaskingExceptionPolicy) Equal(y *MaskingExceptionPolicy) bool {
+func (x *MaskingExemptionPolicy) Equal(y *MaskingExemptionPolicy) bool {
if x == y {
return true
}
if x == nil || y == nil {
return x == nil && y == nil
}
- if len(x.MaskingExceptions) != len(y.MaskingExceptions) {
+ if len(x.Exemptions) != len(y.Exemptions) {
return false
}
- for i := 0; i < len(x.MaskingExceptions); i++ {
- if !x.MaskingExceptions[i].Equal(y.MaskingExceptions[i]) {
+ for i := 0; i < len(x.Exemptions); i++ {
+ if !x.Exemptions[i].Equal(y.Exemptions[i]) {
return false
}
}
diff --git a/backend/generated-go/v1/org_policy_service.pb.go b/backend/generated-go/v1/org_policy_service.pb.go
index 7d2b757630..48e4814df4 100644
--- a/backend/generated-go/v1/org_policy_service.pb.go
+++ b/backend/generated-go/v1/org_policy_service.pb.go
@@ -36,8 +36,8 @@ const (
PolicyType_ROLLOUT_POLICY PolicyType = 11
// Data masking rule policy.
PolicyType_MASKING_RULE PolicyType = 9
- // Data masking exception policy.
- PolicyType_MASKING_EXCEPTION PolicyType = 10
+ // Data masking exemption policy.
+ PolicyType_MASKING_EXEMPTION PolicyType = 10
// Resource tag policy.
PolicyType_TAG PolicyType = 13
// Data source query restrictions policy.
@@ -52,7 +52,7 @@ var (
0: "POLICY_TYPE_UNSPECIFIED",
11: "ROLLOUT_POLICY",
9: "MASKING_RULE",
- 10: "MASKING_EXCEPTION",
+ 10: "MASKING_EXEMPTION",
13: "TAG",
14: "DATA_SOURCE_QUERY",
16: "DATA_QUERY",
@@ -61,7 +61,7 @@ var (
"POLICY_TYPE_UNSPECIFIED": 0,
"ROLLOUT_POLICY": 11,
"MASKING_RULE": 9,
- "MASKING_EXCEPTION": 10,
+ "MASKING_EXEMPTION": 10,
"TAG": 13,
"DATA_SOURCE_QUERY": 14,
"DATA_QUERY": 16,
@@ -619,7 +619,7 @@ type Policy struct {
//
// *Policy_RolloutPolicy
// *Policy_MaskingRulePolicy
- // *Policy_MaskingExceptionPolicy
+ // *Policy_MaskingExemptionPolicy
// *Policy_TagPolicy
// *Policy_DataSourceQueryPolicy
// *Policy_QueryDataPolicy
@@ -708,10 +708,10 @@ func (x *Policy) GetMaskingRulePolicy() *MaskingRulePolicy {
return nil
}
-func (x *Policy) GetMaskingExceptionPolicy() *MaskingExceptionPolicy {
+func (x *Policy) GetMaskingExemptionPolicy() *MaskingExemptionPolicy {
if x != nil {
- if x, ok := x.Policy.(*Policy_MaskingExceptionPolicy); ok {
- return x.MaskingExceptionPolicy
+ if x, ok := x.Policy.(*Policy_MaskingExemptionPolicy); ok {
+ return x.MaskingExemptionPolicy
}
}
return nil
@@ -770,8 +770,8 @@ type Policy_MaskingRulePolicy struct {
MaskingRulePolicy *MaskingRulePolicy `protobuf:"bytes,17,opt,name=masking_rule_policy,json=maskingRulePolicy,proto3,oneof"`
}
-type Policy_MaskingExceptionPolicy struct {
- MaskingExceptionPolicy *MaskingExceptionPolicy `protobuf:"bytes,18,opt,name=masking_exception_policy,json=maskingExceptionPolicy,proto3,oneof"`
+type Policy_MaskingExemptionPolicy struct {
+ MaskingExemptionPolicy *MaskingExemptionPolicy `protobuf:"bytes,18,opt,name=masking_exemption_policy,json=maskingExemptionPolicy,proto3,oneof"`
}
type Policy_TagPolicy struct {
@@ -790,7 +790,7 @@ func (*Policy_RolloutPolicy) isPolicy_Policy() {}
func (*Policy_MaskingRulePolicy) isPolicy_Policy() {}
-func (*Policy_MaskingExceptionPolicy) isPolicy_Policy() {}
+func (*Policy_MaskingExemptionPolicy) isPolicy_Policy() {}
func (*Policy_TagPolicy) isPolicy_Policy() {}
@@ -947,29 +947,28 @@ func (x *QueryDataPolicy) GetDisableCopyData() bool {
return false
}
-// MaskingExceptionPolicy is the allowlist of users who can access sensitive data.
-type MaskingExceptionPolicy struct {
- state protoimpl.MessageState `protogen:"open.v1"`
- // The list of masking exceptions.
- MaskingExceptions []*MaskingExceptionPolicy_MaskingException `protobuf:"bytes,1,rep,name=masking_exceptions,json=maskingExceptions,proto3" json:"masking_exceptions,omitempty"`
- unknownFields protoimpl.UnknownFields
- sizeCache protoimpl.SizeCache
+// MaskingExemptionPolicy is the allowlist of users who can access sensitive data.
+type MaskingExemptionPolicy struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ Exemptions []*MaskingExemptionPolicy_Exemption `protobuf:"bytes,1,rep,name=exemptions,proto3" json:"exemptions,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
}
-func (x *MaskingExceptionPolicy) Reset() {
- *x = MaskingExceptionPolicy{}
+func (x *MaskingExemptionPolicy) Reset() {
+ *x = MaskingExemptionPolicy{}
mi := &file_v1_org_policy_service_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *MaskingExceptionPolicy) String() string {
+func (x *MaskingExemptionPolicy) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*MaskingExceptionPolicy) ProtoMessage() {}
+func (*MaskingExemptionPolicy) ProtoMessage() {}
-func (x *MaskingExceptionPolicy) ProtoReflect() protoreflect.Message {
+func (x *MaskingExemptionPolicy) ProtoReflect() protoreflect.Message {
mi := &file_v1_org_policy_service_proto_msgTypes[9]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -981,14 +980,14 @@ func (x *MaskingExceptionPolicy) ProtoReflect() protoreflect.Message {
return mi.MessageOf(x)
}
-// Deprecated: Use MaskingExceptionPolicy.ProtoReflect.Descriptor instead.
-func (*MaskingExceptionPolicy) Descriptor() ([]byte, []int) {
+// Deprecated: Use MaskingExemptionPolicy.ProtoReflect.Descriptor instead.
+func (*MaskingExemptionPolicy) Descriptor() ([]byte, []int) {
return file_v1_org_policy_service_proto_rawDescGZIP(), []int{9}
}
-func (x *MaskingExceptionPolicy) GetMaskingExceptions() []*MaskingExceptionPolicy_MaskingException {
+func (x *MaskingExemptionPolicy) GetExemptions() []*MaskingExemptionPolicy_Exemption {
if x != nil {
- return x.MaskingExceptions
+ return x.Exemptions
}
return nil
}
@@ -1249,14 +1248,12 @@ func (x *RolloutPolicy_Checkers_RequiredStatusChecks) GetPlanCheckEnforcement()
return RolloutPolicy_Checkers_PLAN_CHECK_ENFORCEMENT_UNSPECIFIED
}
-// An exception allowing specific users to access masked data.
-type MaskingExceptionPolicy_MaskingException struct {
+type MaskingExemptionPolicy_Exemption struct {
state protoimpl.MessageState `protogen:"open.v1"`
- // Member is the principal who bind to this exception policy instance.
+ // Members who bind to this exemption.
//
- // - `user:{email}`: An email address that represents a specific Bytebase account. For example, `[email protected]`.
- // - `group:{email}`: An email address for group.
- Member string `protobuf:"bytes,3,opt,name=member,proto3" json:"member,omitempty"`
+ // Format: users/{email} or groups/{group email}
+ Members []string `protobuf:"bytes,1,rep,name=members,proto3" json:"members,omitempty"`
// The condition that is associated with this exception policy instance.
// The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
// If the condition is empty, means the user can access all databases without expiration.
@@ -1273,25 +1270,25 @@ type MaskingExceptionPolicy_MaskingException struct {
// For example:
// resource.instance_id == "local" && resource.database_name == "employee" && request.time < timestamp("2025-04-30T11:10:39.000Z")
// resource.instance_id == "local" && resource.database_name == "employee"
- Condition *expr.Expr `protobuf:"bytes,4,opt,name=condition,proto3" json:"condition,omitempty"`
+ Condition *expr.Expr `protobuf:"bytes,2,opt,name=condition,proto3" json:"condition,omitempty"`
unknownFields protoimpl.UnknownFields
sizeCache protoimpl.SizeCache
}
-func (x *MaskingExceptionPolicy_MaskingException) Reset() {
- *x = MaskingExceptionPolicy_MaskingException{}
+func (x *MaskingExemptionPolicy_Exemption) Reset() {
+ *x = MaskingExemptionPolicy_Exemption{}
mi := &file_v1_org_policy_service_proto_msgTypes[15]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
-func (x *MaskingExceptionPolicy_MaskingException) String() string {
+func (x *MaskingExemptionPolicy_Exemption) String() string {
return protoimpl.X.MessageStringOf(x)
}
-func (*MaskingExceptionPolicy_MaskingException) ProtoMessage() {}
+func (*MaskingExemptionPolicy_Exemption) ProtoMessage() {}
-func (x *MaskingExceptionPolicy_MaskingException) ProtoReflect() protoreflect.Message {
+func (x *MaskingExemptionPolicy_Exemption) ProtoReflect() protoreflect.Message {
mi := &file_v1_org_policy_service_proto_msgTypes[15]
if x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
@@ -1303,19 +1300,19 @@ func (x *MaskingExceptionPolicy_MaskingException) ProtoReflect() protoreflect.Me
return mi.MessageOf(x)
}
-// Deprecated: Use MaskingExceptionPolicy_MaskingException.ProtoReflect.Descriptor instead.
-func (*MaskingExceptionPolicy_MaskingException) Descriptor() ([]byte, []int) {
+// Deprecated: Use MaskingExemptionPolicy_Exemption.ProtoReflect.Descriptor instead.
+func (*MaskingExemptionPolicy_Exemption) Descriptor() ([]byte, []int) {
return file_v1_org_policy_service_proto_rawDescGZIP(), []int{9, 0}
}
-func (x *MaskingExceptionPolicy_MaskingException) GetMember() string {
+func (x *MaskingExemptionPolicy_Exemption) GetMembers() []string {
if x != nil {
- return x.Member
+ return x.Members
}
- return ""
+ return nil
}
-func (x *MaskingExceptionPolicy_MaskingException) GetCondition() *expr.Expr {
+func (x *MaskingExemptionPolicy_Exemption) GetCondition() *expr.Expr {
if x != nil {
return x.Condition
}
@@ -1442,7 +1439,7 @@ const file_v1_org_policy_service_proto_rawDesc = "" +
"\x04type\x18\x05 \x01(\x0e2\x17.bytebase.v1.PolicyTypeR\x04type\x12C\n" +
"\x0erollout_policy\x18\x13 \x01(\v2\x1a.bytebase.v1.RolloutPolicyH\x00R\rrolloutPolicy\x12P\n" +
"\x13masking_rule_policy\x18\x11 \x01(\v2\x1e.bytebase.v1.MaskingRulePolicyH\x00R\x11maskingRulePolicy\x12_\n" +
- "\x18masking_exception_policy\x18\x12 \x01(\v2#.bytebase.v1.MaskingExceptionPolicyH\x00R\x16maskingExceptionPolicy\x127\n" +
+ "\x18masking_exemption_policy\x18\x12 \x01(\v2#.bytebase.v1.MaskingExemptionPolicyH\x00R\x16maskingExemptionPolicy\x127\n" +
"\n" +
"tag_policy\x18\x15 \x01(\v2\x16.bytebase.v1.TagPolicyH\x00R\ttagPolicy\x12]\n" +
"\x18data_source_query_policy\x18\x16 \x01(\v2\".bytebase.v1.DataSourceQueryPolicyH\x00R\x15dataSourceQueryPolicy\x12J\n" +
@@ -1471,12 +1468,14 @@ const file_v1_org_policy_service_proto_rawDesc = "" +
"\x0edisable_export\x18\x02 \x01(\bR\rdisableExport\x12.\n" +
"\x13maximum_result_size\x18\x03 \x01(\x03R\x11maximumResultSize\x12.\n" +
"\x13maximum_result_rows\x18\x04 \x01(\x05R\x11maximumResultRows\x12*\n" +
- "\x11disable_copy_data\x18\x05 \x01(\bR\x0fdisableCopyData\"\xda\x01\n" +
- "\x16MaskingExceptionPolicy\x12c\n" +
- "\x12masking_exceptions\x18\x01 \x03(\v24.bytebase.v1.MaskingExceptionPolicy.MaskingExceptionR\x11maskingExceptions\x1a[\n" +
- "\x10MaskingException\x12\x16\n" +
- "\x06member\x18\x03 \x01(\tR\x06member\x12/\n" +
- "\tcondition\x18\x04 \x01(\v2\x11.google.type.ExprR\tcondition\"\xca\x01\n" +
+ "\x11disable_copy_data\x18\x05 \x01(\bR\x0fdisableCopyData\"\xbf\x01\n" +
+ "\x16MaskingExemptionPolicy\x12M\n" +
+ "\n" +
+ "exemptions\x18\x01 \x03(\v2-.bytebase.v1.MaskingExemptionPolicy.ExemptionR\n" +
+ "exemptions\x1aV\n" +
+ "\tExemption\x12\x18\n" +
+ "\amembers\x18\x01 \x03(\tR\amembers\x12/\n" +
+ "\tcondition\x18\x02 \x01(\v2\x11.google.type.ExprR\tcondition\"\xca\x01\n" +
"\x11MaskingRulePolicy\x12@\n" +
"\x05rules\x18\x01 \x03(\v2*.bytebase.v1.MaskingRulePolicy.MaskingRuleR\x05rules\x1as\n" +
"\vMaskingRule\x12\x0e\n" +
@@ -1495,18 +1494,18 @@ const file_v1_org_policy_service_proto_rawDesc = "" +
"\vRestriction\x12\x1b\n" +
"\x17RESTRICTION_UNSPECIFIED\x10\x00\x12\f\n" +
"\bFALLBACK\x10\x01\x12\f\n" +
- "\bDISALLOW\x10\x02*\xc0\x01\n" +
+ "\bDISALLOW\x10\x02*\xae\x01\n" +
"\n" +
"PolicyType\x12\x1b\n" +
"\x17POLICY_TYPE_UNSPECIFIED\x10\x00\x12\x12\n" +
"\x0eROLLOUT_POLICY\x10\v\x12\x10\n" +
"\fMASKING_RULE\x10\t\x12\x15\n" +
- "\x11MASKING_EXCEPTION\x10\n" +
+ "\x11MASKING_EXEMPTION\x10\n" +
"\x12\a\n" +
"\x03TAG\x10\r\x12\x15\n" +
"\x11DATA_SOURCE_QUERY\x10\x0e\x12\x0e\n" +
"\n" +
- "DATA_QUERY\x10\x10\"\x04\b\x02\x10\x02\"\x04\b\x04\x10\x04\"\x04\b\x06\x10\x06\"\x04\b\x05\x10\x05\"\x04\b\a\x10\a\"\x04\b\f\x10\f\"\x04\b\x0f\x10\x0f*`\n" +
+ "DATA_QUERY\x10\x10\"\x04\b\x06\x10\x06\"\x04\b\a\x10\a\"\x04\b\f\x10\f\"\x04\b\x0f\x10\x0f*`\n" +
"\x12PolicyResourceType\x12\x1d\n" +
"\x19RESOURCE_TYPE_UNSPECIFIED\x10\x00\x12\r\n" +
"\tWORKSPACE\x10\x01\x12\x0f\n" +
@@ -1548,13 +1547,13 @@ var file_v1_org_policy_service_proto_goTypes = []any{
(*Policy)(nil), // 10: bytebase.v1.Policy
(*RolloutPolicy)(nil), // 11: bytebase.v1.RolloutPolicy
(*QueryDataPolicy)(nil), // 12: bytebase.v1.QueryDataPolicy
- (*MaskingExceptionPolicy)(nil), // 13: bytebase.v1.MaskingExceptionPolicy
+ (*MaskingExemptionPolicy)(nil), // 13: bytebase.v1.MaskingExemptionPolicy
(*MaskingRulePolicy)(nil), // 14: bytebase.v1.MaskingRulePolicy
(*TagPolicy)(nil), // 15: bytebase.v1.TagPolicy
(*DataSourceQueryPolicy)(nil), // 16: bytebase.v1.DataSourceQueryPolicy
(*RolloutPolicy_Checkers)(nil), // 17: bytebase.v1.RolloutPolicy.Checkers
(*RolloutPolicy_Checkers_RequiredStatusChecks)(nil), // 18: bytebase.v1.RolloutPolicy.Checkers.RequiredStatusChecks
- (*MaskingExceptionPolicy_MaskingException)(nil), // 19: bytebase.v1.MaskingExceptionPolicy.MaskingException
+ (*MaskingExemptionPolicy_Exemption)(nil), // 19: bytebase.v1.MaskingExemptionPolicy.Exemption
(*MaskingRulePolicy_MaskingRule)(nil), // 20: bytebase.v1.MaskingRulePolicy.MaskingRule
nil, // 21: bytebase.v1.TagPolicy.TagsEntry
(*fieldmaskpb.FieldMask)(nil), // 22: google.protobuf.FieldMask
@@ -1572,20 +1571,20 @@ var file_v1_org_policy_service_proto_depIdxs = []int32{
0, // 6: bytebase.v1.Policy.type:type_name -> bytebase.v1.PolicyType
11, // 7: bytebase.v1.Policy.rollout_policy:type_name -> bytebase.v1.RolloutPolicy
14, // 8: bytebase.v1.Policy.masking_rule_policy:type_name -> bytebase.v1.MaskingRulePolicy
- 13, // 9: bytebase.v1.Policy.masking_exception_policy:type_name -> bytebase.v1.MaskingExceptionPolicy
+ 13, // 9: bytebase.v1.Policy.masking_exemption_policy:type_name -> bytebase.v1.MaskingExemptionPolicy
15, // 10: bytebase.v1.Policy.tag_policy:type_name -> bytebase.v1.TagPolicy
16, // 11: bytebase.v1.Policy.data_source_query_policy:type_name -> bytebase.v1.DataSourceQueryPolicy
12, // 12: bytebase.v1.Policy.query_data_policy:type_name -> bytebase.v1.QueryDataPolicy
1, // 13: bytebase.v1.Policy.resource_type:type_name -> bytebase.v1.PolicyResourceType
17, // 14: bytebase.v1.RolloutPolicy.checkers:type_name -> bytebase.v1.RolloutPolicy.Checkers
23, // 15: bytebase.v1.QueryDataPolicy.timeout:type_name -> google.protobuf.Duration
- 19, // 16: bytebase.v1.MaskingExceptionPolicy.masking_exceptions:type_name -> bytebase.v1.MaskingExceptionPolicy.MaskingException
+ 19, // 16: bytebase.v1.MaskingExemptionPolicy.exemptions:type_name -> bytebase.v1.MaskingExemptionPolicy.Exemption
20, // 17: bytebase.v1.MaskingRulePolicy.rules:type_name -> bytebase.v1.MaskingRulePolicy.MaskingRule
21, // 18: bytebase.v1.TagPolicy.tags:type_name -> bytebase.v1.TagPolicy.TagsEntry
3, // 19: bytebase.v1.DataSourceQueryPolicy.admin_data_source_restriction:type_name -> bytebase.v1.DataSourceQueryPolicy.Restriction
18, // 20: bytebase.v1.RolloutPolicy.Checkers.required_status_checks:type_name -> bytebase.v1.RolloutPolicy.Checkers.RequiredStatusChecks
2, // 21: bytebase.v1.RolloutPolicy.Checkers.RequiredStatusChecks.plan_check_enforcement:type_name -> bytebase.v1.RolloutPolicy.Checkers.PlanCheckEnforcement
- 24, // 22: bytebase.v1.MaskingExceptionPolicy.MaskingException.condition:type_name -> google.type.Expr
+ 24, // 22: bytebase.v1.MaskingExemptionPolicy.Exemption.condition:type_name -> google.type.Expr
24, // 23: bytebase.v1.MaskingRulePolicy.MaskingRule.condition:type_name -> google.type.Expr
7, // 24: bytebase.v1.OrgPolicyService.GetPolicy:input_type -> bytebase.v1.GetPolicyRequest
8, // 25: bytebase.v1.OrgPolicyService.ListPolicies:input_type -> bytebase.v1.ListPoliciesRequest
@@ -1614,7 +1613,7 @@ func file_v1_org_policy_service_proto_init() {
file_v1_org_policy_service_proto_msgTypes[6].OneofWrappers = []any{
(*Policy_RolloutPolicy)(nil),
(*Policy_MaskingRulePolicy)(nil),
- (*Policy_MaskingExceptionPolicy)(nil),
+ (*Policy_MaskingExemptionPolicy)(nil),
(*Policy_TagPolicy)(nil),
(*Policy_DataSourceQueryPolicy)(nil),
(*Policy_QueryDataPolicy)(nil),
diff --git a/backend/generated-go/v1/org_policy_service_equal.pb.go b/backend/generated-go/v1/org_policy_service_equal.pb.go
index 7a002f3901..e34cfca2ec 100644
--- a/backend/generated-go/v1/org_policy_service_equal.pb.go
+++ b/backend/generated-go/v1/org_policy_service_equal.pb.go
@@ -136,7 +136,7 @@ func (x *Policy) Equal(y *Policy) bool {
if !x.GetMaskingRulePolicy().Equal(y.GetMaskingRulePolicy()) {
return false
}
- if !x.GetMaskingExceptionPolicy().Equal(y.GetMaskingExceptionPolicy()) {
+ if !x.GetMaskingExemptionPolicy().Equal(y.GetMaskingExemptionPolicy()) {
return false
}
if !x.GetTagPolicy().Equal(y.GetTagPolicy()) {
@@ -235,16 +235,21 @@ func (x *QueryDataPolicy) Equal(y *QueryDataPolicy) bool {
return true
}
-func (x *MaskingExceptionPolicy_MaskingException) Equal(y *MaskingExceptionPolicy_MaskingException) bool {
+func (x *MaskingExemptionPolicy_Exemption) Equal(y *MaskingExemptionPolicy_Exemption) bool {
if x == y {
return true
}
if x == nil || y == nil {
return x == nil && y == nil
}
- if x.Member != y.Member {
+ if len(x.Members) != len(y.Members) {
return false
}
+ for i := 0; i < len(x.Members); i++ {
+ if x.Members[i] != y.Members[i] {
+ return false
+ }
+ }
if equal, ok := interface{}(x.Condition).(interface{ Equal(*expr.Expr) bool }); !ok || !equal.Equal(y.Condition) {
return false
} else if !proto.Equal(x.Condition, y.Condition) {
@@ -253,18 +258,18 @@ func (x *MaskingExceptionPolicy_MaskingException) Equal(y *MaskingExceptionPolic
return true
}
-func (x *MaskingExceptionPolicy) Equal(y *MaskingExceptionPolicy) bool {
+func (x *MaskingExemptionPolicy) Equal(y *MaskingExemptionPolicy) bool {
if x == y {
return true
}
if x == nil || y == nil {
return x == nil && y == nil
}
- if len(x.MaskingExceptions) != len(y.MaskingExceptions) {
+ if len(x.Exemptions) != len(y.Exemptions) {
return false
}
- for i := 0; i < len(x.MaskingExceptions); i++ {
- if !x.MaskingExceptions[i].Equal(y.MaskingExceptions[i]) {
+ for i := 0; i < len(x.Exemptions); i++ {
+ if !x.Exemptions[i].Equal(y.Exemptions[i]) {
return false
}
}
diff --git a/backend/migrator/migration/3.13/0027##migrate_masking_exception.sql b/backend/migrator/migration/3.13/0027##migrate_masking_exception.sql
new file mode 100644
index 0000000000..691100138c
--- /dev/null
+++ b/backend/migrator/migration/3.13/0027##migrate_masking_exception.sql
@@ -0,0 +1,19 @@
+UPDATE policy
+SET
+ type = 'MASKING_EXEMPTION',
+ payload = (
+ SELECT jsonb_build_object(
+ 'exemptions',
+ COALESCE(
+ jsonb_agg(
+ jsonb_build_object(
+ 'members', jsonb_build_array(elem->>'member'),
+ 'condition', elem->'condition'
+ )
+ ),
+ '[]'::jsonb
+ )
+ )
+ FROM jsonb_array_elements(payload -> 'maskingExceptions') AS elem
+ )
+WHERE type = 'MASKING_EXCEPTION';
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index d5d31bc897..9ff8f4ca65 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -12,7 +12,7 @@ import (
func TestLatestVersion(t *testing.T) {
files, err := getSortedVersionedFiles()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("3.13.26"), *files[len(files)-1].version)
+ require.Equal(t, semver.MustParse("3.13.27"), *files[len(files)-1].version)
}
func TestVersionUnique(t *testing.T) {
diff --git a/backend/store/policy.go b/backend/store/policy.go
index b20fd82047..c981314671 100644
--- a/backend/store/policy.go
+++ b/backend/store/policy.go
@@ -353,11 +353,11 @@ func (s *Store) GetMaskingRulePolicy(ctx context.Context) (*storepb.MaskingRuleP
return p, nil
}
-// GetMaskingExceptionPolicyByProject gets the masking exception policy for a project.
-func (s *Store) GetMaskingExceptionPolicyByProject(ctx context.Context, projectID string) (*storepb.MaskingExceptionPolicy, error) {
+// GetMaskingExemptionPolicyByProject gets the masking exemption policy for a project.
+func (s *Store) GetMaskingExemptionPolicyByProject(ctx context.Context, projectID string) (*storepb.MaskingExemptionPolicy, error) {
resourceType := storepb.Policy_PROJECT
resource := common.FormatProject(projectID)
- pType := storepb.Policy_MASKING_EXCEPTION
+ pType := storepb.Policy_MASKING_EXEMPTION
policy, err := s.GetPolicy(ctx, &FindPolicyMessage{
ResourceType: &resourceType,
Resource: &resource,
@@ -368,10 +368,10 @@ func (s *Store) GetMaskingExceptionPolicyByProject(ctx context.Context, projectI
}
if policy == nil {
- return &storepb.MaskingExceptionPolicy{}, nil
+ return &storepb.MaskingExemptionPolicy{}, nil
}
- p := new(storepb.MaskingExceptionPolicy)
+ p := new(storepb.MaskingExemptionPolicy)
if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(policy.Payload), p); err != nil {
return nil, err
}
diff --git a/backend/store/principal.go b/backend/store/principal.go
index 274d467134..7c7a9b1f7a 100644
--- a/backend/store/principal.go
+++ b/backend/store/principal.go
@@ -597,7 +597,7 @@ func (s *Store) UpdateUserEmail(ctx context.Context, user *UserMessage, newEmail
// 3. Update Policies
// Update IAM policies: bindings->members array contains user references
- // Update MASKING_EXCEPTION policies: maskingExceptions->member field contains user references
+ // Update MASKING_EXEMPTION policies: exemptions->members field contains user references
var invalidatedPolicies []struct {
ResourceType storepb.Policy_Resource
Resource string
@@ -676,38 +676,51 @@ func (s *Store) UpdateUserEmail(ctx context.Context, user *UserMessage, newEmail
}
rows.Close()
- // 3b. Update MASKING_EXCEPTION policy maskingExceptions
+ // 3b. Update MASKING_EXEMPTION policy exemptions
maskingPolicySQL := `
UPDATE policy
SET payload = (
SELECT jsonb_set(
policy.payload,
- '{maskingExceptions}',
+ '{exemptions}',
COALESCE(
(
SELECT jsonb_agg(
CASE
- WHEN exception->>'member' = $1 THEN
- jsonb_set(exception, '{member}', to_jsonb($2::text))
- ELSE exception
+ WHEN $1 = ANY(SELECT jsonb_array_elements_text(exemption->'members')) THEN
+ jsonb_set(
+ exemption,
+ '{members}',
+ COALESCE(
+ (
+ SELECT jsonb_agg(
+ CASE WHEN member = $1 THEN $2::text ELSE member END
+ )
+ FROM jsonb_array_elements_text(exemption->'members') AS member
+ ),
+ '[]'::jsonb
+ )
+ )
+ ELSE exemption
END
)
- FROM jsonb_array_elements(policy.payload->'maskingExceptions') AS exception
+ FROM jsonb_array_elements(policy.payload->'exemptions') AS exemption
),
'[]'::jsonb
)
)
)
WHERE type = $3
- AND payload ? 'maskingExceptions'
+ AND payload ? 'exemptions'
AND EXISTS (
SELECT 1
- FROM jsonb_array_elements(payload->'maskingExceptions') AS exception
- WHERE exception->>'member' = $1
+ FROM jsonb_array_elements(payload->'exemptions') AS exemption,
+ jsonb_array_elements_text(exemption->'members') AS member
+ WHERE member = $1
)
RETURNING resource_type, resource, type`
- rows, err = tx.QueryContext(ctx, maskingPolicySQL, oldUserRef, newUserRef, storepb.Policy_MASKING_EXCEPTION.String())
+ rows, err = tx.QueryContext(ctx, maskingPolicySQL, oldUserRef, newUserRef, storepb.Policy_MASKING_EXEMPTION.String())
if err != nil {
return nil, errors.Wrapf(err, "failed to update MASKING_EXCEPTION policies")
}
@@ -716,7 +729,7 @@ func (s *Store) UpdateUserEmail(ctx context.Context, user *UserMessage, newEmail
for rows.Next() {
var resourceTypeStr, resource, typeStr string
if err := rows.Scan(&resourceTypeStr, &resource, &typeStr); err != nil {
- return nil, errors.Wrapf(err, "failed to scan updated MASKING_EXCEPTION policy")
+ return nil, errors.Wrapf(err, "failed to scan updated MASKING_EXEMPTION policy")
}
var invalidation struct {
diff --git a/backend/tests/user_test.go b/backend/tests/user_test.go
index 538842c482..a347acca29 100644
--- a/backend/tests/user_test.go
+++ b/backend/tests/user_test.go
@@ -218,12 +218,12 @@ func TestUpdateUserEmail(t *testing.T) {
maskingPolicy, err := ctl.orgPolicyServiceClient.CreatePolicy(ctx, connect.NewRequest(&v1pb.CreatePolicyRequest{
Parent: "projects/" + projectID,
Policy: &v1pb.Policy{
- Type: v1pb.PolicyType_MASKING_EXCEPTION,
- Policy: &v1pb.Policy_MaskingExceptionPolicy{
- MaskingExceptionPolicy: &v1pb.MaskingExceptionPolicy{
- MaskingExceptions: []*v1pb.MaskingExceptionPolicy_MaskingException{
+ Type: v1pb.PolicyType_MASKING_EXEMPTION,
+ Policy: &v1pb.Policy_MaskingExemptionPolicy{
+ MaskingExemptionPolicy: &v1pb.MaskingExemptionPolicy{
+ Exemptions: []*v1pb.MaskingExemptionPolicy_Exemption{
{
- Member: fmt.Sprintf("user:%s", originalEmail),
+ Members: []string{fmt.Sprintf("user:%s", originalEmail)},
Condition: &expr.Expr{}, // Empty condition means access all databases without expiration
},
},
@@ -345,11 +345,11 @@ func TestUpdateUserEmail(t *testing.T) {
Name: maskingPolicy.Msg.Name,
}))
a.NoError(err)
- maskingExceptions := updatedMaskingPolicy.Msg.GetMaskingExceptionPolicy().GetMaskingExceptions()
- a.Len(maskingExceptions, 1)
- a.Equal(fmt.Sprintf("user:%s", newEmail), maskingExceptions[0].Member, "Masking exception member should be updated to new email")
- for _, exception := range maskingExceptions {
- a.NotEqual(fmt.Sprintf("user:%s", originalEmail), exception.Member, "Old email should not present in masking exception")
+ maskingExemptions := updatedMaskingPolicy.Msg.GetMaskingExemptionPolicy().GetExemptions()
+ a.Len(maskingExemptions, 1)
+ a.Equal(fmt.Sprintf("user:%s", newEmail), maskingExemptions[0].Members[0], "Masking exemption member should be updated to new email")
+ for _, exemption := range maskingExemptions {
+ a.NotEqual(fmt.Sprintf("user:%s", originalEmail), exemption.Members[0], "Old email should not present in masking exemption")
}
// Verify Audit Logs
diff --git a/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue b/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue
index 385ca17e22..ec0af336e9 100644
--- a/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue
+++ b/frontend/src/components/Database/DatabaseSensitiveDataPanel.vue
@@ -91,7 +91,7 @@ import {
ObjectSchema_Type,
} from "@/types/proto-es/v1/database_catalog_service_pb";
import {
- MaskingExceptionPolicySchema,
+ MaskingExemptionPolicySchema,
PolicyType,
} from "@/types/proto-es/v1/org_policy_service_pb";
import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";
@@ -273,15 +273,15 @@ const removeSensitiveColumn = async (sensitiveColumn: MaskData) => {
const removeMaskingExceptions = async (sensitiveColumn: MaskData) => {
const policy = await policyStore.getOrFetchPolicyByParentAndType({
parentPath: props.database.project,
- policyType: PolicyType.MASKING_EXCEPTION,
+ policyType: PolicyType.MASKING_EXEMPTION,
});
if (!policy) {
return;
}
const exceptions = (
- policy.policy?.case === "maskingExceptionPolicy"
- ? policy.policy.value.maskingExceptions
+ policy.policy?.case === "maskingExemptionPolicy"
+ ? policy.policy.value.exemptions
: []
).filter(
(exception) =>
@@ -292,9 +292,9 @@ const removeMaskingExceptions = async (sensitiveColumn: MaskData) => {
);
policy.policy = {
- case: "maskingExceptionPolicy",
- value: create(MaskingExceptionPolicySchema, {
- maskingExceptions: exceptions,
+ case: "maskingExemptionPolicy",
+ value: create(MaskingExemptionPolicySchema, {
+ exemptions: exceptions,
}),
};
await policyStore.upsertPolicy({
diff --git a/frontend/src/components/SensitiveData/GrantAccessForm.vue b/frontend/src/components/SensitiveData/GrantAccessForm.vue
index 83059f194d..8d4d0d0f96 100644
--- a/frontend/src/components/SensitiveData/GrantAccessForm.vue
+++ b/frontend/src/components/SensitiveData/GrantAccessForm.vue
@@ -86,12 +86,12 @@ import { pushNotification, usePolicyV1Store } from "@/store";
import type { DatabaseResource } from "@/types";
import { ExprSchema } from "@/types/proto-es/google/type/expr_pb";
import type {
- MaskingExceptionPolicy_MaskingException,
+ MaskingExemptionPolicy_Exemption,
Policy,
} from "@/types/proto-es/v1/org_policy_service_pb";
import {
- MaskingExceptionPolicy_MaskingExceptionSchema,
- MaskingExceptionPolicySchema,
+ MaskingExemptionPolicy_ExemptionSchema,
+ MaskingExemptionPolicySchema,
PolicyResourceType,
PolicyType,
} from "@/types/proto-es/v1/org_policy_service_pb";
@@ -178,7 +178,7 @@ const onSubmit = async () => {
const getPendingUpdatePolicy = async (
parentPath: string
): Promise<Partial<Policy>> => {
- const maskingExceptions: MaskingExceptionPolicy_MaskingException[] = [];
+ const exemptions: MaskingExemptionPolicy_Exemption[] = [];
const expressions = [];
if (state.expirationTimestamp) {
@@ -189,45 +189,43 @@ const getPendingUpdatePolicy = async (
);
}
- for (const member of state.memberList) {
- const resourceExpressions = state.databaseResources?.map(
- getExpressionsForDatabaseResource
- ) ?? [[""]];
- for (const expressionList of resourceExpressions) {
- const resourceExpression = [...expressionList, ...expressions].filter(
- (e) => e
- );
- maskingExceptions.push(
- create(MaskingExceptionPolicy_MaskingExceptionSchema, {
- member,
- condition: create(ExprSchema, {
- description: state.description,
- expression:
- resourceExpression.length > 0
- ? resourceExpression.join(" && ")
- : "",
- }),
- })
- );
- }
+ const resourceExpressions = state.databaseResources?.map(
+ getExpressionsForDatabaseResource
+ ) ?? [[""]];
+ for (const expressionList of resourceExpressions) {
+ const resourceExpression = [...expressionList, ...expressions].filter(
+ (e) => e
+ );
+ exemptions.push(
+ create(MaskingExemptionPolicy_ExemptionSchema, {
+ members: state.memberList,
+ condition: create(ExprSchema, {
+ description: state.description,
+ expression:
+ resourceExpression.length > 0
+ ? resourceExpression.join(" && ")
+ : "",
+ }),
+ })
+ );
}
const policy = await policyStore.getOrFetchPolicyByParentAndType({
parentPath,
- policyType: PolicyType.MASKING_EXCEPTION,
+ policyType: PolicyType.MASKING_EXEMPTION,
});
const existed =
- policy?.policy?.case === "maskingExceptionPolicy"
- ? policy.policy.value.maskingExceptions
+ policy?.policy?.case === "maskingExemptionPolicy"
+ ? policy.policy.value.exemptions
: [];
return {
name: policy?.name,
- type: PolicyType.MASKING_EXCEPTION,
+ type: PolicyType.MASKING_EXEMPTION,
resourceType: PolicyResourceType.PROJECT,
policy: {
- case: "maskingExceptionPolicy",
- value: create(MaskingExceptionPolicySchema, {
- maskingExceptions: [...existed, ...maskingExceptions],
+ case: "maskingExemptionPolicy",
+ value: create(MaskingExemptionPolicySchema, {
+ exemptions: [...existed, ...exemptions],
}),
},
};
diff --git a/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue b/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue
index 1abe29587c..c8b1d88ed2 100644
--- a/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue
+++ b/frontend/src/components/SensitiveData/MaskingExceptionUserTable.vue
@@ -45,9 +45,9 @@ import {
isValidDatabaseName,
} from "@/types";
import { ExprSchema } from "@/types/proto-es/google/type/expr_pb";
-import type { MaskingExceptionPolicy_MaskingException } from "@/types/proto-es/v1/org_policy_service_pb";
+import type { MaskingExemptionPolicy_Exemption } from "@/types/proto-es/v1/org_policy_service_pb";
import {
- MaskingExceptionPolicySchema,
+ MaskingExemptionPolicySchema,
PolicyType,
} from "@/types/proto-es/v1/org_policy_service_pb";
import type { Project } from "@/types/proto-es/v1/project_service_pb";
@@ -93,7 +93,7 @@ const hasPermission = computed(() => {
const { policy, ready } = usePolicyByParentAndType(
computed(() => ({
parentPath: props.project.name,
- policyType: PolicyType.MASKING_EXCEPTION,
+ policyType: PolicyType.MASKING_EXEMPTION,
}))
);
@@ -191,9 +191,9 @@ const getDatabaseAccessResource = (access: AccessUser): VNodeChild => {
const expirationTimeRegex = /request.time < timestamp\("(.+)?"\)/;
const getAccessUsers = async (
- exception: MaskingExceptionPolicy_MaskingException,
+ exception: MaskingExemptionPolicy_Exemption,
condition: ConditionExpression
-): Promise<AccessUser | undefined> => {
+): Promise<AccessUser[]> => {
let expirationTimestamp: number | undefined;
const expression = exception.condition?.expression ?? "";
const description = exception.condition?.description ?? "";
@@ -202,32 +202,33 @@ const getAccessUsers = async (
expirationTimestamp = new Date(matches[1]).getTime();
}
- const access: AccessUser = {
- type: "user",
- key: `${exception.member}:${expression}.${description}`,
- expirationTimestamp,
- rawExpression: expression,
- description,
- databaseResource: condition.databaseResources
- ? condition.databaseResources[0]
- : undefined,
- };
-
- if (exception.member.startsWith(groupBindingPrefix)) {
- access.type = "group";
- access.group = await groupStore.getOrFetchGroupByIdentifier(
- exception.member
- );
- } else {
- access.type = "user";
- access.user = await userStore.getOrFetchUserByIdentifier(exception.member);
- }
+ const result: AccessUser[] = [];
+ for (const member of exception.members) {
+ const access: AccessUser = {
+ type: "user",
+ key: `${member}:${expression}.${description}`,
+ expirationTimestamp,
+ rawExpression: expression,
+ description,
+ databaseResource: condition.databaseResources
+ ? condition.databaseResources[0]
+ : undefined,
+ };
+
+ if (member.startsWith(groupBindingPrefix)) {
+ access.type = "group";
+ access.group = await groupStore.getOrFetchGroupByIdentifier(member);
+ } else {
+ access.type = "user";
+ access.user = await userStore.getOrFetchUserByIdentifier(member);
+ }
- if (!access.group && !access.user) {
- return;
+ if (access.group || access.user) {
+ result.push(access);
+ }
}
- return access;
+ return result;
};
const getMemberBinding = (access: AccessUser): string => {
@@ -243,29 +244,27 @@ const updateAccessUserList = async () => {
return;
}
- if (!policy.value || policy.value.policy?.case !== "maskingExceptionPolicy") {
+ if (!policy.value || policy.value.policy?.case !== "maskingExemptionPolicy") {
state.rawAccessList = [];
state.loading = false;
return;
}
const memberMap = new Map<string, AccessUser>();
- const { maskingExceptions } = policy.value.policy.value;
- const expressionList = maskingExceptions.map((e) =>
+ const { exemptions } = policy.value.policy.value;
+ const expressionList = exemptions.map((e) =>
e.condition?.expression ? e.condition?.expression : "true"
);
const conditionList = await batchConvertFromCELString(expressionList);
- for (let i = 0; i < maskingExceptions.length; i++) {
- const exception = maskingExceptions[i];
+ for (let i = 0; i < exemptions.length; i++) {
+ const exception = exemptions[i];
const condition = conditionList[i];
- const item = await getAccessUsers(exception, condition);
- if (!item) {
- continue;
+ const items = await getAccessUsers(exception, condition);
+ for (const item of items) {
+ memberMap.set(item.key, item);
}
-
- memberMap.set(item.key, item);
}
state.rawAccessList = orderBy(
@@ -455,13 +454,20 @@ const onSubmit = async () => {
const updateExceptionPolicy = async () => {
const policy = await policyStore.getOrFetchPolicyByParentAndType({
parentPath: props.project.name,
- policyType: PolicyType.MASKING_EXCEPTION,
+ policyType: PolicyType.MASKING_EXEMPTION,
});
if (!policy) {
return;
}
- const exceptions = [];
+ const expressionsMap = new Map<
+ string,
+ {
+ description: string;
+ members: string[];
+ }
+ >();
+
for (const accessUser of state.rawAccessList) {
const expressions = accessUser.rawExpression
.split(" && ")
@@ -484,20 +490,33 @@ const updateExceptionPolicy = async () => {
).toISOString()}")`
);
}
- const member = getMemberBinding(accessUser);
+ const finalExpression = expressions.join(" && ");
+ if (!expressionsMap.has(finalExpression)) {
+ expressionsMap.set(finalExpression, {
+ description: accessUser.description,
+ members: [],
+ });
+ }
+ expressionsMap
+ .get(finalExpression)!
+ .members.push(getMemberBinding(accessUser));
+ }
+
+ const exceptions = [];
+ for (const [expression, { description, members }] of expressionsMap) {
exceptions.push({
- member,
+ members,
condition: create(ExprSchema, {
- description: accessUser.description,
- expression: expressions.join(" && "),
+ description: description,
+ expression: expression,
}),
});
}
policy.policy = {
- case: "maskingExceptionPolicy",
- value: create(MaskingExceptionPolicySchema, {
- maskingExceptions: exceptions,
+ case: "maskingExemptionPolicy",
+ value: create(MaskingExemptionPolicySchema, {
+ exemptions: exceptions,
}),
};
await policyStore.upsertPolicy({
diff --git a/frontend/src/components/SensitiveData/utils.ts b/frontend/src/components/SensitiveData/utils.ts
index 7d4746e317..efe4158e37 100644
--- a/frontend/src/components/SensitiveData/utils.ts
+++ b/frontend/src/components/SensitiveData/utils.ts
@@ -1,6 +1,6 @@
import type { MaskData } from "@/components/SensitiveData/types";
import type { DatabaseResource } from "@/types";
-import type { MaskingExceptionPolicy_MaskingException } from "@/types/proto-es/v1/org_policy_service_pb";
+import type { MaskingExemptionPolicy_Exemption } from "@/types/proto-es/v1/org_policy_service_pb";
import { extractDatabaseResourceName } from "@/utils";
import {
CEL_ATTRIBUTE_REQUEST_TIME,
@@ -26,7 +26,7 @@ export const convertSensitiveColumnToDatabaseResource = (
});
export const isCurrentColumnException = (
- exception: MaskingExceptionPolicy_MaskingException,
+ exception: MaskingExemptionPolicy_Exemption,
sensitiveColumn: SensitiveColumn
): boolean => {
const expression = exception.condition?.expression ?? "";
diff --git a/frontend/src/components/User/Settings/RemoveGroupButton.vue b/frontend/src/components/User/Settings/RemoveGroupButton.vue
index deb7e632a9..6db49fb1f2 100644
--- a/frontend/src/components/User/Settings/RemoveGroupButton.vue
+++ b/frontend/src/components/User/Settings/RemoveGroupButton.vue
@@ -95,15 +95,15 @@ const resourcesOccupied = computedAsync(async () => {
const policy = await policyStore.getOrFetchPolicyByParentAndType({
parentPath: project.name,
- policyType: PolicyType.MASKING_EXCEPTION,
+ policyType: PolicyType.MASKING_EXEMPTION,
});
const exceptions =
- policy?.policy?.case === "maskingExceptionPolicy"
- ? policy.policy.value.maskingExceptions
+ policy?.policy?.case === "maskingExemptionPolicy"
+ ? policy.policy.value.exemptions
: [];
for (const exception of exceptions) {
- if (exception.member === member) {
+ if (exception.members.includes(member)) {
resources.add(project.name);
break;
}
diff --git a/frontend/src/store/modules/v1/policy.ts b/frontend/src/store/modules/v1/policy.ts
index 767567b9dc..8a43f16465 100644
--- a/frontend/src/store/modules/v1/policy.ts
+++ b/frontend/src/store/modules/v1/policy.ts
@@ -295,8 +295,8 @@ const getUpdateMaskFromPolicyType = (policyType: PolicyType) => {
switch (policyType) {
case PolicyType.ROLLOUT_POLICY:
return [PolicySchema.field.rolloutPolicy.name];
- case PolicyType.MASKING_EXCEPTION:
- return [PolicySchema.field.maskingExceptionPolicy.name];
+ case PolicyType.MASKING_EXEMPTION:
+ return [PolicySchema.field.maskingExemptionPolicy.name];
case PolicyType.MASKING_RULE:
return [PolicySchema.field.maskingRulePolicy.name];
case PolicyType.DATA_QUERY:
diff --git a/frontend/src/types/proto-es/v1/org_policy_service_pb.d.ts b/frontend/src/types/proto-es/v1/org_policy_service_pb.d.ts
index efe67ec2ce..b6e28a69a1 100644
--- a/frontend/src/types/proto-es/v1/org_policy_service_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/org_policy_service_pb.d.ts
@@ -230,10 +230,10 @@ export declare type Policy = Message<"bytebase.v1.Policy"> & {
case: "maskingRulePolicy";
} | {
/**
- * @generated from field: bytebase.v1.MaskingExceptionPolicy masking_exception_policy = 18;
+ * @generated from field: bytebase.v1.MaskingExemptionPolicy masking_exemption_policy = 18;
*/
- value: MaskingExceptionPolicy;
- case: "maskingExceptionPolicy";
+ value: MaskingExemptionPolicy;
+ case: "maskingExemptionPolicy";
} | {
/**
* @generated from field: bytebase.v1.TagPolicy tag_policy = 21;
@@ -435,40 +435,35 @@ export declare type QueryDataPolicy = Message<"bytebase.v1.QueryDataPolicy"> & {
export declare const QueryDataPolicySchema: GenMessage<QueryDataPolicy>;
/**
- * MaskingExceptionPolicy is the allowlist of users who can access sensitive data.
+ * MaskingExemptionPolicy is the allowlist of users who can access sensitive data.
*
- * @generated from message bytebase.v1.MaskingExceptionPolicy
+ * @generated from message bytebase.v1.MaskingExemptionPolicy
*/
-export declare type MaskingExceptionPolicy = Message<"bytebase.v1.MaskingExceptionPolicy"> & {
+export declare type MaskingExemptionPolicy = Message<"bytebase.v1.MaskingExemptionPolicy"> & {
/**
- * The list of masking exceptions.
- *
- * @generated from field: repeated bytebase.v1.MaskingExceptionPolicy.MaskingException masking_exceptions = 1;
+ * @generated from field: repeated bytebase.v1.MaskingExemptionPolicy.Exemption exemptions = 1;
*/
- maskingExceptions: MaskingExceptionPolicy_MaskingException[];
+ exemptions: MaskingExemptionPolicy_Exemption[];
};
/**
- * Describes the message bytebase.v1.MaskingExceptionPolicy.
- * Use `create(MaskingExceptionPolicySchema)` to create a new message.
+ * Describes the message bytebase.v1.MaskingExemptionPolicy.
+ * Use `create(MaskingExemptionPolicySchema)` to create a new message.
*/
-export declare const MaskingExceptionPolicySchema: GenMessage<MaskingExceptionPolicy>;
+export declare const MaskingExemptionPolicySchema: GenMessage<MaskingExemptionPolicy>;
/**
- * An exception allowing specific users to access masked data.
- *
- * @generated from message bytebase.v1.MaskingExceptionPolicy.MaskingException
+ * @generated from message bytebase.v1.MaskingExemptionPolicy.Exemption
*/
-export declare type MaskingExceptionPolicy_MaskingException = Message<"bytebase.v1.MaskingExceptionPolicy.MaskingException"> & {
+export declare type MaskingExemptionPolicy_Exemption = Message<"bytebase.v1.MaskingExemptionPolicy.Exemption"> & {
/**
- * Member is the principal who bind to this exception policy instance.
+ * Members who bind to this exemption.
*
- * - `user:{email}`: An email address that represents a specific Bytebase account. For example, `[email protected]`.
- * - `group:{email}`: An email address for group.
+ * Format: users/{email} or groups/{group email}
*
- * @generated from field: string member = 3;
+ * @generated from field: repeated string members = 1;
*/
- member: string;
+ members: string[];
/**
* The condition that is associated with this exception policy instance.
@@ -488,16 +483,16 @@ export declare type MaskingExceptionPolicy_MaskingException = Message<"bytebase.
* resource.instance_id == "local" && resource.database_name == "employee" && request.time < timestamp("2025-04-30T11:10:39.000Z")
* resource.instance_id == "local" && resource.database_name == "employee"
*
- * @generated from field: google.type.Expr condition = 4;
+ * @generated from field: google.type.Expr condition = 2;
*/
condition?: Expr;
};
/**
- * Describes the message bytebase.v1.MaskingExceptionPolicy.MaskingException.
- * Use `create(MaskingExceptionPolicy_MaskingExceptionSchema)` to create a new message.
+ * Describes the message bytebase.v1.MaskingExemptionPolicy.Exemption.
+ * Use `create(MaskingExemptionPolicy_ExemptionSchema)` to create a new message.
*/
-export declare const MaskingExceptionPolicy_MaskingExceptionSchema: GenMessage<MaskingExceptionPolicy_MaskingException>;
+export declare const MaskingExemptionPolicy_ExemptionSchema: GenMessage<MaskingExemptionPolicy_Exemption>;
/**
* Policy for configuring data masking rules.
@@ -691,11 +686,11 @@ export enum PolicyType {
MASKING_RULE = 9,
/**
- * Data masking exception policy.
+ * Data masking exemption policy.
*
- * @generated from enum value: MASKING_EXCEPTION = 10;
+ * @generated from enum value: MASKING_EXEMPTION = 10;
*/
- MASKING_EXCEPTION = 10,
+ MASKING_EXEMPTION = 10,
/**
* Resource tag policy.
diff --git a/frontend/src/types/proto-es/v1/org_policy_service_pb.js b/frontend/src/types/proto-es/v1/org_policy_service_pb.js
index 482ef11a3b..40e6690a1d 100644
--- a/frontend/src/types/proto-es/v1/org_policy_service_pb.js
+++ b/frontend/src/types/proto-es/v1/org_policy_service_pb.js
@@ -15,7 +15,7 @@ import { file_v1_annotation } from "./annotation_pb";
* Describes the file v1/org_policy_service.proto.
*/
export const file_v1_org_policy_service = /*@__PURE__*/
- fileDesc("Cht2MS9vcmdfcG9saWN5X3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIpMBChNDcmVhdGVQb2xpY3lSZXF1ZXN0EisKBnBhcmVudBgBIAEoCUIb4EEC+kEVEhNieXRlYmFzZS5jb20vUG9saWN5EigKBnBvbGljeRgCIAEoCzITLmJ5dGViYXNlLnYxLlBvbGljeUID4EECEiUKBHR5cGUYAyABKA4yFy5ieXRlYmFzZS52MS5Qb2xpY3lUeXBlIocBChNVcGRhdGVQb2xpY3lSZXF1ZXN0EigKBnBvbGljeRgBIAEoCzITLmJ5dGViYXNlLnYxLlBvbGljeUID4EECEi8KC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzaxIVCg1hbGxvd19taXN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lcy8qL3BvbGljaWVzLyp9MhwvdjEve3BvbGljeS5uYW1lPXBvbGljaWVzLyp9ErACCgxEZWxldGVQb2xpY3kSIC5ieXRlYmFzZS52MS5EZWxldGVQb2xpY3lSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IuUB2kEEbmFtZYrqMBJiYi5wb2xpY2llcy5kZWxldGWQ6jABmOowAYLT5JMCuQFaIiogL3YxL3tuYW1lPXByb2plY3RzLyovcG9saWNpZXMvKn1aJiokL3YxL3tuYW1lPWVudmlyb25tZW50cy8qL3BvbGljaWVzLyp9WiMqIS92MS97bmFtZT1pbnN0YW5jZXMvKi9wb2xpY2llcy8qfVovKi0vdjEve25hbWU9aW5zdGFuY2VzLyovZGF0YWJhc2VzLyovcG9saWNpZXMvKn0qFS92MS97bmFtZT1wb2xpY2llcy8qfUKrAQoPY29tLmJ5dGViYXNlLnYxQhVPcmdQb2xpY3lTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation]);
+ fileDesc("Cht2MS9vcmdfcG9saWN5X3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIpMBChNDcmVhdGVQb2xpY3lSZXF1ZXN0EisKBnBhcmVudBgBIAEoCUIb4EEC+kEVEhNieXRlYmFzZS5jb20vUG9saWN5EigKBnBvbGljeRgCIAEoCzITLmJ5dGViYXNlLnYxLlBvbGljeUID4EECEiUKBHR5cGUYAyABKA4yFy5ieXRlYmFzZS52MS5Qb2xpY3lUeXBl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S97cG9saWN5Lm5hbWU9aW5zdGFuY2VzLyovcG9saWNpZXMvKn1aPjoGcG9saWN5MjQvdjEve3BvbGljeS5uYW1lPWluc3RhbmNlcy8qL2RhdGFiYXNlcy8qL3BvbGljaWVzLyp9MhwvdjEve3BvbGljeS5uYW1lPXBvbGljaWVzLyp9ErACCgxEZWxldGVQb2xpY3kSIC5ieXRlYmFzZS52MS5EZWxldGVQb2xpY3lSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IuUB2kEEbmFtZYrqMBJiYi5wb2xpY2llcy5kZWxldGWQ6jABmOowAYLT5JMCuQFaIiogL3YxL3tuYW1lPXByb2plY3RzLyovcG9saWNpZXMvKn1aJiokL3YxL3tuYW1lPWVudmlyb25tZW50cy8qL3BvbGljaWVzLyp9WiMqIS92MS97bmFtZT1pbnN0YW5jZXMvKi9wb2xpY2llcy8qfVovKi0vdjEve25hbWU9aW5zdGFuY2VzLyovZGF0YWJhc2VzLyovcG9saWNpZXMvKn0qFS92MS97bmFtZT1wb2xpY2llcy8qfUKrAQoPY29tLmJ5dGViYXNlLnYxQhVPcmdQb2xpY3lTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_empty, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation]);
/**
* Describes the message bytebase.v1.CreatePolicyRequest.
@@ -107,17 +107,17 @@ export const QueryDataPolicySchema = /*@__PURE__*/
messageDesc(file_v1_org_policy_service, 8);
/**
- * Describes the message bytebase.v1.MaskingExceptionPolicy.
- * Use `create(MaskingExceptionPolicySchema)` to create a new message.
+ * Describes the message bytebase.v1.MaskingExemptionPolicy.
+ * Use `create(MaskingExemptionPolicySchema)` to create a new message.
*/
-export const MaskingExceptionPolicySchema = /*@__PURE__*/
+export const MaskingExemptionPolicySchema = /*@__PURE__*/
messageDesc(file_v1_org_policy_service, 9);
/**
- * Describes the message bytebase.v1.MaskingExceptionPolicy.MaskingException.
- * Use `create(MaskingExceptionPolicy_MaskingExceptionSchema)` to create a new message.
+ * Describes the message bytebase.v1.MaskingExemptionPolicy.Exemption.
+ * Use `create(MaskingExemptionPolicy_ExemptionSchema)` to create a new message.
*/
-export const MaskingExceptionPolicy_MaskingExceptionSchema = /*@__PURE__*/
+export const MaskingExemptionPolicy_ExemptionSchema = /*@__PURE__*/
messageDesc(file_v1_org_policy_service, 9, 0);
/**
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 245da333d2..b9fb3608fb 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -368,7 +368,7 @@ paths:
- POLICY_TYPE_UNSPECIFIED
- ROLLOUT_POLICY
- MASKING_RULE
- - MASKING_EXCEPTION
+ - MASKING_EXEMPTION
- TAG
- DATA_SOURCE_QUERY
- DATA_QUERY
@@ -414,7 +414,7 @@ paths:
- POLICY_TYPE_UNSPECIFIED
- ROLLOUT_POLICY
- MASKING_RULE
- - MASKING_EXCEPTION
+ - MASKING_EXEMPTION
- TAG
- DATA_SOURCE_QUERY
- DATA_QUERY
@@ -1718,7 +1718,7 @@ paths:
- POLICY_TYPE_UNSPECIFIED
- ROLLOUT_POLICY
- MASKING_RULE
- - MASKING_EXCEPTION
+ - MASKING_EXEMPTION
- TAG
- DATA_SOURCE_QUERY
- DATA_QUERY
@@ -1770,7 +1770,7 @@ paths:
- POLICY_TYPE_UNSPECIFIED
- ROLLOUT_POLICY
- MASKING_RULE
- - MASKING_EXCEPTION
+ - MASKING_EXEMPTION
- TAG
- DATA_SOURCE_QUERY
- DATA_QUERY
@@ -2593,7 +2593,7 @@ paths:
- POLICY_TYPE_UNSPECIFIED
- ROLLOUT_POLICY
- MASKING_RULE
- - MASKING_EXCEPTION
+ - MASKING_EXEMPTION
- TAG
- DATA_SOURCE_QUERY
- DATA_QUERY
@@ -2639,7 +2639,7 @@ paths:
- POLICY_TYPE_UNSPECIFIED
- ROLLOUT_POLICY
- MASKING_RULE
- - MASKING_EXCEPTION
+ - MASKING_EXEMPTION
- TAG
- DATA_SOURCE_QUERY
- DATA_QUERY
@@ -3169,7 +3169,7 @@ paths:
- POLICY_TYPE_UNSPECIFIED
- ROLLOUT_POLICY
- MASKING_RULE
- - MASKING_EXCEPTION
+ - MASKING_EXEMPTION
- TAG
- DATA_SOURCE_QUERY
- DATA_QUERY
@@ -3219,7 +3219,7 @@ paths:
- POLICY_TYPE_UNSPECIFIED
- ROLLOUT_POLICY
- MASKING_RULE
- - MASKING_EXCEPTION
+ - MASKING_EXEMPTION
- TAG
- DATA_SOURCE_QUERY
- DATA_QUERY
@@ -4857,7 +4857,7 @@ paths:
- POLICY_TYPE_UNSPECIFIED
- ROLLOUT_POLICY
- MASKING_RULE
- - MASKING_EXCEPTION
+ - MASKING_EXEMPTION
- TAG
- DATA_SOURCE_QUERY
- DATA_QUERY
@@ -4903,7 +4903,7 @@ paths:
- POLICY_TYPE_UNSPECIFIED
- ROLLOUT_POLICY
- MASKING_RULE
- - MASKING_EXCEPTION
+ - MASKING_EXEMPTION
- TAG
- DATA_SOURCE_QUERY
- DATA_QUERY
@@ -11718,25 +11718,25 @@ components:
type: object
properties: {}
description: Request to logout current user session.
- MaskingExceptionPolicy:
+ MaskingExemptionPolicy:
type: object
properties:
- maskingExceptions:
+ exemptions:
type: array
items:
- $ref: '#/components/schemas/MaskingExceptionPolicy_MaskingException'
- description: The list of masking exceptions.
- description: MaskingExceptionPolicy is the allowlist of users who can access sensitive data.
- MaskingExceptionPolicy_MaskingException:
+ $ref: '#/components/schemas/MaskingExemptionPolicy_Exemption'
+ description: MaskingExemptionPolicy is the allowlist of users who can access sensitive data.
+ MaskingExemptionPolicy_Exemption:
type: object
properties:
- member:
- type: string
+ members:
+ type: array
+ items:
+ type: string
description: |-
- Member is the principal who bind to this exception policy instance.
+ Members who bind to this exemption.
- - `user:{email}`: An email address that represents a specific Bytebase account. For example, `[email protected]`.
- - `group:{email}`: An email address for group.
+ Format: users/{email} or groups/{group email}
condition:
allOf:
- $ref: '#/components/schemas/Expr'
@@ -11757,7 +11757,6 @@ components:
For example:
resource.instance_id == "local" && resource.database_name == "employee" && request.time < timestamp("2025-04-30T11:10:39.000Z")
resource.instance_id == "local" && resource.database_name == "employee"
- description: An exception allowing specific users to access masked data.
MaskingReason:
type: object
properties:
@@ -12303,7 +12302,7 @@ components:
- POLICY_TYPE_UNSPECIFIED
- ROLLOUT_POLICY
- MASKING_RULE
- - MASKING_EXCEPTION
+ - MASKING_EXEMPTION
- TAG
- DATA_SOURCE_QUERY
- DATA_QUERY
@@ -12314,8 +12313,8 @@ components:
$ref: '#/components/schemas/RolloutPolicy'
maskingRulePolicy:
$ref: '#/components/schemas/MaskingRulePolicy'
- maskingExceptionPolicy:
- $ref: '#/components/schemas/MaskingExceptionPolicy'
+ maskingExemptionPolicy:
+ $ref: '#/components/schemas/MaskingExemptionPolicy'
tagPolicy:
$ref: '#/components/schemas/TagPolicy'
dataSourceQueryPolicy:
diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.md
index 34b1074e5a..37fcf8e392 100644
--- a/proto/gen/grpc-doc/store/README.md
+++ b/proto/gen/grpc-doc/store/README.md
@@ -205,8 +205,8 @@
- [DataSourceQueryPolicy](#bytebase-store-DataSourceQueryPolicy)
- [EnvironmentTierPolicy](#bytebase-store-EnvironmentTierPolicy)
- [IamPolicy](#bytebase-store-IamPolicy)
- - [MaskingExceptionPolicy](#bytebase-store-MaskingExceptionPolicy)
- - [MaskingExceptionPolicy.MaskingException](#bytebase-store-MaskingExceptionPolicy-MaskingException)
+ - [MaskingExemptionPolicy](#bytebase-store-MaskingExemptionPolicy)
+ - [MaskingExemptionPolicy.Exemption](#bytebase-store-MaskingExemptionPolicy-Exemption)
- [MaskingRulePolicy](#bytebase-store-MaskingRulePolicy)
- [MaskingRulePolicy.MaskingRule](#bytebase-store-MaskingRulePolicy-MaskingRule)
- [Policy](#bytebase-store-Policy)
@@ -3493,33 +3493,37 @@ EnvironmentTierPolicy is the tier of an environment.
-<a name="bytebase-store-MaskingExceptionPolicy"></a>
+<a name="bytebase-store-MaskingExemptionPolicy"></a>
-### MaskingExceptionPolicy
-MaskingExceptionPolicy is the allowlist of users who can access sensitive data.
+### MaskingExemptionPolicy
+MaskingExemptionPolicy is the allowlist of users who can access sensitive data.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| masking_exceptions | [MaskingExceptionPolicy.MaskingException](#bytebase-store-MaskingExceptionPolicy-MaskingException) | repeated | |
+| exemptions | [MaskingExemptionPolicy.Exemption](#bytebase-store-MaskingExemptionPolicy-Exemption) | repeated | |
-<a name="bytebase-store-MaskingExceptionPolicy-MaskingException"></a>
+<a name="bytebase-store-MaskingExemptionPolicy-Exemption"></a>
-### MaskingExceptionPolicy.MaskingException
+### MaskingExemptionPolicy.Exemption
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| member | [string](#string) | | Member is the principal who binds to this exception policy instance.
+| members | [string](#string) | repeated | Members who bind to this exemption.
Format: users/{email} or groups/{group email} |
-| condition | [google.type.Expr](#google-type-Expr) | | The condition that is associated with this exception policy instance. |
+| condition | [google.type.Expr](#google-type-Expr) | | The condition that is associated with this exception policy instance. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec If the condition is empty, means the user can access all databases without expiration.
+
+Support variables: resource.instance_id: the instance resource id. Only support &#34;==&#34; operation. resource.database_name: the database name. Only support &#34;==&#34; operation. resource.schema_name: the schema name. Only support &#34;==&#34; operation. resource.table_name: the table name. Only support &#34;==&#34; operation. resource.column_name: the column name. Only support &#34;==&#34; operation. request.time: the expiration. Only support &#34;&lt;&#34; operation in `request.time &lt; timestamp(&#34;{ISO datetime string format}&#34;)` All variables should join with &#34;&amp;&amp;&#34; condition.
+
+For example: resource.instance_id == &#34;local&#34; &amp;&amp; resource.database_name == &#34;employee&#34; &amp;&amp; request.time &lt; timestamp(&#34;2025-04-30T11:10:39.000Z&#34;) resource.instance_id == &#34;local&#34; &amp;&amp; resource.database_name == &#34;employee&#34; |
@@ -3685,7 +3689,7 @@ QueryDataPolicy is the policy configuration for querying data.
| ---- | ------ | ----------- |
| TYPE_UNSPECIFIED | 0 | |
| ROLLOUT | 1 | |
-| MASKING_EXCEPTION | 2 | |
+| MASKING_EXEMPTION | 2 | |
| QUERY_DATA | 5 | |
| MASKING_RULE | 6 | |
| IAM | 8 | |
diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.html
index a7f829e8e5..4f31e8259a 100644
--- a/proto/gen/grpc-doc/store/index.html
+++ b/proto/gen/grpc-doc/store/index.html
@@ -986,11 +986,11 @@
</li>
<li>
- <a href="#bytebase.store.MaskingExceptionPolicy"><span class="badge">M</span>MaskingExceptionPolicy</a>
+ <a href="#bytebase.store.MaskingExemptionPolicy"><span class="badge">M</span>MaskingExemptionPolicy</a>
</li>
<li>
- <a href="#bytebase.store.MaskingExceptionPolicy.MaskingException"><span class="badge">M</span>MaskingExceptionPolicy.MaskingException</a>
+ <a href="#bytebase.store.MaskingExemptionPolicy.Exemption"><span class="badge">M</span>MaskingExemptionPolicy.Exemption</a>
</li>
<li>
@@ -9756,8 +9756,8 @@ A binding binds one or more members or groups to a single role. </p></td>
- <h3 id="bytebase.store.MaskingExceptionPolicy">MaskingExceptionPolicy</h3>
- <p>MaskingExceptionPolicy is the allowlist of users who can access sensitive data.</p>
+ <h3 id="bytebase.store.MaskingExemptionPolicy">MaskingExemptionPolicy</h3>
+ <p>MaskingExemptionPolicy is the allowlist of users who can access sensitive data.</p>
<table class="field-table">
@@ -9767,8 +9767,8 @@ A binding binds one or more members or groups to a single role. </p></td>
<tbody>
<tr>
- <td>masking_exceptions</td>
- <td><a href="#bytebase.store.MaskingExceptionPolicy.MaskingException">MaskingExceptionPolicy.MaskingException</a></td>
+ <td>exemptions</td>
+ <td><a href="#bytebase.store.MaskingExemptionPolicy.Exemption">MaskingExemptionPolicy.Exemption</a></td>
<td>repeated</td>
<td><p> </p></td>
</tr>
@@ -9780,7 +9780,7 @@ A binding binds one or more members or groups to a single role. </p></td>
- <h3 id="bytebase.store.MaskingExceptionPolicy.MaskingException">MaskingExceptionPolicy.MaskingException</h3>
+ <h3 id="bytebase.store.MaskingExemptionPolicy.Exemption">MaskingExemptionPolicy.Exemption</h3>
<p></p>
@@ -9791,10 +9791,10 @@ A binding binds one or more members or groups to a single role. </p></td>
<tbody>
<tr>
- <td>member</td>
+ <td>members</td>
<td><a href="#string">string</a></td>
- <td></td>
- <td><p>Member is the principal who binds to this exception policy instance.
+ <td>repeated</td>
+ <td><p>Members who bind to this exemption.
Format: users/{email} or groups/{group email} </p></td>
</tr>
@@ -9803,7 +9803,22 @@ Format: users/{email} or groups/{group email} </p></td>
<td>condition</td>
<td><a href="#google.type.Expr">google.type.Expr</a></td>
<td></td>
- <td><p>The condition that is associated with this exception policy instance. </p></td>
+ <td><p>The condition that is associated with this exception policy instance.
+The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+If the condition is empty, means the user can access all databases without expiration.
+
+Support variables:
+resource.instance_id: the instance resource id. Only support &#34;==&#34; operation.
+resource.database_name: the database name. Only support &#34;==&#34; operation.
+resource.schema_name: the schema name. Only support &#34;==&#34; operation.
+resource.table_name: the table name. Only support &#34;==&#34; operation.
+resource.column_name: the column name. Only support &#34;==&#34; operation.
+request.time: the expiration. Only support &#34;&lt;&#34; operation in `request.time &lt; timestamp(&#34;{ISO datetime string format}&#34;)`
+All variables should join with &#34;&amp;&amp;&#34; condition.
+
+For example:
+resource.instance_id == &#34;local&#34; &amp;&amp; resource.database_name == &#34;employee&#34; &amp;&amp; request.time &lt; timestamp(&#34;2025-04-30T11:10:39.000Z&#34;)
+resource.instance_id == &#34;local&#34; &amp;&amp; resource.database_name == &#34;employee&#34; </p></td>
</tr>
</tbody>
@@ -10139,7 +10154,7 @@ For example, the environment resource can have the SQL review config tag, such a
</tr>
<tr>
- <td>MASKING_EXCEPTION</td>
+ <td>MASKING_EXEMPTION</td>
<td>2</td>
<td><p></p></td>
</tr>
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 177f48d2c6..a5ff4efa66 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -398,8 +398,8 @@
- [GetPolicyRequest](#bytebase-v1-GetPolicyRequest)
- [ListPoliciesRequest](#bytebase-v1-ListPoliciesRequest)
- [ListPoliciesResponse](#bytebase-v1-ListPoliciesResponse)
- - [MaskingExceptionPolicy](#bytebase-v1-MaskingExceptionPolicy)
- - [MaskingExceptionPolicy.MaskingException](#bytebase-v1-MaskingExceptionPolicy-MaskingException)
+ - [MaskingExemptionPolicy](#bytebase-v1-MaskingExemptionPolicy)
+ - [MaskingExemptionPolicy.Exemption](#bytebase-v1-MaskingExemptionPolicy-Exemption)
- [MaskingRulePolicy](#bytebase-v1-MaskingRulePolicy)
- [MaskingRulePolicy.MaskingRule](#bytebase-v1-MaskingRulePolicy-MaskingRule)
- [Policy](#bytebase-v1-Policy)
@@ -6702,32 +6702,32 @@ Policy for controlling which data sources can be queried in the SQL editor.
-<a name="bytebase-v1-MaskingExceptionPolicy"></a>
+<a name="bytebase-v1-MaskingExemptionPolicy"></a>
-### MaskingExceptionPolicy
-MaskingExceptionPolicy is the allowlist of users who can access sensitive data.
+### MaskingExemptionPolicy
+MaskingExemptionPolicy is the allowlist of users who can access sensitive data.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| masking_exceptions | [MaskingExceptionPolicy.MaskingException](#bytebase-v1-MaskingExceptionPolicy-MaskingException) | repeated | The list of masking exceptions. |
+| exemptions | [MaskingExemptionPolicy.Exemption](#bytebase-v1-MaskingExemptionPolicy-Exemption) | repeated | |
-<a name="bytebase-v1-MaskingExceptionPolicy-MaskingException"></a>
+<a name="bytebase-v1-MaskingExemptionPolicy-Exemption"></a>
+
+### MaskingExemptionPolicy.Exemption
-### MaskingExceptionPolicy.MaskingException
-An exception allowing specific users to access masked data.
| Field | Type | Label | Description |
| ----- | ---- | ----- | ----------- |
-| member | [string](#string) | | Member is the principal who bind to this exception policy instance.
+| members | [string](#string) | repeated | Members who bind to this exemption.
-- `user:{email}`: An email address that represents a specific Bytebase account. For example, `[email protected]`. - `group:{email}`: An email address for group. |
+Format: users/{email} or groups/{group email} |
| condition | [google.type.Expr](#google-type-Expr) | | The condition that is associated with this exception policy instance. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec If the condition is empty, means the user can access all databases without expiration.
Support variables: resource.instance_id: the instance resource id. Only support &#34;==&#34; operation. resource.database_name: the database name. Only support &#34;==&#34; operation. resource.schema_name: the schema name. Only support &#34;==&#34; operation. resource.table_name: the table name. Only support &#34;==&#34; operation. resource.column_name: the column name. Only support &#34;==&#34; operation. request.time: the expiration. Only support &#34;&lt;&#34; operation in `request.time &lt; timestamp(&#34;{ISO datetime string format}&#34;)` All variables should join with &#34;&amp;&amp;&#34; condition.
@@ -6790,7 +6790,7 @@ For example: resource.environment_id == &#34;test&#34; &amp;&amp; resource.proje
| type | [PolicyType](#bytebase-v1-PolicyType) | | The type of policy. |
| rollout_policy | [RolloutPolicy](#bytebase-v1-RolloutPolicy) | | |
| masking_rule_policy | [MaskingRulePolicy](#bytebase-v1-MaskingRulePolicy) | | |
-| masking_exception_policy | [MaskingExceptionPolicy](#bytebase-v1-MaskingExceptionPolicy) | | |
+| masking_exemption_policy | [MaskingExemptionPolicy](#bytebase-v1-MaskingExemptionPolicy) | | |
| tag_policy | [TagPolicy](#bytebase-v1-TagPolicy) | | |
| data_source_query_policy | [DataSourceQueryPolicy](#bytebase-v1-DataSourceQueryPolicy) | | |
| query_data_policy | [QueryDataPolicy](#bytebase-v1-QueryDataPolicy) | | |
@@ -6958,7 +6958,7 @@ The type of organizational policy.
| POLICY_TYPE_UNSPECIFIED | 0 | Unspecified policy type. |
| ROLLOUT_POLICY | 11 | Rollout deployment policy. |
| MASKING_RULE | 9 | Data masking rule policy. |
-| MASKING_EXCEPTION | 10 | Data masking exception policy. |
+| MASKING_EXEMPTION | 10 | Data masking exemption policy. |
| TAG | 13 | Resource tag policy. |
| DATA_SOURCE_QUERY | 14 | Data source query restrictions policy. |
| DATA_QUERY | 16 | Query data access policy. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index 4beb5d2616..e1f9a31653 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -1698,11 +1698,11 @@
</li>
<li>
- <a href="#bytebase.v1.MaskingExceptionPolicy"><span class="badge">M</span>MaskingExceptionPolicy</a>
+ <a href="#bytebase.v1.MaskingExemptionPolicy"><span class="badge">M</span>MaskingExemptionPolicy</a>
</li>
<li>
- <a href="#bytebase.v1.MaskingExceptionPolicy.MaskingException"><span class="badge">M</span>MaskingExceptionPolicy.MaskingException</a>
+ <a href="#bytebase.v1.MaskingExemptionPolicy.Exemption"><span class="badge">M</span>MaskingExemptionPolicy.Exemption</a>
</li>
<li>
@@ -18886,8 +18886,8 @@ Format: {resource type}/{resource id} </p></td>
- <h3 id="bytebase.v1.MaskingExceptionPolicy">MaskingExceptionPolicy</h3>
- <p>MaskingExceptionPolicy is the allowlist of users who can access sensitive data.</p>
+ <h3 id="bytebase.v1.MaskingExemptionPolicy">MaskingExemptionPolicy</h3>
+ <p>MaskingExemptionPolicy is the allowlist of users who can access sensitive data.</p>
<table class="field-table">
@@ -18897,10 +18897,10 @@ Format: {resource type}/{resource id} </p></td>
<tbody>
<tr>
- <td>masking_exceptions</td>
- <td><a href="#bytebase.v1.MaskingExceptionPolicy.MaskingException">MaskingExceptionPolicy.MaskingException</a></td>
+ <td>exemptions</td>
+ <td><a href="#bytebase.v1.MaskingExemptionPolicy.Exemption">MaskingExemptionPolicy.Exemption</a></td>
<td>repeated</td>
- <td><p>The list of masking exceptions. </p></td>
+ <td><p> </p></td>
</tr>
</tbody>
@@ -18910,8 +18910,8 @@ Format: {resource type}/{resource id} </p></td>
- <h3 id="bytebase.v1.MaskingExceptionPolicy.MaskingException">MaskingExceptionPolicy.MaskingException</h3>
- <p>An exception allowing specific users to access masked data.</p>
+ <h3 id="bytebase.v1.MaskingExemptionPolicy.Exemption">MaskingExemptionPolicy.Exemption</h3>
+ <p></p>
<table class="field-table">
@@ -18921,13 +18921,12 @@ Format: {resource type}/{resource id} </p></td>
<tbody>
<tr>
- <td>member</td>
+ <td>members</td>
<td><a href="#string">string</a></td>
- <td></td>
- <td><p>Member is the principal who bind to this exception policy instance.
+ <td>repeated</td>
+ <td><p>Members who bind to this exemption.
-- `user:{email}`: An email address that represents a specific Bytebase account. For example, `[email protected]`.
-- `group:{email}`: An email address for group. </p></td>
+Format: users/{email} or groups/{group email} </p></td>
</tr>
<tr>
@@ -19094,8 +19093,8 @@ Database resource name: instances/instance-id/databases/database-name. </p></td>
</tr>
<tr>
- <td>masking_exception_policy</td>
- <td><a href="#bytebase.v1.MaskingExceptionPolicy">MaskingExceptionPolicy</a></td>
+ <td>masking_exemption_policy</td>
+ <td><a href="#bytebase.v1.MaskingExemptionPolicy">MaskingExemptionPolicy</a></td>
<td></td>
<td><p> </p></td>
</tr>
@@ -19485,9 +19484,9 @@ In this situation, `update_mask` is ignored. </p></td>
</tr>
<tr>
- <td>MASKING_EXCEPTION</td>
+ <td>MASKING_EXEMPTION</td>
<td>10</td>
- <td><p>Data masking exception policy.</p></td>
+ <td><p>Data masking exemption policy.</p></td>
</tr>
<tr>
diff --git a/proto/store/store/policy.proto b/proto/store/store/policy.proto
index 10ce5b9a92..cf7255f0ce 100644
--- a/proto/store/store/policy.proto
+++ b/proto/store/store/policy.proto
@@ -11,7 +11,7 @@ message Policy {
enum Type {
TYPE_UNSPECIFIED = 0;
ROLLOUT = 1;
- MASKING_EXCEPTION = 2;
+ MASKING_EXEMPTION = 2;
QUERY_DATA = 5;
MASKING_RULE = 6;
IAM = 8;
@@ -32,19 +32,34 @@ message RolloutPolicy {
repeated string roles = 2;
}
-// MaskingExceptionPolicy is the allowlist of users who can access sensitive data.
-message MaskingExceptionPolicy {
- message MaskingException {
- // Member is the principal who binds to this exception policy instance.
+// MaskingExemptionPolicy is the allowlist of users who can access sensitive data.
+message MaskingExemptionPolicy {
+ message Exemption {
+ // Members who bind to this exemption.
//
// Format: users/{email} or groups/{group email}
- string member = 4;
+ repeated string members = 1;
// The condition that is associated with this exception policy instance.
- google.type.Expr condition = 5;
+ // The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
+ // If the condition is empty, means the user can access all databases without expiration.
+ //
+ // Support variables:
+ // resource.instance_id: the instance resource id. Only support "==" operation.
+ // resource.database_name: the database name. Only support "==" operation.
+ // resource.schema_name: the schema name. Only support "==" operation.
+ // resource.table_name: the table name. Only support "==" operation.
+ // resource.column_name: the column name. Only support "==" operation.
+ // request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`
+ // All variables should join with "&&" condition.
+ //
+ // For example:
+ // resource.instance_id == "local" && resource.database_name == "employee" && request.time < timestamp("2025-04-30T11:10:39.000Z")
+ // resource.instance_id == "local" && resource.database_name == "employee"
+ google.type.Expr condition = 2;
}
- repeated MaskingException masking_exceptions = 1;
+ repeated Exemption exemptions = 1;
}
message MaskingRulePolicy {
diff --git a/proto/v1/v1/org_policy_service.proto b/proto/v1/v1/org_policy_service.proto
index 6c1970cc6b..718201e0c8 100644
--- a/proto/v1/v1/org_policy_service.proto
+++ b/proto/v1/v1/org_policy_service.proto
@@ -235,7 +235,7 @@ message Policy {
oneof policy {
RolloutPolicy rollout_policy = 19;
MaskingRulePolicy masking_rule_policy = 17;
- MaskingExceptionPolicy masking_exception_policy = 18;
+ MaskingExemptionPolicy masking_exemption_policy = 18;
TagPolicy tag_policy = 21;
DataSourceQueryPolicy data_source_query_policy = 22;
QueryDataPolicy query_data_policy = 24;
@@ -250,7 +250,7 @@ message Policy {
// The type of organizational policy.
enum PolicyType {
- reserved 2, 4, 6, 5, 7, 12, 15;
+ reserved 6, 7, 12, 15;
// Unspecified policy type.
POLICY_TYPE_UNSPECIFIED = 0;
@@ -258,8 +258,8 @@ enum PolicyType {
ROLLOUT_POLICY = 11;
// Data masking rule policy.
MASKING_RULE = 9;
- // Data masking exception policy.
- MASKING_EXCEPTION = 10;
+ // Data masking exemption policy.
+ MASKING_EXEMPTION = 10;
// Resource tag policy.
TAG = 13;
// Data source query restrictions policy.
@@ -335,15 +335,13 @@ message QueryDataPolicy {
bool disable_copy_data = 5;
}
-// MaskingExceptionPolicy is the allowlist of users who can access sensitive data.
-message MaskingExceptionPolicy {
- // An exception allowing specific users to access masked data.
- message MaskingException {
- // Member is the principal who bind to this exception policy instance.
+// MaskingExemptionPolicy is the allowlist of users who can access sensitive data.
+message MaskingExemptionPolicy {
+ message Exemption {
+ // Members who bind to this exemption.
//
- // - `user:{email}`: An email address that represents a specific Bytebase account. For example, `[email protected]`.
- // - `group:{email}`: An email address for group.
- string member = 3;
+ // Format: users/{email} or groups/{group email}
+ repeated string members = 1;
// The condition that is associated with this exception policy instance.
// The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
@@ -361,11 +359,10 @@ message MaskingExceptionPolicy {
// For example:
// resource.instance_id == "local" && resource.database_name == "employee" && request.time < timestamp("2025-04-30T11:10:39.000Z")
// resource.instance_id == "local" && resource.database_name == "employee"
- google.type.Expr condition = 4;
+ google.type.Expr condition = 2;
}
- // The list of masking exceptions.
- repeated MaskingException masking_exceptions = 1;
+ repeated Exemption exemptions = 1;
}
// Policy for configuring data masking rules.