Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
refactor: query data poilcy (#18947)
ecmadao393a4575acf4
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yamlindex 58adb72ba7..beefc9f6e6 100644--- a/backend/api/mcp/gen/openapi.yaml+++ b/backend/api/mcp/gen/openapi.yaml@@ -13932,55 +13932,54 @@ components:properties:timeout:title: timeout- description: The query timeout duration.- $ref: '#/components/schemas/google.protobuf.Duration'- disableExport:- type: boolean- title: disable_export- description: Disable data export in the SQL editor.- maximumResultSize:- type:- - integer- - string- title: maximum_result_size- format: int64description: |-- The maximum result size limit in bytes.- The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.+ workspace-level policy+ The query timeout duration in the SQL editor.+ $ref: '#/components/schemas/google.protobuf.Duration'maximumResultRows:type: integertitle: maximum_result_rowsformat: int32description: |-- The maximum number of rows to return.+ workspace-level policy+ The maximum number of rows to return in the SQL editor.The default value is -1, means no limit.+ disableExport:+ type: boolean+ title: disable_export+ description: |-+ workspace-level policy+ Disable data export in the SQL editor.disableCopyData:type: booleantitle: disable_copy_data- description: Disable copying query results.- adminDataSourceRestriction:- title: admin_data_source_restriction- description: Restriction for admin data source queries.- $ref: '#/components/schemas/bytebase.v1.QueryDataPolicy.Restriction'+ description: |-+ workspace-level policy+ Disable copying query results in the SQL editor.+ allowAdminDataSource:+ type: boolean+ title: allow_admin_data_source+ description: |-+ workspace-level policy+ Allow using the admin data source to query in the SQL editor.+ If true, users can select the admin data source or read-only data source+ If false,+ 1. when read-only data source is configured, users're force to use the read-only data source+ 2. otherwise fallback to use the admin data source.disallowDdl:type: booleantitle: disallow_ddl- description: Disallow running DDL statements in the SQL editor.+ description: |-+ ================+ Deprecate following fields.+ Disallow running DDL statements in the SQL editor.disallowDml:type: booleantitle: disallow_dmldescription: Disallow running DML statements in the SQL editor.title: QueryDataPolicyadditionalProperties: false- description: QueryDataPolicy is the policy configuration for querying data.- bytebase.v1.QueryDataPolicy.Restriction:- type: string- title: Restriction- enum:- - RESTRICTION_UNSPECIFIED- - FALLBACK- - DISALLOW- description: Restriction level for admin data source access.+ description: QueryDataPolicy is the policy configuration for querying data in the SQL Editor.bytebase.v1.QueryHistory:type: objectproperties:@@ -18456,6 +18455,15 @@ components:type: booleantitle: enable_debugdescription: Whether debug mode is enabled.+ sqlResultSize:+ type:+ - integer+ - string+ title: sql_result_size+ format: int64+ description: |-+ The maximum result size limit in bytes for query and export, works for the SQL Editor and Export Center.+ The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.title: WorkspaceProfileSettingadditionalProperties: falsebytebase.v1.WorkspaceProfileSetting.PasswordRestriction:diff --git a/backend/api/v1/org_policy_service.go b/backend/api/v1/org_policy_service.goindex 793ac8f9bb..b89f8c6941 100644--- a/backend/api/v1/org_policy_service.go+++ b/backend/api/v1/org_policy_service.go@@ -26,7 +26,7 @@ var (allowedResourceTypes = map[storepb.Policy_Type][]storepb.Policy_Resource{storepb.Policy_ROLLOUT: {storepb.Policy_ENVIRONMENT},storepb.Policy_TAG: {storepb.Policy_ENVIRONMENT, storepb.Policy_PROJECT},- storepb.Policy_QUERY_DATA: {storepb.Policy_WORKSPACE, storepb.Policy_ENVIRONMENT, storepb.Policy_PROJECT},+ storepb.Policy_QUERY_DATA: {storepb.Policy_WORKSPACE},storepb.Policy_MASKING_RULE: {storepb.Policy_WORKSPACE},storepb.Policy_MASKING_EXEMPTION: {storepb.Policy_PROJECT},}diff --git a/backend/api/v1/org_policy_service_converter.go b/backend/api/v1/org_policy_service_converter.goindex cd86625f92..267c62e4f0 100644--- a/backend/api/v1/org_policy_service_converter.go+++ b/backend/api/v1/org_policy_service_converter.go@@ -168,28 +168,26 @@ func convertToV1PBQueryDataPolicy(payloadStr string) (*v1pb.Policy_QueryDataPoli}return &v1pb.Policy_QueryDataPolicy{QueryDataPolicy: &v1pb.QueryDataPolicy{- Timeout: payload.Timeout,- DisableExport: payload.DisableExport,- MaximumResultSize: payload.MaximumResultSize,- MaximumResultRows: payload.MaximumResultRows,- DisableCopyData: payload.DisableCopyData,- AdminDataSourceRestriction: v1pb.QueryDataPolicy_Restriction(payload.AdminDataSourceRestriction),- DisallowDdl: payload.DisallowDdl,- DisallowDml: payload.DisallowDml,+ Timeout: payload.Timeout,+ DisableExport: payload.DisableExport,+ MaximumResultRows: payload.MaximumResultRows,+ DisableCopyData: payload.DisableCopyData,+ AllowAdminDataSource: payload.AllowAdminDataSource,+ DisallowDdl: payload.DisallowDdl,+ DisallowDml: payload.DisallowDml,},}, nil}func convertToQueryDataPolicyPayload(policy *v1pb.QueryDataPolicy) *storepb.QueryDataPolicy {return &storepb.QueryDataPolicy{- Timeout: policy.Timeout,- DisableExport: policy.DisableExport,- MaximumResultSize: policy.MaximumResultSize,- MaximumResultRows: policy.MaximumResultRows,- DisableCopyData: policy.DisableCopyData,- AdminDataSourceRestriction: storepb.QueryDataPolicy_Restriction(policy.AdminDataSourceRestriction),- DisallowDdl: policy.DisallowDdl,- DisallowDml: policy.DisallowDml,+ Timeout: policy.Timeout,+ DisableExport: policy.DisableExport,+ MaximumResultRows: policy.MaximumResultRows,+ DisableCopyData: policy.DisableCopyData,+ AllowAdminDataSource: policy.AllowAdminDataSource,+ DisallowDdl: policy.DisallowDdl,+ DisallowDml: policy.DisallowDml,}}diff --git a/backend/api/v1/setting_service.go b/backend/api/v1/setting_service.goindex 8dd3f57e4a..6e4e459311 100644--- a/backend/api/v1/setting_service.go+++ b/backend/api/v1/setting_service.go@@ -341,6 +341,8 @@ func (s *SettingService) UpdateSetting(ctx context.Context, request *connect.Reqreturn nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid password minimum length, should no less than 8"))}oldSetting.PasswordRestriction = payload.PasswordRestriction+ case "value.workspace_profile.sql_result_size":+ oldSetting.SqlResultSize = payload.SqlResultSizedefault:return nil, connect.NewError(connect.CodeInvalidArgument, errors.Errorf("invalid update mask path %v", path))}diff --git a/backend/api/v1/setting_service_converter.go b/backend/api/v1/setting_service_converter.goindex 32c5e783bb..a42b49c075 100644--- a/backend/api/v1/setting_service_converter.go+++ b/backend/api/v1/setting_service_converter.go@@ -254,6 +254,7 @@ func convertWorkspaceProfileSetting(v1Setting *v1pb.WorkspaceProfileSetting) *stBrandingLogo: v1Setting.BrandingLogo,PasswordRestriction: convertPasswordRestrictionSetting(v1Setting.PasswordRestriction),EnableDebug: v1Setting.EnableDebug,+ SqlResultSize: v1Setting.SqlResultSize,}// Convert announcement if present@@ -326,6 +327,7 @@ func convertToWorkspaceProfileSetting(storeSetting *storepb.WorkspaceProfileSettPasswordRestriction: convertToPasswordRestrictionSetting(storeSetting.PasswordRestriction),Announcement: convertToV1Announcement(storeSetting.Announcement),EnableDebug: storeSetting.EnableDebug,+ SqlResultSize: storeSetting.SqlResultSize,}}diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.goindex 0337c88e13..3b11b35452 100644--- a/backend/api/v1/sql_service.go+++ b/backend/api/v1/sql_service.go@@ -68,6 +68,9 @@ func NewSQLService(// AdminExecute executes the SQL statement.func (s *SQLService) AdminExecute(ctx context.Context, stream *connect.BidiStream[v1pb.AdminExecuteRequest, v1pb.AdminExecuteResponse]) error {+ if err := s.licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_SQL_EDITOR_ADMIN_MODE); err != nil {+ return connect.NewError(connect.CodePermissionDenied, err)+ }var driver db.Drivervar conn *sql.Connvar connectionName string@@ -119,7 +122,6 @@ func (s *SQLService) AdminExecute(ctx context.Context, stream *connect.BidiStreas.store,s.licenseService,request.Limit,- database.ProjectID,)queryContext := db.QueryContext{OperatorEmail: user.Email,@@ -212,7 +214,6 @@ func (s *SQLService) Query(ctx context.Context, req *connect.Request[v1pb.QueryRs.store,s.licenseService,request.Limit,- database.ProjectID,)queryContext := db.QueryContext{Explain: request.Explain,@@ -304,14 +305,13 @@ func getEffectiveQueryDataPolicy(stores *store.Store,licenseService *enterprise.LicenseService,limit int32,- projectID string,) *store.EffectiveQueryDataPolicy {value := &store.EffectiveQueryDataPolicy{MaximumResultSize: common.DefaultMaximumSQLResultSize,MaximumResultRows: math.MaxInt32,}if err := licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_QUERY_POLICY); err == nil {- policy, err := stores.GetEffectiveQueryDataPolicy(ctx, common.FormatProject(projectID))+ policy, err := stores.GetEffectiveQueryDataPolicy(ctx)if err != nil {slog.Error("failed to get the query data policy", log.BBError(err))return value@@ -1018,7 +1018,6 @@ func doExport(stores,licenseService,request.Limit,- database.ProjectID,)queryContext := db.QueryContext{Limit: int(queryRestriction.MaximumResultRows),@@ -1496,11 +1495,6 @@ func (s *SQLService) accessCheck(perm = permission.SQLSelectdefault:}- if span.Type == parserbase.DDL || span.Type == parserbase.DML {- if err := checkDataSourceQueryPolicy(ctx, s.store, s.licenseService, database, span.Type); err != nil {- return err- }- }} else if span.Type == parserbase.Select {perm = permission.SQLSelect}@@ -1721,19 +1715,6 @@ func (*SQLService) DiffMetadata(_ context.Context, req *connect.Request[v1pb.Dif}), nil}-// GetQueriableDataSource try to returns the RO data source, and will returns the admin data source if not exist the RO data source.-func GetQueriableDataSource(instance *store.InstanceMessage) *storepb.DataSource {- if len(instance.Metadata.GetDataSources()) == 0 {- return nil- }- for _, ds := range instance.Metadata.GetDataSources() {- if ds.GetType() == storepb.DataSourceType_READ_ONLY {- return ds- }- }- return instance.Metadata.DataSources[0]-}-func checkAndGetDataSourceQueriable(ctx context.Context,storeInstance *store.Store,@@ -1777,129 +1758,18 @@ func checkAndGetDataSourceQueriable(return dataSource, nil}- queryDataPolicyType := storepb.Policy_QUERY_DATA-- // get data source restriction policy for environment- var envAdminDataSourceRestriction v1pb.QueryDataPolicy_Restriction- effectiveEnvironmentID := ""- if database.EffectiveEnvironmentID != nil {- effectiveEnvironmentID = *database.EffectiveEnvironmentID- }- if effectiveEnvironmentID != "" {- environment, err := storeInstance.GetEnvironmentByID(ctx, effectiveEnvironmentID)- if err != nil {- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get environment %s with error %v", effectiveEnvironmentID, err.Error()))- }- if environment == nil {- return nil, connect.NewError(connect.CodeNotFound, errors.Errorf("environment %q not found", effectiveEnvironmentID))- }-- environmentResourceType := storepb.Policy_ENVIRONMENT- environmentResource := common.FormatEnvironment(environment.Id)- environmentPolicy, err := storeInstance.GetPolicy(ctx, &store.FindPolicyMessage{- ResourceType: &environmentResourceType,- Resource: &environmentResource,- Type: &queryDataPolicyType,- })- if err != nil {- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get environment query data policy with error: %v", err.Error()))- }- if environmentPolicy != nil {- envPayload, err := convertToV1PBQueryDataPolicy(environmentPolicy.Payload)- if err != nil {- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to convert environment query data policy payload with error: %v", err.Error()))- }- envAdminDataSourceRestriction = envPayload.QueryDataPolicy.GetAdminDataSourceRestriction()- }- }-- // get data source restriction policy for project- var projectAdminDataSourceRestriction v1pb.QueryDataPolicy_Restriction- projectResourceType := storepb.Policy_PROJECT- projectResource := common.FormatProject(database.ProjectID)- projectPolicy, err := storeInstance.GetPolicy(ctx, &store.FindPolicyMessage{- ResourceType: &projectResourceType,- Resource: &projectResource,- Type: &queryDataPolicyType,- })+ queryDataPolicy, err := storeInstance.GetEffectiveQueryDataPolicy(ctx)if err != nil {- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get project query data policy with error: %v", err.Error()))+ return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to get query data policy with error: %v", err.Error()))}- if projectPolicy != nil {- projectPayload, err := convertToV1PBQueryDataPolicy(projectPolicy.Payload)- if err != nil {- return nil, connect.NewError(connect.CodeInternal, errors.Errorf("failed to convert project query data policy payload with error: %v", err.Error()))- }- projectAdminDataSourceRestriction = projectPayload.QueryDataPolicy.GetAdminDataSourceRestriction()++ if queryDataPolicy.AllowAdminDataSource {+ return dataSource, nil}- // If any of the policy is DISALLOW, then return false.- if envAdminDataSourceRestriction == v1pb.QueryDataPolicy_DISALLOW || projectAdminDataSourceRestriction == v1pb.QueryDataPolicy_DISALLOW {+ ds := utils.DataSourceFromInstanceWithType(instance, storepb.DataSourceType_READ_ONLY)+ if ds != nil {return nil, connect.NewError(connect.CodePermissionDenied, errors.Errorf("data source %q is not queryable", dataSourceID))- } else if envAdminDataSourceRestriction == v1pb.QueryDataPolicy_FALLBACK || projectAdminDataSourceRestriction == v1pb.QueryDataPolicy_FALLBACK {- // If there is any read-only data source, then return false.- if ds := GetQueriableDataSource(instance); ds != nil && ds.Type == storepb.DataSourceType_READ_ONLY {- return nil, connect.NewError(connect.CodePermissionDenied, errors.Errorf("data source %q is not queryable", dataSourceID))- }}-return dataSource, nil}--func checkDataSourceQueryPolicy(ctx context.Context, storeInstance *store.Store, licenseService *enterprise.LicenseService, database *store.DatabaseMessage, statementTp parserbase.QueryType) error {- //nolint:nilerr- if err := licenseService.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_QUERY_POLICY); err != nil {- // If the feature is not enabled, then we don't need to check the policy.- // For license backward compatibility.- return nil- }- effectiveEnvironmentID := ""- if database.EffectiveEnvironmentID != nil {- effectiveEnvironmentID = *database.EffectiveEnvironmentID- }- if effectiveEnvironmentID == "" {- return connect.NewError(connect.CodeNotFound, errors.New("no effective environment found for database"))- }- environment, err := storeInstance.GetEnvironmentByID(ctx, effectiveEnvironmentID)- if err != nil {- return err- }- if environment == nil {- return connect.NewError(connect.CodeNotFound, errors.Errorf("environment %q not found", effectiveEnvironmentID))- }- resourceType := storepb.Policy_ENVIRONMENT- environmentResource := common.FormatEnvironment(environment.Id)- policyType := storepb.Policy_QUERY_DATA- queryDataPolicy, err := storeInstance.GetPolicy(ctx, &store.FindPolicyMessage{- ResourceType: &resourceType,- Resource: &environmentResource,- Type: &policyType,- })- if err != nil {- return err- }- if queryDataPolicy != nil {- policy := &v1pb.QueryDataPolicy{}- if err := common.ProtojsonUnmarshaler.Unmarshal([]byte(queryDataPolicy.Payload), policy); err != nil {- return connect.NewError(connect.CodeInternal, errors.Errorf("failed to unmarshal query data policy payload"))- }- switch statementTp {- case parserbase.DDL:- if policy.DisallowDdl {- return &queryError{- err: connect.NewError(connect.CodePermissionDenied, errors.Errorf("disallow execute DDL statement in environment %q", environment.Title)),- commandType: v1pb.QueryResult_PermissionDenied_DDL,- }- }- case parserbase.DML:- if policy.DisallowDml {- return &queryError{- err: connect.NewError(connect.CodePermissionDenied, errors.Errorf("disallow execute DML statement in environment %q", environment.Title)),- commandType: v1pb.QueryResult_PermissionDenied_DML,- }- }- default:- }- }- return nil-}diff --git a/backend/generated-go/store/policy.pb.go b/backend/generated-go/store/policy.pb.goindex 68f918c3d8..4b2afd3741 100644--- a/backend/generated-go/store/policy.pb.go+++ b/backend/generated-go/store/policy.pb.go@@ -136,57 +136,6 @@ func (Policy_Resource) EnumDescriptor() ([]byte, []int) {return file_store_policy_proto_rawDescGZIP(), []int{0, 1}}-type QueryDataPolicy_Restriction int32--const (- QueryDataPolicy_RESTRICTION_UNSPECIFIED QueryDataPolicy_Restriction = 0- // Allow to query admin data sources when there is no read-only data source.- QueryDataPolicy_FALLBACK QueryDataPolicy_Restriction = 1- // Disallow to query admin data sources.- QueryDataPolicy_DISALLOW QueryDataPolicy_Restriction = 2-)--// Enum value maps for QueryDataPolicy_Restriction.-var (- QueryDataPolicy_Restriction_name = map[int32]string{- 0: "RESTRICTION_UNSPECIFIED",- 1: "FALLBACK",- 2: "DISALLOW",- }- QueryDataPolicy_Restriction_value = map[string]int32{- "RESTRICTION_UNSPECIFIED": 0,- "FALLBACK": 1,- "DISALLOW": 2,- }-)--func (x QueryDataPolicy_Restriction) Enum() *QueryDataPolicy_Restriction {- p := new(QueryDataPolicy_Restriction)- *p = x- return p-}--func (x QueryDataPolicy_Restriction) String() string {- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))-}--func (QueryDataPolicy_Restriction) Descriptor() protoreflect.EnumDescriptor {- return file_store_policy_proto_enumTypes[2].Descriptor()-}--func (QueryDataPolicy_Restriction) Type() protoreflect.EnumType {- return &file_store_policy_proto_enumTypes[2]-}--func (x QueryDataPolicy_Restriction) Number() protoreflect.EnumNumber {- return protoreflect.EnumNumber(x)-}--// Deprecated: Use QueryDataPolicy_Restriction.Descriptor instead.-func (QueryDataPolicy_Restriction) EnumDescriptor() ([]byte, []int) {- return file_store_policy_proto_rawDescGZIP(), []int{7, 0}-}-type Policy struct {state protoimpl.MessageState `protogen:"open.v1"`unknownFields protoimpl.UnknownFields@@ -524,23 +473,27 @@ func (x *IamPolicy) GetBindings() []*Binding {return nil}-// QueryDataPolicy is the policy configuration for querying data.+// QueryDataPolicy is the policy configuration for querying data in the SQL Editor.type QueryDataPolicy struct {state protoimpl.MessageState `protogen:"open.v1"`+ // workspace-level policy// The query timeout duration.Timeout *durationpb.Duration `protobuf:"bytes,1,opt,name=timeout,proto3" json:"timeout,omitempty"`+ // workspace-level policy// Disable exporting data in the SQL editor.DisableExport bool `protobuf:"varint,2,opt,name=disable_export,json=disableExport,proto3" json:"disable_export,omitempty"`- // The size limit in bytes.- // The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.- MaximumResultSize int64 `protobuf:"varint,3,opt,name=maximum_result_size,json=maximumResultSize,proto3" json:"maximum_result_size,omitempty"`+ // workspace-level policy// The return rows limit.// The default value is -1, means no limit.MaximumResultRows int32 `protobuf:"varint,4,opt,name=maximum_result_rows,json=maximumResultRows,proto3" json:"maximum_result_rows,omitempty"`+ // workspace-level policy// Disable copying data.DisableCopyData bool `protobuf:"varint,5,opt,name=disable_copy_data,json=disableCopyData,proto3" json:"disable_copy_data,omitempty"`- // Restriction for admin data source queries.- AdminDataSourceRestriction QueryDataPolicy_Restriction `protobuf:"varint,6,opt,name=admin_data_source_restriction,json=adminDataSourceRestriction,proto3,enum=bytebase.store.QueryDataPolicy_Restriction" json:"admin_data_source_restriction,omitempty"`+ // workspace-level policy+ // Allow using the admin data source to query in the SQL editor.+ AllowAdminDataSource bool `protobuf:"varint,9,opt,name=allow_admin_data_source,json=allowAdminDataSource,proto3" json:"allow_admin_data_source,omitempty"`+ // ================+ // Deprecate following fields.// Disallow running DDL statements in the SQL editor.DisallowDdl bool `protobuf:"varint,7,opt,name=disallow_ddl,json=disallowDdl,proto3" json:"disallow_ddl,omitempty"`// Disallow running DML statements in the SQL editor.@@ -593,13 +546,6 @@ func (x *QueryDataPolicy) GetDisableExport() bool {return false}-func (x *QueryDataPolicy) GetMaximumResultSize() int64 {- if x != nil {- return x.MaximumResultSize- }- return 0-}-func (x *QueryDataPolicy) GetMaximumResultRows() int32 {if x != nil {return x.MaximumResultRows@@ -614,11 +560,11 @@ func (x *QueryDataPolicy) GetDisableCopyData() bool {return false}-func (x *QueryDataPolicy) GetAdminDataSourceRestriction() QueryDataPolicy_Restriction {+func (x *QueryDataPolicy) GetAllowAdminDataSource() bool {if x != nil {- return x.AdminDataSourceRestriction+ return x.AllowAdminDataSource}- return QueryDataPolicy_RESTRICTION_UNSPECIFIED+ return false}func (x *QueryDataPolicy) GetDisallowDdl() bool {@@ -813,20 +759,15 @@ const file_store_policy_proto_rawDesc = "" +"\amembers\x18\x02 \x03(\tR\amembers\x12/\n" +"\tcondition\x18\x03 \x01(\v2\x11.google.type.ExprR\tcondition\"@\n" +"\tIamPolicy\x123\n" +- "\bbindings\x18\x01 \x03(\v2\x17.bytebase.store.BindingR\bbindings\"\xf7\x03\n" ++ "\bbindings\x18\x01 \x03(\v2\x17.bytebase.store.BindingR\bbindings\"\xcc\x02\n" +"\x0fQueryDataPolicy\x123\n" +"\atimeout\x18\x01 \x01(\v2\x19.google.protobuf.DurationR\atimeout\x12%\n" +"\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\x12n\n" +- "\x1dadmin_data_source_restriction\x18\x06 \x01(\x0e2+.bytebase.store.QueryDataPolicy.RestrictionR\x1aadminDataSourceRestriction\x12!\n" ++ "\x11disable_copy_data\x18\x05 \x01(\bR\x0fdisableCopyData\x125\n" ++ "\x17allow_admin_data_source\x18\t \x01(\bR\x14allowAdminDataSource\x12!\n" +"\fdisallow_ddl\x18\a \x01(\bR\vdisallowDdl\x12!\n" +- "\fdisallow_dml\x18\b \x01(\bR\vdisallowDml\"F\n" +- "\vRestriction\x12\x1b\n" +- "\x17RESTRICTION_UNSPECIFIED\x10\x00\x12\f\n" +- "\bFALLBACK\x10\x01\x12\f\n" +- "\bDISALLOW\x10\x02B\x8e\x01\n" ++ "\fdisallow_dml\x18\b \x01(\bR\vdisallowDmlJ\x04\b\x03\x10\x04B\x8e\x01\n" +"\x12com.bytebase.storeB\vPolicyProtoP\x01Z\x12generated-go/store\xa2\x02\x03BSX\xaa\x02\x0eBytebase.Store\xca\x02\x0eBytebase\\Store\xe2\x02\x1aBytebase\\Store\\GPBMetadata\xea\x02\x0fBytebase::Storeb\x06proto3"var (@@ -841,41 +782,39 @@ func file_store_policy_proto_rawDescGZIP() []byte {return file_store_policy_proto_rawDescData}-var file_store_policy_proto_enumTypes = make([]protoimpl.EnumInfo, 3)+var file_store_policy_proto_enumTypes = make([]protoimpl.EnumInfo, 2)var file_store_policy_proto_msgTypes = make([]protoimpl.MessageInfo, 11)var file_store_policy_proto_goTypes = []any{(Policy_Type)(0), // 0: bytebase.store.Policy.Type(Policy_Resource)(0), // 1: bytebase.store.Policy.Resource- (QueryDataPolicy_Restriction)(0), // 2: bytebase.store.QueryDataPolicy.Restriction- (*Policy)(nil), // 3: bytebase.store.Policy- (*RolloutPolicy)(nil), // 4: bytebase.store.RolloutPolicy- (*MaskingExemptionPolicy)(nil), // 5: bytebase.store.MaskingExemptionPolicy- (*MaskingRulePolicy)(nil), // 6: bytebase.store.MaskingRulePolicy- (*TagPolicy)(nil), // 7: bytebase.store.TagPolicy- (*Binding)(nil), // 8: bytebase.store.Binding- (*IamPolicy)(nil), // 9: bytebase.store.IamPolicy- (*QueryDataPolicy)(nil), // 10: bytebase.store.QueryDataPolicy- (*MaskingExemptionPolicy_Exemption)(nil), // 11: bytebase.store.MaskingExemptionPolicy.Exemption- (*MaskingRulePolicy_MaskingRule)(nil), // 12: bytebase.store.MaskingRulePolicy.MaskingRule- nil, // 13: bytebase.store.TagPolicy.TagsEntry- (*expr.Expr)(nil), // 14: google.type.Expr- (*durationpb.Duration)(nil), // 15: google.protobuf.Duration+ (*Policy)(nil), // 2: bytebase.store.Policy+ (*RolloutPolicy)(nil), // 3: bytebase.store.RolloutPolicy+ (*MaskingExemptionPolicy)(nil), // 4: bytebase.store.MaskingExemptionPolicy+ (*MaskingRulePolicy)(nil), // 5: bytebase.store.MaskingRulePolicy+ (*TagPolicy)(nil), // 6: bytebase.store.TagPolicy+ (*Binding)(nil), // 7: bytebase.store.Binding+ (*IamPolicy)(nil), // 8: bytebase.store.IamPolicy+ (*QueryDataPolicy)(nil), // 9: bytebase.store.QueryDataPolicy+ (*MaskingExemptionPolicy_Exemption)(nil), // 10: bytebase.store.MaskingExemptionPolicy.Exemption+ (*MaskingRulePolicy_MaskingRule)(nil), // 11: bytebase.store.MaskingRulePolicy.MaskingRule+ nil, // 12: bytebase.store.TagPolicy.TagsEntry+ (*expr.Expr)(nil), // 13: google.type.Expr+ (*durationpb.Duration)(nil), // 14: google.protobuf.Duration}var file_store_policy_proto_depIdxs = []int32{- 11, // 0: bytebase.store.MaskingExemptionPolicy.exemptions:type_name -> bytebase.store.MaskingExemptionPolicy.Exemption- 12, // 1: bytebase.store.MaskingRulePolicy.rules:type_name -> bytebase.store.MaskingRulePolicy.MaskingRule- 13, // 2: bytebase.store.TagPolicy.tags:type_name -> bytebase.store.TagPolicy.TagsEntry- 14, // 3: bytebase.store.Binding.condition:type_name -> google.type.Expr- 8, // 4: bytebase.store.IamPolicy.bindings:type_name -> bytebase.store.Binding- 15, // 5: bytebase.store.QueryDataPolicy.timeout:type_name -> google.protobuf.Duration- 2, // 6: bytebase.store.QueryDataPolicy.admin_data_source_restriction:type_name -> bytebase.store.QueryDataPolicy.Restriction- 14, // 7: bytebase.store.MaskingExemptionPolicy.Exemption.condition:type_name -> google.type.Expr- 14, // 8: bytebase.store.MaskingRulePolicy.MaskingRule.condition:type_name -> google.type.Expr- 9, // [9:9] is the sub-list for method output_type- 9, // [9:9] is the sub-list for method input_type- 9, // [9:9] is the sub-list for extension type_name- 9, // [9:9] is the sub-list for extension extendee- 0, // [0:9] is the sub-list for field type_name+ 10, // 0: bytebase.store.MaskingExemptionPolicy.exemptions:type_name -> bytebase.store.MaskingExemptionPolicy.Exemption+ 11, // 1: bytebase.store.MaskingRulePolicy.rules:type_name -> bytebase.store.MaskingRulePolicy.MaskingRule+ 12, // 2: bytebase.store.TagPolicy.tags:type_name -> bytebase.store.TagPolicy.TagsEntry+ 13, // 3: bytebase.store.Binding.condition:type_name -> google.type.Expr+ 7, // 4: bytebase.store.IamPolicy.bindings:type_name -> bytebase.store.Binding+ 14, // 5: bytebase.store.QueryDataPolicy.timeout:type_name -> google.protobuf.Duration+ 13, // 6: bytebase.store.MaskingExemptionPolicy.Exemption.condition:type_name -> google.type.Expr+ 13, // 7: bytebase.store.MaskingRulePolicy.MaskingRule.condition:type_name -> google.type.Expr+ 8, // [8:8] is the sub-list for method output_type+ 8, // [8:8] is the sub-list for method input_type+ 8, // [8:8] is the sub-list for extension type_name+ 8, // [8:8] is the sub-list for extension extendee+ 0, // [0:8] is the sub-list for field type_name}func init() { file_store_policy_proto_init() }@@ -888,7 +827,7 @@ func file_store_policy_proto_init() {File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_store_policy_proto_rawDesc), len(file_store_policy_proto_rawDesc)),- NumEnums: 3,+ NumEnums: 2,NumMessages: 11,NumExtensions: 0,NumServices: 0,diff --git a/backend/generated-go/store/policy_equal.pb.go b/backend/generated-go/store/policy_equal.pb.goindex 03e4016f4e..3ab2680341 100644--- a/backend/generated-go/store/policy_equal.pb.go+++ b/backend/generated-go/store/policy_equal.pb.go@@ -198,16 +198,13 @@ func (x *QueryDataPolicy) Equal(y *QueryDataPolicy) bool {if x.DisableExport != y.DisableExport {return false}- if x.MaximumResultSize != y.MaximumResultSize {- return false- }if x.MaximumResultRows != y.MaximumResultRows {return false}if x.DisableCopyData != y.DisableCopyData {return false}- if x.AdminDataSourceRestriction != y.AdminDataSourceRestriction {+ if x.AllowAdminDataSource != y.AllowAdminDataSource {return false}if x.DisallowDdl != y.DisallowDdl {diff --git a/backend/generated-go/store/setting.pb.go b/backend/generated-go/store/setting.pb.goindex ef16d90f9f..bbab75b4fa 100644--- a/backend/generated-go/store/setting.pb.go+++ b/backend/generated-go/store/setting.pb.go@@ -459,7 +459,10 @@ type WorkspaceProfileSetting struct {// The duration for access token. Default is 1 hour.AccessTokenDuration *durationpb.Duration `protobuf:"bytes,18,opt,name=access_token_duration,json=accessTokenDuration,proto3" json:"access_token_duration,omitempty"`// Whether debug mode is enabled.- EnableDebug bool `protobuf:"varint,19,opt,name=enable_debug,json=enableDebug,proto3" json:"enable_debug,omitempty"`+ EnableDebug bool `protobuf:"varint,19,opt,name=enable_debug,json=enableDebug,proto3" json:"enable_debug,omitempty"`+ // The maximum result size limit in bytes for query and export, works for the SQL Editor and Export Center.+ // The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.+ SqlResultSize int64 `protobuf:"varint,20,opt,name=sql_result_size,json=sqlResultSize,proto3" json:"sql_result_size,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}@@ -627,6 +630,13 @@ func (x *WorkspaceProfileSetting) GetEnableDebug() bool {return false}+func (x *WorkspaceProfileSetting) GetSqlResultSize() int64 {+ if x != nil {+ return x.SqlResultSize+ }+ return 0+}+type WorkspaceApprovalSetting struct {state protoimpl.MessageState `protogen:"open.v1"`Rules []*WorkspaceApprovalSetting_Rule `protobuf:"bytes,1,rep,name=rules,proto3" json:"rules,omitempty"`@@ -2395,7 +2405,7 @@ const file_store_setting_proto_rawDesc = "" +"\vauth_secret\x18\x01 \x01(\tR\n" +"authSecret\x12!\n" +"\fworkspace_id\x18\x02 \x01(\tR\vworkspaceId\x12\x18\n" +- "\alicense\x18\x03 \x01(\tR\alicense\"\xe7\x0e\n" ++ "\alicense\x18\x03 \x01(\tR\alicense\"\x8f\x0f\n" +"\x17WorkspaceProfileSetting\x12!\n" +"\fexternal_url\x18\x01 \x01(\tR\vexternalUrl\x12'\n" +"\x0fdisallow_signup\x18\x02 \x01(\bR\x0edisallowSignup\x12\x1f\n" +@@ -2417,7 +2427,8 @@ const file_store_setting_proto_rawDesc = "" +"\rbranding_logo\x18\x10 \x01(\tR\fbrandingLogo\x12n\n" +"\x14password_restriction\x18\x11 \x01(\v2;.bytebase.store.WorkspaceProfileSetting.PasswordRestrictionR\x13passwordRestriction\x12M\n" +"\x15access_token_duration\x18\x12 \x01(\v2\x19.google.protobuf.DurationR\x13accessTokenDuration\x12!\n" +- "\fenable_debug\x18\x13 \x01(\bR\venableDebug\x1a\xdd\x01\n" ++ "\fenable_debug\x18\x13 \x01(\bR\venableDebug\x12&\n" ++ "\x0fsql_result_size\x18\x14 \x01(\x03R\rsqlResultSize\x1a\xdd\x01\n" +"\fAnnouncement\x12U\n" +"\x05level\x18\x01 \x01(\x0e2?.bytebase.store.WorkspaceProfileSetting.Announcement.AlertLevelR\x05level\x12\x12\n" +"\x04text\x18\x02 \x01(\tR\x04text\x12\x12\n" +diff --git a/backend/generated-go/store/setting_equal.pb.go b/backend/generated-go/store/setting_equal.pb.goindex 3d0e346c9a..caad8481ae 100644--- a/backend/generated-go/store/setting_equal.pb.go+++ b/backend/generated-go/store/setting_equal.pb.go@@ -146,6 +146,9 @@ func (x *WorkspaceProfileSetting) Equal(y *WorkspaceProfileSetting) bool {if x.EnableDebug != y.EnableDebug {return false}+ if x.SqlResultSize != y.SqlResultSize {+ return false+ }return true}diff --git a/backend/generated-go/v1/org_policy_service.pb.go b/backend/generated-go/v1/org_policy_service.pb.goindex c2f16a4346..d5a09b5b6a 100644--- a/backend/generated-go/v1/org_policy_service.pb.go+++ b/backend/generated-go/v1/org_policy_service.pb.go@@ -148,59 +148,6 @@ func (PolicyResourceType) EnumDescriptor() ([]byte, []int) {return file_v1_org_policy_service_proto_rawDescGZIP(), []int{1}}-// Restriction level for admin data source access.-type QueryDataPolicy_Restriction int32--const (- // Unspecified restriction.- QueryDataPolicy_RESTRICTION_UNSPECIFIED QueryDataPolicy_Restriction = 0- // Allow querying admin data sources when there is no read-only data source.- QueryDataPolicy_FALLBACK QueryDataPolicy_Restriction = 1- // Disallow querying admin data sources.- QueryDataPolicy_DISALLOW QueryDataPolicy_Restriction = 2-)--// Enum value maps for QueryDataPolicy_Restriction.-var (- QueryDataPolicy_Restriction_name = map[int32]string{- 0: "RESTRICTION_UNSPECIFIED",- 1: "FALLBACK",- 2: "DISALLOW",- }- QueryDataPolicy_Restriction_value = map[string]int32{- "RESTRICTION_UNSPECIFIED": 0,- "FALLBACK": 1,- "DISALLOW": 2,- }-)--func (x QueryDataPolicy_Restriction) Enum() *QueryDataPolicy_Restriction {- p := new(QueryDataPolicy_Restriction)- *p = x- return p-}--func (x QueryDataPolicy_Restriction) String() string {- return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))-}--func (QueryDataPolicy_Restriction) Descriptor() protoreflect.EnumDescriptor {- return file_v1_org_policy_service_proto_enumTypes[2].Descriptor()-}--func (QueryDataPolicy_Restriction) Type() protoreflect.EnumType {- return &file_v1_org_policy_service_proto_enumTypes[2]-}--func (x QueryDataPolicy_Restriction) Number() protoreflect.EnumNumber {- return protoreflect.EnumNumber(x)-}--// Deprecated: Use QueryDataPolicy_Restriction.Descriptor instead.-func (QueryDataPolicy_Restriction) EnumDescriptor() ([]byte, []int) {- return file_v1_org_policy_service_proto_rawDescGZIP(), []int{8, 0}-}-type CreatePolicyRequest struct {state protoimpl.MessageState `protogen:"open.v1"`// The parent resource where this instance will be created.@@ -781,23 +728,31 @@ func (x *RolloutPolicy) GetRoles() []string {return nil}-// QueryDataPolicy is the policy configuration for querying data.+// QueryDataPolicy is the policy configuration for querying data in the SQL Editor.type QueryDataPolicy struct {state protoimpl.MessageState `protogen:"open.v1"`- // The query timeout duration.+ // workspace-level policy+ // The query timeout duration in the SQL editor.Timeout *durationpb.Duration `protobuf:"bytes,1,opt,name=timeout,proto3" json:"timeout,omitempty"`- // Disable data export in the SQL editor.- DisableExport bool `protobuf:"varint,2,opt,name=disable_export,json=disableExport,proto3" json:"disable_export,omitempty"`- // The maximum result size limit in bytes.- // The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.- MaximumResultSize int64 `protobuf:"varint,3,opt,name=maximum_result_size,json=maximumResultSize,proto3" json:"maximum_result_size,omitempty"`- // The maximum number of rows to return.+ // workspace-level policy+ // The maximum number of rows to return in the SQL editor.// The default value is -1, means no limit.- MaximumResultRows int32 `protobuf:"varint,4,opt,name=maximum_result_rows,json=maximumResultRows,proto3" json:"maximum_result_rows,omitempty"`- // Disable copying query results.- DisableCopyData bool `protobuf:"varint,5,opt,name=disable_copy_data,json=disableCopyData,proto3" json:"disable_copy_data,omitempty"`- // Restriction for admin data source queries.- AdminDataSourceRestriction QueryDataPolicy_Restriction `protobuf:"varint,6,opt,name=admin_data_source_restriction,json=adminDataSourceRestriction,proto3,enum=bytebase.v1.QueryDataPolicy_Restriction" json:"admin_data_source_restriction,omitempty"`+ MaximumResultRows int32 `protobuf:"varint,2,opt,name=maximum_result_rows,json=maximumResultRows,proto3" json:"maximum_result_rows,omitempty"`+ // workspace-level policy+ // Disable data export in the SQL editor.+ DisableExport bool `protobuf:"varint,3,opt,name=disable_export,json=disableExport,proto3" json:"disable_export,omitempty"`+ // workspace-level policy+ // Disable copying query results in the SQL editor.+ DisableCopyData bool `protobuf:"varint,4,opt,name=disable_copy_data,json=disableCopyData,proto3" json:"disable_copy_data,omitempty"`+ // workspace-level policy+ // Allow using the admin data source to query in the SQL editor.+ // If true, users can select the admin data source or read-only data source+ // If false,+ // 1. when read-only data source is configured, users're force to use the read-only data source+ // 2. otherwise fallback to use the admin data source.+ AllowAdminDataSource bool `protobuf:"varint,5,opt,name=allow_admin_data_source,json=allowAdminDataSource,proto3" json:"allow_admin_data_source,omitempty"`+ // ================+ // Deprecate following fields.// Disallow running DDL statements in the SQL editor.DisallowDdl bool `protobuf:"varint,7,opt,name=disallow_ddl,json=disallowDdl,proto3" json:"disallow_ddl,omitempty"`// Disallow running DML statements in the SQL editor.@@ -843,25 +798,18 @@ func (x *QueryDataPolicy) GetTimeout() *durationpb.Duration {return nil}-func (x *QueryDataPolicy) GetDisableExport() bool {- if x != nil {- return x.DisableExport- }- return false-}--func (x *QueryDataPolicy) GetMaximumResultSize() int64 {+func (x *QueryDataPolicy) GetMaximumResultRows() int32 {if x != nil {- return x.MaximumResultSize+ return x.MaximumResultRows}return 0}-func (x *QueryDataPolicy) GetMaximumResultRows() int32 {+func (x *QueryDataPolicy) GetDisableExport() bool {if x != nil {- return x.MaximumResultRows+ return x.DisableExport}- return 0+ return false}func (x *QueryDataPolicy) GetDisableCopyData() bool {@@ -871,11 +819,11 @@ func (x *QueryDataPolicy) GetDisableCopyData() bool {return false}-func (x *QueryDataPolicy) GetAdminDataSourceRestriction() QueryDataPolicy_Restriction {+func (x *QueryDataPolicy) GetAllowAdminDataSource() bool {if x != nil {- return x.AdminDataSourceRestriction+ return x.AllowAdminDataSource}- return QueryDataPolicy_RESTRICTION_UNSPECIFIED+ return false}func (x *QueryDataPolicy) GetDisallowDdl() bool {@@ -1232,20 +1180,15 @@ const file_v1_org_policy_service_proto_rawDesc = "" +"\x06policy\"C\n" +"\rRolloutPolicy\x12\x1c\n" +"\tautomatic\x18\x01 \x01(\bR\tautomatic\x12\x14\n" +- "\x05roles\x18\x02 \x03(\tR\x05roles\"\xf4\x03\n" ++ "\x05roles\x18\x02 \x03(\tR\x05roles\"\xc6\x02\n" +"\x0fQueryDataPolicy\x123\n" +- "\atimeout\x18\x01 \x01(\v2\x19.google.protobuf.DurationR\atimeout\x12%\n" +- "\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\x12k\n" +- "\x1dadmin_data_source_restriction\x18\x06 \x01(\x0e2(.bytebase.v1.QueryDataPolicy.RestrictionR\x1aadminDataSourceRestriction\x12!\n" ++ "\atimeout\x18\x01 \x01(\v2\x19.google.protobuf.DurationR\atimeout\x12.\n" ++ "\x13maximum_result_rows\x18\x02 \x01(\x05R\x11maximumResultRows\x12%\n" ++ "\x0edisable_export\x18\x03 \x01(\bR\rdisableExport\x12*\n" ++ "\x11disable_copy_data\x18\x04 \x01(\bR\x0fdisableCopyData\x125\n" ++ "\x17allow_admin_data_source\x18\x05 \x01(\bR\x14allowAdminDataSource\x12!\n" +"\fdisallow_ddl\x18\a \x01(\bR\vdisallowDdl\x12!\n" +- "\fdisallow_dml\x18\b \x01(\bR\vdisallowDml\"F\n" +- "\vRestriction\x12\x1b\n" +- "\x17RESTRICTION_UNSPECIFIED\x10\x00\x12\f\n" +- "\bFALLBACK\x10\x01\x12\f\n" +- "\bDISALLOW\x10\x02\"\xbf\x01\n" ++ "\fdisallow_dml\x18\b \x01(\bR\vdisallowDml\"\xbf\x01\n" +"\x16MaskingExemptionPolicy\x12M\n" +"\n" +"exemptions\x18\x01 \x03(\v2-.bytebase.v1.MaskingExemptionPolicy.ExemptionR\n" +@@ -1298,68 +1241,66 @@ func file_v1_org_policy_service_proto_rawDescGZIP() []byte {return file_v1_org_policy_service_proto_rawDescData}-var file_v1_org_policy_service_proto_enumTypes = make([]protoimpl.EnumInfo, 3)+var file_v1_org_policy_service_proto_enumTypes = make([]protoimpl.EnumInfo, 2)var file_v1_org_policy_service_proto_msgTypes = make([]protoimpl.MessageInfo, 15)var file_v1_org_policy_service_proto_goTypes = []any{(PolicyType)(0), // 0: bytebase.v1.PolicyType(PolicyResourceType)(0), // 1: bytebase.v1.PolicyResourceType- (QueryDataPolicy_Restriction)(0), // 2: bytebase.v1.QueryDataPolicy.Restriction- (*CreatePolicyRequest)(nil), // 3: bytebase.v1.CreatePolicyRequest- (*UpdatePolicyRequest)(nil), // 4: bytebase.v1.UpdatePolicyRequest- (*DeletePolicyRequest)(nil), // 5: bytebase.v1.DeletePolicyRequest- (*GetPolicyRequest)(nil), // 6: bytebase.v1.GetPolicyRequest- (*ListPoliciesRequest)(nil), // 7: bytebase.v1.ListPoliciesRequest- (*ListPoliciesResponse)(nil), // 8: bytebase.v1.ListPoliciesResponse- (*Policy)(nil), // 9: bytebase.v1.Policy- (*RolloutPolicy)(nil), // 10: bytebase.v1.RolloutPolicy- (*QueryDataPolicy)(nil), // 11: bytebase.v1.QueryDataPolicy- (*MaskingExemptionPolicy)(nil), // 12: bytebase.v1.MaskingExemptionPolicy- (*MaskingRulePolicy)(nil), // 13: bytebase.v1.MaskingRulePolicy- (*TagPolicy)(nil), // 14: bytebase.v1.TagPolicy- (*MaskingExemptionPolicy_Exemption)(nil), // 15: bytebase.v1.MaskingExemptionPolicy.Exemption- (*MaskingRulePolicy_MaskingRule)(nil), // 16: bytebase.v1.MaskingRulePolicy.MaskingRule- nil, // 17: bytebase.v1.TagPolicy.TagsEntry- (*fieldmaskpb.FieldMask)(nil), // 18: google.protobuf.FieldMask- (*durationpb.Duration)(nil), // 19: google.protobuf.Duration- (*expr.Expr)(nil), // 20: google.type.Expr- (*emptypb.Empty)(nil), // 21: google.protobuf.Empty+ (*CreatePolicyRequest)(nil), // 2: bytebase.v1.CreatePolicyRequest+ (*UpdatePolicyRequest)(nil), // 3: bytebase.v1.UpdatePolicyRequest+ (*DeletePolicyRequest)(nil), // 4: bytebase.v1.DeletePolicyRequest+ (*GetPolicyRequest)(nil), // 5: bytebase.v1.GetPolicyRequest+ (*ListPoliciesRequest)(nil), // 6: bytebase.v1.ListPoliciesRequest+ (*ListPoliciesResponse)(nil), // 7: bytebase.v1.ListPoliciesResponse+ (*Policy)(nil), // 8: bytebase.v1.Policy+ (*RolloutPolicy)(nil), // 9: bytebase.v1.RolloutPolicy+ (*QueryDataPolicy)(nil), // 10: bytebase.v1.QueryDataPolicy+ (*MaskingExemptionPolicy)(nil), // 11: bytebase.v1.MaskingExemptionPolicy+ (*MaskingRulePolicy)(nil), // 12: bytebase.v1.MaskingRulePolicy+ (*TagPolicy)(nil), // 13: bytebase.v1.TagPolicy+ (*MaskingExemptionPolicy_Exemption)(nil), // 14: bytebase.v1.MaskingExemptionPolicy.Exemption+ (*MaskingRulePolicy_MaskingRule)(nil), // 15: bytebase.v1.MaskingRulePolicy.MaskingRule+ nil, // 16: bytebase.v1.TagPolicy.TagsEntry+ (*fieldmaskpb.FieldMask)(nil), // 17: google.protobuf.FieldMask+ (*durationpb.Duration)(nil), // 18: google.protobuf.Duration+ (*expr.Expr)(nil), // 19: google.type.Expr+ (*emptypb.Empty)(nil), // 20: google.protobuf.Empty}var file_v1_org_policy_service_proto_depIdxs = []int32{- 9, // 0: bytebase.v1.CreatePolicyRequest.policy:type_name -> bytebase.v1.Policy+ 8, // 0: bytebase.v1.CreatePolicyRequest.policy:type_name -> bytebase.v1.Policy0, // 1: bytebase.v1.CreatePolicyRequest.type:type_name -> bytebase.v1.PolicyType- 9, // 2: bytebase.v1.UpdatePolicyRequest.policy:type_name -> bytebase.v1.Policy- 18, // 3: bytebase.v1.UpdatePolicyRequest.update_mask:type_name -> google.protobuf.FieldMask+ 8, // 2: bytebase.v1.UpdatePolicyRequest.policy:type_name -> bytebase.v1.Policy+ 17, // 3: bytebase.v1.UpdatePolicyRequest.update_mask:type_name -> google.protobuf.FieldMask0, // 4: bytebase.v1.ListPoliciesRequest.policy_type:type_name -> bytebase.v1.PolicyType- 9, // 5: bytebase.v1.ListPoliciesResponse.policies:type_name -> bytebase.v1.Policy+ 8, // 5: bytebase.v1.ListPoliciesResponse.policies:type_name -> bytebase.v1.Policy0, // 6: bytebase.v1.Policy.type:type_name -> bytebase.v1.PolicyType- 10, // 7: bytebase.v1.Policy.rollout_policy:type_name -> bytebase.v1.RolloutPolicy- 13, // 8: bytebase.v1.Policy.masking_rule_policy:type_name -> bytebase.v1.MaskingRulePolicy- 12, // 9: bytebase.v1.Policy.masking_exemption_policy:type_name -> bytebase.v1.MaskingExemptionPolicy- 14, // 10: bytebase.v1.Policy.tag_policy:type_name -> bytebase.v1.TagPolicy- 11, // 11: bytebase.v1.Policy.query_data_policy:type_name -> bytebase.v1.QueryDataPolicy+ 9, // 7: bytebase.v1.Policy.rollout_policy:type_name -> bytebase.v1.RolloutPolicy+ 12, // 8: bytebase.v1.Policy.masking_rule_policy:type_name -> bytebase.v1.MaskingRulePolicy+ 11, // 9: bytebase.v1.Policy.masking_exemption_policy:type_name -> bytebase.v1.MaskingExemptionPolicy+ 13, // 10: bytebase.v1.Policy.tag_policy:type_name -> bytebase.v1.TagPolicy+ 10, // 11: bytebase.v1.Policy.query_data_policy:type_name -> bytebase.v1.QueryDataPolicy1, // 12: bytebase.v1.Policy.resource_type:type_name -> bytebase.v1.PolicyResourceType- 19, // 13: bytebase.v1.QueryDataPolicy.timeout:type_name -> google.protobuf.Duration- 2, // 14: bytebase.v1.QueryDataPolicy.admin_data_source_restriction:type_name -> bytebase.v1.QueryDataPolicy.Restriction- 15, // 15: bytebase.v1.MaskingExemptionPolicy.exemptions:type_name -> bytebase.v1.MaskingExemptionPolicy.Exemption- 16, // 16: bytebase.v1.MaskingRulePolicy.rules:type_name -> bytebase.v1.MaskingRulePolicy.MaskingRule- 17, // 17: bytebase.v1.TagPolicy.tags:type_name -> bytebase.v1.TagPolicy.TagsEntry- 20, // 18: bytebase.v1.MaskingExemptionPolicy.Exemption.condition:type_name -> google.type.Expr- 20, // 19: bytebase.v1.MaskingRulePolicy.MaskingRule.condition:type_name -> google.type.Expr- 6, // 20: bytebase.v1.OrgPolicyService.GetPolicy:input_type -> bytebase.v1.GetPolicyRequest- 7, // 21: bytebase.v1.OrgPolicyService.ListPolicies:input_type -> bytebase.v1.ListPoliciesRequest- 3, // 22: bytebase.v1.OrgPolicyService.CreatePolicy:input_type -> bytebase.v1.CreatePolicyRequest- 4, // 23: bytebase.v1.OrgPolicyService.UpdatePolicy:input_type -> bytebase.v1.UpdatePolicyRequest- 5, // 24: bytebase.v1.OrgPolicyService.DeletePolicy:input_type -> bytebase.v1.DeletePolicyRequest- 9, // 25: bytebase.v1.OrgPolicyService.GetPolicy:output_type -> bytebase.v1.Policy- 8, // 26: bytebase.v1.OrgPolicyService.ListPolicies:output_type -> bytebase.v1.ListPoliciesResponse- 9, // 27: bytebase.v1.OrgPolicyService.CreatePolicy:output_type -> bytebase.v1.Policy- 9, // 28: bytebase.v1.OrgPolicyService.UpdatePolicy:output_type -> bytebase.v1.Policy- 21, // 29: bytebase.v1.OrgPolicyService.DeletePolicy:output_type -> google.protobuf.Empty- 25, // [25:30] is the sub-list for method output_type- 20, // [20:25] is the sub-list for method input_type- 20, // [20:20] is the sub-list for extension type_name- 20, // [20:20] is the sub-list for extension extendee- 0, // [0:20] is the sub-list for field type_name+ 18, // 13: bytebase.v1.QueryDataPolicy.timeout:type_name -> google.protobuf.Duration+ 14, // 14: bytebase.v1.MaskingExemptionPolicy.exemptions:type_name -> bytebase.v1.MaskingExemptionPolicy.Exemption+ 15, // 15: bytebase.v1.MaskingRulePolicy.rules:type_name -> bytebase.v1.MaskingRulePolicy.MaskingRule+ 16, // 16: bytebase.v1.TagPolicy.tags:type_name -> bytebase.v1.TagPolicy.TagsEntry+ 19, // 17: bytebase.v1.MaskingExemptionPolicy.Exemption.condition:type_name -> google.type.Expr+ 19, // 18: bytebase.v1.MaskingRulePolicy.MaskingRule.condition:type_name -> google.type.Expr+ 5, // 19: bytebase.v1.OrgPolicyService.GetPolicy:input_type -> bytebase.v1.GetPolicyRequest+ 6, // 20: bytebase.v1.OrgPolicyService.ListPolicies:input_type -> bytebase.v1.ListPoliciesRequest+ 2, // 21: bytebase.v1.OrgPolicyService.CreatePolicy:input_type -> bytebase.v1.CreatePolicyRequest+ 3, // 22: bytebase.v1.OrgPolicyService.UpdatePolicy:input_type -> bytebase.v1.UpdatePolicyRequest+ 4, // 23: bytebase.v1.OrgPolicyService.DeletePolicy:input_type -> bytebase.v1.DeletePolicyRequest+ 8, // 24: bytebase.v1.OrgPolicyService.GetPolicy:output_type -> bytebase.v1.Policy+ 7, // 25: bytebase.v1.OrgPolicyService.ListPolicies:output_type -> bytebase.v1.ListPoliciesResponse+ 8, // 26: bytebase.v1.OrgPolicyService.CreatePolicy:output_type -> bytebase.v1.Policy+ 8, // 27: bytebase.v1.OrgPolicyService.UpdatePolicy:output_type -> bytebase.v1.Policy+ 20, // 28: bytebase.v1.OrgPolicyService.DeletePolicy:output_type -> google.protobuf.Empty+ 24, // [24:29] is the sub-list for method output_type+ 19, // [19:24] is the sub-list for method input_type+ 19, // [19:19] is the sub-list for extension type_name+ 19, // [19:19] is the sub-list for extension extendee+ 0, // [0:19] is the sub-list for field type_name}func init() { file_v1_org_policy_service_proto_init() }@@ -1381,7 +1322,7 @@ func file_v1_org_policy_service_proto_init() {File: protoimpl.DescBuilder{GoPackagePath: reflect.TypeOf(x{}).PkgPath(),RawDescriptor: unsafe.Slice(unsafe.StringData(file_v1_org_policy_service_proto_rawDesc), len(file_v1_org_policy_service_proto_rawDesc)),- NumEnums: 3,+ NumEnums: 2,NumMessages: 15,NumExtensions: 0,NumServices: 1,diff --git a/backend/generated-go/v1/org_policy_service_equal.pb.go b/backend/generated-go/v1/org_policy_service_equal.pb.goindex 9e1ba29468..a58b99857a 100644--- a/backend/generated-go/v1/org_policy_service_equal.pb.go+++ b/backend/generated-go/v1/org_policy_service_equal.pb.go@@ -185,19 +185,16 @@ func (x *QueryDataPolicy) Equal(y *QueryDataPolicy) bool {if p, q := x.Timeout, y.Timeout; (p == nil && q != nil) || (p != nil && (q == nil || p.Seconds != q.Seconds || p.Nanos != q.Nanos)) {return false}- if x.DisableExport != y.DisableExport {- return false- }- if x.MaximumResultSize != y.MaximumResultSize {+ if x.MaximumResultRows != y.MaximumResultRows {return false}- if x.MaximumResultRows != y.MaximumResultRows {+ if x.DisableExport != y.DisableExport {return false}if x.DisableCopyData != y.DisableCopyData {return false}- if x.AdminDataSourceRestriction != y.AdminDataSourceRestriction {+ if x.AllowAdminDataSource != y.AllowAdminDataSource {return false}if x.DisallowDdl != y.DisallowDdl {diff --git a/backend/generated-go/v1/setting_service.pb.go b/backend/generated-go/v1/setting_service.pb.goindex 05960caedc..5c7c0d30fd 100644--- a/backend/generated-go/v1/setting_service.pb.go+++ b/backend/generated-go/v1/setting_service.pb.go@@ -902,7 +902,10 @@ type WorkspaceProfileSetting struct {// The duration for access token. Default is 1 hour.AccessTokenDuration *durationpb.Duration `protobuf:"bytes,18,opt,name=access_token_duration,json=accessTokenDuration,proto3" json:"access_token_duration,omitempty"`// Whether debug mode is enabled.- EnableDebug bool `protobuf:"varint,19,opt,name=enable_debug,json=enableDebug,proto3" json:"enable_debug,omitempty"`+ EnableDebug bool `protobuf:"varint,19,opt,name=enable_debug,json=enableDebug,proto3" json:"enable_debug,omitempty"`+ // The maximum result size limit in bytes for query and export, works for the SQL Editor and Export Center.+ // The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.+ SqlResultSize int64 `protobuf:"varint,20,opt,name=sql_result_size,json=sqlResultSize,proto3" json:"sql_result_size,omitempty"`unknownFields protoimpl.UnknownFieldssizeCache protoimpl.SizeCache}@@ -1070,6 +1073,13 @@ func (x *WorkspaceProfileSetting) GetEnableDebug() bool {return false}+func (x *WorkspaceProfileSetting) GetSqlResultSize() int64 {+ if x != nil {+ return x.SqlResultSize+ }+ return 0+}+type Announcement struct {state protoimpl.MessageState `protogen:"open.v1"`// The alert level of announcement@@ -2889,7 +2899,7 @@ const file_v1_setting_service_proto_rawDesc = "" +"\x04lark\x18\x05 \x01(\v2\x1e.bytebase.v1.AppIMSetting.LarkH\x00R\x04lark\x12@\n" +"\bdingtalk\x18\x06 \x01(\v2\".bytebase.v1.AppIMSetting.DingTalkH\x00R\bdingtalk\x127\n" +"\x05teams\x18\a \x01(\v2\x1f.bytebase.v1.AppIMSetting.TeamsH\x00R\x05teamsB\t\n" +- "\apayload\"\xf8\v\n" ++ "\apayload\"\xa0\f\n" +"\x17WorkspaceProfileSetting\x12!\n" +"\fexternal_url\x18\x01 \x01(\tR\vexternalUrl\x12'\n" +"\x0fdisallow_signup\x18\x02 \x01(\bR\x0edisallowSignup\x12\x1f\n" +@@ -2911,7 +2921,8 @@ const file_v1_setting_service_proto_rawDesc = "" +"\rbranding_logo\x18\x10 \x01(\tR\fbrandingLogo\x12k\n" +"\x14password_restriction\x18\x11 \x01(\v28.bytebase.v1.WorkspaceProfileSetting.PasswordRestrictionR\x13passwordRestriction\x12M\n" +"\x15access_token_duration\x18\x12 \x01(\v2\x19.google.protobuf.DurationR\x13accessTokenDuration\x12!\n" +- "\fenable_debug\x18\x13 \x01(\bR\venableDebug\x1a\x93\x03\n" ++ "\fenable_debug\x18\x13 \x01(\bR\venableDebug\x12&\n" ++ "\x0fsql_result_size\x18\x14 \x01(\x03R\rsqlResultSize\x1a\x93\x03\n" +"\x13PasswordRestriction\x12\x1d\n" +"\n" +"min_length\x18\x01 \x01(\x05R\tminLength\x12%\n" +diff --git a/backend/generated-go/v1/setting_service_equal.pb.go b/backend/generated-go/v1/setting_service_equal.pb.goindex 89897b34fc..6c78ae95ce 100644--- a/backend/generated-go/v1/setting_service_equal.pb.go+++ b/backend/generated-go/v1/setting_service_equal.pb.go@@ -387,6 +387,9 @@ func (x *WorkspaceProfileSetting) Equal(y *WorkspaceProfileSetting) bool {if x.EnableDebug != y.EnableDebug {return false}+ if x.SqlResultSize != y.SqlResultSize {+ return false+ }return true}diff --git a/backend/migrator/migration/3.15/0003##move_maximum_result_size_to_workspace_profile.sql b/backend/migrator/migration/3.15/0003##move_maximum_result_size_to_workspace_profile.sqlnew file mode 100644index 0000000000..2f79cde026--- /dev/null+++ b/backend/migrator/migration/3.15/0003##move_maximum_result_size_to_workspace_profile.sql@@ -0,0 +1,33 @@+-- Move maximum_result_size from QUERY_DATA policy to WORKSPACE_PROFILE setting+-- This migration moves the data export result size limit from the workspace-level+-- QUERY_DATA policy to the WORKSPACE_PROFILE setting (as sqlResultSize)++-- Step 1: Update or insert WORKSPACE_PROFILE setting with the maximumResultSize from QUERY_DATA policy+WITH max_result_size AS (+ SELECT (payload->>'maximumResultSize')::bigint AS size+ FROM policy+ WHERE resource_type = 'WORKSPACE'+ AND type = 'QUERY_DATA'+ AND payload ? 'maximumResultSize'+ AND payload->>'maximumResultSize' IS NOT NULL+ LIMIT 1+)+INSERT INTO setting (name, value)+SELECT+ 'WORKSPACE_PROFILE',+ jsonb_build_object('sqlResultSize', max_result_size.size)+FROM max_result_size+ON CONFLICT (name)+DO UPDATE SET+ value = CASE+ WHEN setting.value IS NULL OR setting.value = '{}'::jsonb THEN+ jsonb_build_object('sqlResultSize', (SELECT size FROM max_result_size))+ ELSE+ setting.value || jsonb_build_object('sqlResultSize', (SELECT size FROM max_result_size))+ END;++-- Step 2: Remove maximumResultSize field from all QUERY_DATA policies+UPDATE policy+SET payload = payload - 'maximumResultSize'+WHERE type = 'QUERY_DATA'+ AND payload ? 'maximumResultSize';diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.goindex 895687c5c8..3b00835d2b 100644--- a/backend/migrator/migrator_test.go+++ b/backend/migrator/migrator_test.go@@ -12,8 +12,8 @@ import (func TestLatestVersion(t *testing.T) {files, err := getSortedVersionedFiles()require.NoError(t, err)- require.Equal(t, semver.MustParse("3.15.2"), *files[len(files)-1].version)- require.Equal(t, "migration/3.15/0002##add_category_to_release.sql", files[len(files)-1].path)+ require.Equal(t, semver.MustParse("3.15.3"), *files[len(files)-1].version)+ require.Equal(t, "migration/3.15/0003##move_maximum_result_size_to_workspace_profile.sql", files[len(files)-1].path)}func TestVersionUnique(t *testing.T) {diff --git a/backend/runner/taskrun/data_export_executor.go b/backend/runner/taskrun/data_export_executor.goindex 84ff5b6540..f968da3e9d 100644--- a/backend/runner/taskrun/data_export_executor.go+++ b/backend/runner/taskrun/data_export_executor.go@@ -7,13 +7,11 @@ import ("fmt""io""log/slog"- "math""strings""time""github.com/alexmullins/zip""github.com/pkg/errors"- "google.golang.org/protobuf/types/known/durationpb"apiv1 "github.com/bytebase/bytebase/backend/api/v1""github.com/bytebase/bytebase/backend/common"@@ -25,6 +23,7 @@ import (v1pb "github.com/bytebase/bytebase/backend/generated-go/v1""github.com/bytebase/bytebase/backend/plugin/db""github.com/bytebase/bytebase/backend/store"+ "github.com/bytebase/bytebase/backend/utils")// NewDataExportExecutor creates a data export task executor.@@ -92,7 +91,7 @@ func (exec *DataExportExecutor) RunOnce(ctx context.Context, _ context.Context,}statement := sheet.Statement- dataSource := apiv1.GetQueriableDataSource(instance)+ dataSource := utils.DataSourceFromInstanceWithType(instance, storepb.DataSourceType_ADMIN)creatorUser, err := exec.store.GetUserByEmail(ctx, issue.CreatorEmail)if err != nil {return nil, errors.Wrapf(err, "failed to get creator user for issue %d", issue.UID)@@ -161,18 +160,12 @@ func (exec *DataExportExecutor) executeExport(}// 2. Get query restrictions from workspace policy- queryRestriction := exec.getEffectiveQueryDataPolicy(ctx, database.ProjectID)+ maximumSQLResultSize := exec.getSQLResultSizeLimit(ctx)// 3. Build query context with limitsqueryContext := db.QueryContext{- Limit: int(queryRestriction.MaximumResultRows),OperatorEmail: user.Email,- MaximumSQLResultSize: queryRestriction.MaximumResultSize,- }- if queryRestriction.MaxQueryTimeoutInSeconds > 0 {- queryContext.Timeout = &durationpb.Duration{- Seconds: queryRestriction.MaxQueryTimeoutInSeconds,- }+ MaximumSQLResultSize: maximumSQLResultSize,}// 4. Execute query with timeout@@ -203,27 +196,16 @@ func (exec *DataExportExecutor) executeExport(return exec.formatAndZipResults(ctx, results, instance, database, format, statement)}-// getEffectiveQueryDataPolicy gets the effective query data policy for a project.-func (exec *DataExportExecutor) getEffectiveQueryDataPolicy(+// getSQLResultSizeLimit gets the sql result size limit.+func (exec *DataExportExecutor) getSQLResultSizeLimit(ctx context.Context,- projectID string,-) *store.EffectiveQueryDataPolicy {- value := &store.EffectiveQueryDataPolicy{- MaximumResultSize: common.DefaultMaximumSQLResultSize,- MaximumResultRows: math.MaxInt32,- }- if err := exec.license.IsFeatureEnabled(v1pb.PlanFeature_FEATURE_QUERY_POLICY); err == nil {- policy, err := exec.store.GetEffectiveQueryDataPolicy(ctx, common.FormatProject(projectID))- if err != nil {- slog.Error("failed to get the query data policy", log.BBError(err))- return value- }- value = policy- }- if value.MaximumResultRows == math.MaxInt32 {- value.MaximumResultRows = 0+) int64 {+ maximumResultSize, err := exec.store.GetSQLResultSize(ctx)+ if err != nil {+ slog.Error("failed to get the query data policy", log.BBError(err))+ return common.DefaultMaximumSQLResultSize}- return value+ return maximumResultSize}// formatAndZipResults formats query results and packages them into a ZIP archive.diff --git a/backend/store/policy.go b/backend/store/policy.goindex 898cc0b704..cfb87ee91b 100644--- a/backend/store/policy.go+++ b/backend/store/policy.go@@ -203,21 +203,15 @@ func (s *Store) GetRolloutPolicy(ctx context.Context, environment string) (*stor}type EffectiveQueryDataPolicy struct {- MaximumResultSize int64- MaximumResultRows int32- DisableCopyData bool- DisableExport bool- MaxQueryTimeoutInSeconds int64- AdminDataSourceRestriction storepb.QueryDataPolicy_Restriction- DisallowDDL bool- DisallowDML bool+ MaximumResultSize int64+ MaximumResultRows int32+ DisableCopyData bool+ DisableExport bool+ MaxQueryTimeoutInSeconds int64+ AllowAdminDataSource bool}func formatEffectiveQueryDataPolicy(policy *storepb.QueryDataPolicy) *EffectiveQueryDataPolicy {- maximumResultSize := policy.GetMaximumResultSize()- if maximumResultSize <= 0 {- maximumResultSize = common.DefaultMaximumSQLResultSize- }maximumResultRows := policy.GetMaximumResultRows()if maximumResultRows <= 0 {maximumResultRows = math.MaxInt32@@ -228,49 +222,34 @@ func formatEffectiveQueryDataPolicy(policy *storepb.QueryDataPolicy) *EffectiveQ}return &EffectiveQueryDataPolicy{- MaximumResultSize: maximumResultSize,- MaximumResultRows: maximumResultRows,- MaxQueryTimeoutInSeconds: timeoutInSeconds,- DisableCopyData: policy.GetDisableCopyData(),- DisableExport: policy.GetDisableExport(),- AdminDataSourceRestriction: policy.GetAdminDataSourceRestriction(),- DisallowDDL: policy.GetDisallowDdl(),- DisallowDML: policy.GetDisallowDml(),+ MaximumResultRows: maximumResultRows,+ MaxQueryTimeoutInSeconds: timeoutInSeconds,+ DisableCopyData: policy.GetDisableCopyData(),+ DisableExport: policy.GetDisableExport(),+ AllowAdminDataSource: policy.GetAllowAdminDataSource(),}}-func (s *Store) GetEffectiveQueryDataPolicy(ctx context.Context, project string) (*EffectiveQueryDataPolicy, error) {- projectPolicy, err := s.getQueryDataPolicy(ctx, project)- if err != nil {- return nil, err- }+func (s *Store) GetEffectiveQueryDataPolicy(ctx context.Context) (*EffectiveQueryDataPolicy, error) {workspacePolicy, err := s.getQueryDataPolicy(ctx, "")if err != nil {return nil, err}- formatPorjectPolicy := formatEffectiveQueryDataPolicy(projectPolicy)formatWorkspacePolicy := formatEffectiveQueryDataPolicy(workspacePolicy)- maximumResultSize := min(formatPorjectPolicy.MaximumResultSize, formatWorkspacePolicy.MaximumResultSize)- maximumResultRows := min(formatPorjectPolicy.MaximumResultRows, formatWorkspacePolicy.MaximumResultRows)- maximumTimeout := min(formatPorjectPolicy.MaxQueryTimeoutInSeconds, formatWorkspacePolicy.MaxQueryTimeoutInSeconds)-- // For AdminDataSourceRestriction, project policy takes precedence over workspace- adminRestriction := formatPorjectPolicy.AdminDataSourceRestriction- if adminRestriction == storepb.QueryDataPolicy_RESTRICTION_UNSPECIFIED {- adminRestriction = formatWorkspacePolicy.AdminDataSourceRestriction+ maximumResultSize, err := s.GetSQLResultSize(ctx)+ if err != nil {+ return nil, err}return &EffectiveQueryDataPolicy{- DisableCopyData: formatPorjectPolicy.DisableCopyData || formatWorkspacePolicy.DisableCopyData,- DisableExport: formatPorjectPolicy.DisableExport || formatWorkspacePolicy.DisableExport,- MaximumResultSize: maximumResultSize,- MaximumResultRows: maximumResultRows,- MaxQueryTimeoutInSeconds: maximumTimeout,- AdminDataSourceRestriction: adminRestriction,- DisallowDDL: formatPorjectPolicy.DisallowDDL || formatWorkspacePolicy.DisallowDDL,- DisallowDML: formatPorjectPolicy.DisallowDML || formatWorkspacePolicy.DisallowDML,+ DisableCopyData: formatWorkspacePolicy.DisableCopyData,+ DisableExport: formatWorkspacePolicy.DisableExport,+ MaximumResultRows: formatWorkspacePolicy.MaximumResultRows,+ MaximumResultSize: maximumResultSize,+ MaxQueryTimeoutInSeconds: formatWorkspacePolicy.MaxQueryTimeoutInSeconds,+ AllowAdminDataSource: formatWorkspacePolicy.AllowAdminDataSource,}, nil}diff --git a/backend/store/setting.go b/backend/store/setting.goindex 71c376a76f..a2fbefede8 100644--- a/backend/store/setting.go+++ b/backend/store/setting.go@@ -42,6 +42,19 @@ func getSettingMessage(name storepb.SettingName) (proto.Message, error) {}}+// GetSQLResultSize gets the valid data_export_result_size from the workspace profile setting.+func (s *Store) GetSQLResultSize(ctx context.Context) (int64, error) {+ workspaceProfile, err := s.GetWorkspaceProfileSetting(ctx)+ if err != nil {+ return 0, err+ }+ maximumResultSize := workspaceProfile.GetSqlResultSize()+ if maximumResultSize <= 0 {+ maximumResultSize = common.DefaultMaximumSQLResultSize+ }+ return maximumResultSize, nil+}+// GetWorkspaceProfileSetting gets the workspace profile setting payload.func (s *Store) GetWorkspaceProfileSetting(ctx context.Context) (*storepb.WorkspaceProfileSetting, error) {setting, err := s.GetSetting(ctx, storepb.SettingName_WORKSPACE_PROFILE)diff --git a/backend/tests/sql_stop_on_error_test.go b/backend/tests/sql_stop_on_error_test.goindex eccd34b313..8e57236932 100644--- a/backend/tests/sql_stop_on_error_test.go+++ b/backend/tests/sql_stop_on_error_test.go@@ -88,28 +88,6 @@ func TestSQLQueryStopOnError(t *testing.T) {wantError: true,wantSyntaxError: true,},- {- name: "MySQL - Non-read-only command in Query API",- databaseName: "TestStopOnError8",- dbType: storepb.Engine_MYSQL,- environment: "test",- prepareStatements: "CREATE TABLE tbl8(id INT PRIMARY KEY);",- query: "INSERT INTO tbl8 VALUES(1);",- wantResults: 1, // Error result- wantError: true,- wantPermissionDenied: true,- },- {- name: "PostgreSQL - Non-read-only command in Query API",- databaseName: "TestStopOnError9",- dbType: storepb.Engine_POSTGRES,- environment: "test",- prepareStatements: "CREATE TABLE tbl9(id INT PRIMARY KEY);",- query: "INSERT INTO tbl9 VALUES(1);",- wantResults: 1, // Error result- wantError: true,- wantPermissionDenied: true,- },}t.Parallel()@@ -187,20 +165,6 @@ func TestSQLQueryStopOnError(t *testing.T) {a.NoError(err)pgTestInstance := pgTestInstanceResp.Msg- // Set up test environment policy to disallow DML- _, err = ctl.orgPolicyServiceClient.CreatePolicy(ctx, connect.NewRequest(&v1pb.CreatePolicyRequest{- Parent: "environments/test",- Policy: &v1pb.Policy{- Type: v1pb.PolicyType_DATA_QUERY,- Policy: &v1pb.Policy_QueryDataPolicy{- QueryDataPolicy: &v1pb.QueryDataPolicy{- DisallowDml: true,- },- },- },- }))- a.NoError(err)-for _, tt := range tests {t.Run(tt.name, func(t *testing.T) {t.Parallel()diff --git a/backend/tests/subscription.go b/backend/tests/subscription.goindex 5df042e331..9d7ef78a8e 100644--- a/backend/tests/subscription.go+++ b/backend/tests/subscription.go@@ -13,7 +13,7 @@ func (ctl *controller) setLicense(ctx context.Context) error {if _, err := ctl.subscriptionServiceClient.UpdateSubscription(ctx, connect.NewRequest(&v1pb.UpdateSubscriptionRequest{License: "eyJhbGciOiJSUzI1NiIsImtpZCI6InYxIiwidHlwIjoiSldUIn0.eyJpbnN0YW5jZUNvdW50Ijo5OTksInRyaWFsaW5nIjpmYWxzZSwicGxhbiI6IkVOVEVSUFJJU0UiLCJvcmdOYW1lIjoiYmIiLCJhdWQiOiJiYi5saWNlbnNlIiwiZXhwIjo3OTc0OTc5MjAwLCJpYXQiOjE2NjM2Njc1NjEsImlzcyI6ImJ5dGViYXNlIiwic3ViIjoiMDAwMDEwMDAuIn0.JjYCMeAAMB9FlVeDFLdN3jvFcqtPsbEzaIm1YEDhUrfekthCbIOeX_DB2Bg2OUji3HSX5uDvG9AkK4Gtrc4gLMPI3D5mk3L-6wUKZ0L4REztS47LT4oxVhpqPQayYa9lKJB1YoHaqeMV4Z5FXeOXwuACoELznlwpT6pXo9xXm_I6QwQiO7-zD83XOTO4PRjByc-q3GKQu_64zJMIKiCW0I8a3GvrdSnO7jUuYU1KPmCuk0ZRq3I91m29LTo478BMST59HqCLj1GGuCKtR3SL_376XsZfUUM0iSAur5scg99zNGWRj-sUo05wbAadYx6V6TKaWrBUi_8_0RnJyP5gbA",})); err != nil {- return errors.Wrap(err, "failed to remove license")+ return errors.Wrap(err, "failed to set license")}return nil}diff --git a/frontend/src/components/EnvironmentForm/AccessControlConfigure.vue b/frontend/src/components/EnvironmentForm/AccessControlConfigure.vuedeleted file mode 100644index c9f7fbf8ec..0000000000--- a/frontend/src/components/EnvironmentForm/AccessControlConfigure.vue+++ /dev/null@@ -1,282 +0,0 @@-<template>- <div v-if="hasGetPermission" class="flex flex-col gap-y-2">- <div class="font-medium flex items-center gap-x-2">- <label>- {{ t("environment.access-control.title") }}- </label>- <NTooltip v-if="tooltip">- <template #trigger>- <CircleQuestionMarkIcon class="w-4 textinfolabel" />- </template>- <span>- {{ tooltip }}- </span>- </NTooltip>- </div>- <div class="flex flex-col gap-y-2">- <div class="w-full inline-flex items-center gap-x-2">- <PermissionGuardWrapper- v-slot="slotProps"- :project="project"- :permissions="[- 'bb.policies.update'- ]"- >- <Switch- v-model:value="state.disableCopyData"- :text="true"- :disabled="slotProps.disabled || !hasRestrictCopyingDataFeature"- />- </PermissionGuardWrapper>- <span class="textlabel">- {{ t("environment.access-control.disable-copy-data-from-sql-editor") }}- </span>- <FeatureBadge :feature="PlanFeature.FEATURE_RESTRICT_COPYING_DATA" />- </div>- <div class="">- <div class="w-full inline-flex items-center gap-x-2">- <PermissionGuardWrapper- v-slot="slotProps"- :project="project"- :permissions="[- 'bb.policies.update'- ]"- >- <Switch- :value="adminDataSourceQueryRestrictionEnabled"- :text="true"- :disabled="slotProps.disabled || !hasRestrictQueryDataSourceFeature"- @update:value="switchAdminDataSourceRestriction"- />- </PermissionGuardWrapper>- <span class="textlabel">{{- t("environment.access-control.restrict-admin-connection.self")- }}</span>- <FeatureBadge :feature="PlanFeature.FEATURE_QUERY_POLICY" />- </div>- <div v-if="adminDataSourceQueryRestrictionEnabled" class="ml-12">- <PermissionGuardWrapper- v-slot="slotProps"- :project="project"- :permissions="[- 'bb.policies.update'- ]"- >- <NRadioGroup- v-model:value="- state.adminDataSourceRestriction- "- :disabled="slotProps.disabled || !hasRestrictQueryDataSourceFeature"- >- <NRadio- class="w-full"- :value="QueryDataPolicy_Restriction.DISALLOW"- >- {{- t(- "environment.access-control.restrict-admin-connection.disallow"- )- }}- </NRadio>- <NRadio- class="w-full"- :value="QueryDataPolicy_Restriction.FALLBACK"- >- {{- t(- "environment.access-control.restrict-admin-connection.fallback"- )- }}- </NRadio>- </NRadioGroup>- </PermissionGuardWrapper>- </div>- </div>- </div>- </div>- <div- v-if="resource.startsWith(environmentNamePrefix) && hasGetPermission"- class="flex flex-col gap-y-2"- >- <div class="font-medium flex items-center gap-x-2">- <label>- {{ t("environment.statement-execution.title") }}- </label>- <FeatureBadge :feature="PlanFeature.FEATURE_QUERY_POLICY" />- </div>- <div class="flex flex-col gap-y-2">- <div class="w-full inline-flex items-center gap-x-2">- <PermissionGuardWrapper- v-slot="slotProps"- :project="project"- :permissions="[- 'bb.policies.update'- ]"- >- <Switch- v-model:value="state.disallowDdl"- :text="true"- :disabled="slotProps.disabled || !hasRestrictQueryDataSourceFeature"- />- </PermissionGuardWrapper>- <span class="textlabel">- {{ t("environment.statement-execution.disallow-ddl") }}- </span>- </div>- <div class="w-full inline-flex items-center gap-x-2">- <PermissionGuardWrapper- v-slot="slotProps"- :project="project"- :permissions="[- 'bb.policies.update'- ]"- >- <Switch- v-model:value="state.disallowDml"- :text="true"- :disabled="slotProps.disabled || !hasRestrictQueryDataSourceFeature"- />- </PermissionGuardWrapper>- <span class="textlabel">- {{ t("environment.statement-execution.disallow-dml") }}- </span>- </div>- </div>- </div>-</template>--<script setup lang="ts">-import { cloneDeep, isEqual } from "lodash-es";-import { CircleQuestionMarkIcon } from "lucide-vue-next";-import { NRadio, NRadioGroup, NTooltip } from "naive-ui";-import { computed, reactive, watchEffect } from "vue";-import { useI18n } from "vue-i18n";-import PermissionGuardWrapper from "@/components/Permission/PermissionGuardWrapper.vue";-import { hasFeature, usePolicyV1Store, useProjectV1Store } from "@/store";-import {- environmentNamePrefix,- projectNamePrefix,-} from "@/store/modules/v1/common";-import { isValidProjectName } from "@/types";-import type { QueryDataPolicy } from "@/types/proto-es/v1/org_policy_service_pb";-import {- PolicyType,- QueryDataPolicy_Restriction,-} from "@/types/proto-es/v1/org_policy_service_pb";-import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { hasProjectPermissionV2, hasWorkspacePermissionV2 } from "@/utils";-import { FeatureBadge } from "../FeatureGuard";-import { Switch } from "../v2";--const { t } = useI18n();--const props = defineProps<{- resource: string;-}>();--const projectStore = useProjectV1Store();--const project = computed(() => {- if (props.resource.startsWith(projectNamePrefix)) {- const proj = projectStore.getProjectByName(props.resource);- if (!isValidProjectName(proj.name)) {- return undefined;- }- return proj;- }- return undefined;-});--const hasGetPermission = computed(() => {- if (project.value) {- return hasProjectPermissionV2(project.value, "bb.policies.get");- }- return hasWorkspacePermissionV2("bb.policies.get");-});--const tooltip = computed(() => {- if (project.value) {- return t("settings.general.workspace.query-data-policy.tooltip", {- scope: t(- "settings.general.workspace.query-data-policy.environment-scope"- ),- });- }- return t("settings.general.workspace.query-data-policy.tooltip", {- scope: t("settings.general.workspace.query-data-policy.project-scope"),- });-});--const policyStore = usePolicyV1Store();--const getInitialState = (): QueryDataPolicy => {- const policy = policyStore.getQueryDataPolicyByParent(props.resource);- return cloneDeep(policy);-};--const state = reactive<QueryDataPolicy>(getInitialState());--watchEffect(async () => {- if (!hasGetPermission.value) {- return;- }- await policyStore.getOrFetchPolicyByParentAndType({- parentPath: props.resource,- policyType: PolicyType.DATA_QUERY,- });-- Object.assign(state, getInitialState());-});--const adminDataSourceQueryRestrictionEnabled = computed(() => {- return (- state.adminDataSourceRestriction &&- [- QueryDataPolicy_Restriction.DISALLOW,- QueryDataPolicy_Restriction.FALLBACK,- ].includes(state.adminDataSourceRestriction)- );-});--const hasRestrictQueryDataSourceFeature = computed(() =>- hasFeature(PlanFeature.FEATURE_QUERY_POLICY)-);--const hasRestrictCopyingDataFeature = computed(() =>- hasFeature(PlanFeature.FEATURE_RESTRICT_COPYING_DATA)-);--const updateQueryDataPolicy = async () => {- await policyStore.upsertPolicy({- parentPath: props.resource,- policy: {- type: PolicyType.DATA_QUERY,- policy: {- case: "queryDataPolicy",- value: {- ...state,- },- },- },- });-};--const switchAdminDataSourceRestriction = (on: boolean) => {- state.adminDataSourceRestriction = on- ? QueryDataPolicy_Restriction.DISALLOW- : QueryDataPolicy_Restriction.RESTRICTION_UNSPECIFIED;-};--defineExpose({- isDirty: computed(() => !isEqual(state, getInitialState())),- update: async () => {- const initialState = getInitialState();- if (!isEqual(state, initialState)) {- await updateQueryDataPolicy();- }- },- revert: () => {- Object.assign(state, getInitialState());- },-});-</script>diff --git a/frontend/src/components/EnvironmentForm/Buttons.vue b/frontend/src/components/EnvironmentForm/Buttons.vueindex e9b253cb7f..1e8d2f50f5 100644--- a/frontend/src/components/EnvironmentForm/Buttons.vue+++ b/frontend/src/components/EnvironmentForm/Buttons.vue@@ -54,7 +54,6 @@ const {const revertEnvironment = () => {state.value.environment = cloneDeep(environment.value);state.value.rolloutPolicy = cloneDeep(rolloutPolicy.value);- events.emit("revert-access-control");events.emit("revert-sql-review");};@@ -80,7 +79,6 @@ const updateEnvironment = () => {});}- events.emit("update-access-control");events.emit("update-sql-review");const env = cloneDeep(environment.value);diff --git a/frontend/src/components/EnvironmentForm/Form.vue b/frontend/src/components/EnvironmentForm/Form.vueindex 02bce10efb..64a35864dd 100644--- a/frontend/src/components/EnvironmentForm/Form.vue+++ b/frontend/src/components/EnvironmentForm/Form.vue@@ -109,12 +109,6 @@ref="sqlReviewForResourceRef":resource="`${environmentNamePrefix}${environment.id}`"/>-- <AccessControlConfigure- v-if="features.includes('ACCESS_CONTROL') && !create"- ref="accessControlConfigureRef"- :resource="`${environmentNamePrefix}${environment.id}`"- /></div><div@@ -178,7 +172,6 @@ import { hasWorkspacePermissionV2 } from "@/utils";import { FeatureBadge } from "../FeatureGuard";import SQLReviewForResource from "../SQLReview/components/SQLReviewForResource.vue";import { ResourceIdField } from "../v2";-import AccessControlConfigure from "./AccessControlConfigure.vue";import { useEnvironmentFormContext } from "./context";import RolloutPolicyConfig from "./RolloutPolicyConfig.vue";@@ -219,8 +212,6 @@ const hasGetPolicyPermission = computed(() => {return hasWorkspacePermissionV2("bb.policies.get");});-const accessControlConfigureRef =- ref<InstanceType<typeof AccessControlConfigure>>();const sqlReviewForResourceRef =ref<InstanceType<typeof SQLReviewForResource>>();@@ -236,14 +227,11 @@ const getEnvironmentById = (id: string) => {};watch(- () => [- accessControlConfigureRef.value?.isDirty ?? false,- sqlReviewForResourceRef.value?.isDirty ?? false,- ],- ([d1, d2]) => {- if (d1 || d2) {+ () => sqlReviewForResourceRef.value?.isDirty ?? false,+ (isDirty) => {+ if (isDirty) {state.value.policyChanged = true;- } else if (!d1 && !d2) {+ } else {state.value.policyChanged = false;}}@@ -346,19 +334,12 @@ const deleteEnvironment = () => {events.emit("delete", state.value.environment);};-useEmitteryEventListener(events, "update-access-control", async () => {- if (accessControlConfigureRef.value?.isDirty) {- await accessControlConfigureRef.value.update();- }-});-useEmitteryEventListener(events, "revert-access-control", () => {- accessControlConfigureRef.value?.revert();-});useEmitteryEventListener(events, "update-sql-review", async () => {if (sqlReviewForResourceRef.value?.isDirty) {await sqlReviewForResourceRef.value.update();}});+useEmitteryEventListener(events, "revert-sql-review", () => {sqlReviewForResourceRef.value?.revert();});diff --git a/frontend/src/components/EnvironmentForm/context.ts b/frontend/src/components/EnvironmentForm/context.tsindex 59a00ba291..cf7c487442 100644--- a/frontend/src/components/EnvironmentForm/context.ts+++ b/frontend/src/components/EnvironmentForm/context.ts@@ -39,8 +39,6 @@ export const provideEnvironmentFormContext = (baseContext: {policyType: PolicyType;policy: Policy;};- "update-access-control": undefined;- "revert-access-control": undefined;"update-sql-review": undefined;"revert-sql-review": undefined;delete: Environment;diff --git a/frontend/src/components/GeneralSetting/MaximumSQLResultSizeSetting.vue b/frontend/src/components/GeneralSetting/MaximumSQLResultSizeSetting.vueindex a69a7823cb..ab2311c051 100644--- a/frontend/src/components/GeneralSetting/MaximumSQLResultSizeSetting.vue+++ b/frontend/src/components/GeneralSetting/MaximumSQLResultSizeSetting.vue@@ -6,14 +6,6 @@{{ $t("settings.general.workspace.maximum-sql-result.size.self") }}</span><FeatureBadge :feature="PlanFeature.FEATURE_QUERY_POLICY" />- <NTooltip v-if="tooltip">- <template #trigger>- <CircleQuestionMarkIcon class="w-4 textinfolabel" />- </template>- <span>- {{ tooltip }}- </span>- </NTooltip></p><p class="text-sm text-gray-400 mt-1">{{@@ -30,9 +22,8 @@<div class="mt-3 w-full flex flex-row justify-start items-center gap-4"><PermissionGuardWrapperv-slot="slotProps"- :project="project":permissions="[- 'bb.policies.update'+ 'bb.settings.setWorkspaceProfile']"><NInputNumber@@ -59,14 +50,6 @@{{ $t("settings.general.workspace.maximum-sql-result.rows.self") }}</span><FeatureBadge :feature="PlanFeature.FEATURE_QUERY_POLICY" />- <NTooltip v-if="tooltip">- <template #trigger>- <CircleQuestionMarkIcon class="w-4 textinfolabel" />- </template>- <span>- {{ tooltip }}- </span>- </NTooltip></p><p class="text-sm text-gray-400 mt-1">{{@@ -79,7 +62,6 @@<div class="mt-3 w-full flex flex-row justify-start items-center gap-4"><PermissionGuardWrapperv-slot="slotProps"- :project="project":permissions="['bb.policies.update']"@@ -109,15 +91,16 @@<script lang="ts" setup>import { create } from "@bufbuild/protobuf";+import { FieldMaskSchema } from "@bufbuild/protobuf/wkt";import { isEqual } from "lodash-es";-import { CircleQuestionMarkIcon } from "lucide-vue-next";-import { NInputNumber, NTooltip } from "naive-ui";+import { NInputNumber } from "naive-ui";import { computed, ref } from "vue";import PermissionGuardWrapper from "@/components/Permission/PermissionGuardWrapper.vue";import {DEFAULT_MAX_RESULT_SIZE_IN_MB,featureToRef,usePolicyV1Store,+ useSettingV1Store,} from "@/store";import {PolicyResourceType,@@ -125,24 +108,24 @@ import {type QueryDataPolicy,QueryDataPolicySchema,} from "@/types/proto-es/v1/org_policy_service_pb";-import type { Project } from "@/types/proto-es/v1/project_service_pb";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";import { FeatureBadge } from "../FeatureGuard";const props = defineProps<{resource: string;- project?: Project;policy: QueryDataPolicy;- tooltip?: string;}>();const policyV1Store = usePolicyV1Store();+const settingV1Store = useSettingV1Store();const initialState = () => {+ let size = settingV1Store.workspaceProfile.sqlResultSize;+ if (size <= 0) {+ size = BigInt(DEFAULT_MAX_RESULT_SIZE_IN_MB * 1024 * 1024);+ }return {- maximumResultSize: Math.round(- Number(props.policy.maximumResultSize) / 1024 / 1024- ),+ maximumResultSize: Math.round(Number(size) / 1024 / 1024),maximumResultRows: Number(props.policy.maximumResultRows),};};@@ -159,23 +142,36 @@ const allowUpdate = computed(() => {});const updateChange = async () => {- await policyV1Store.upsertPolicy({- parentPath: props.resource,- policy: {- type: PolicyType.DATA_QUERY,- resourceType: PolicyResourceType.WORKSPACE,+ const init = initialState();+ if (init.maximumResultRows !== queryRestriction.value.maximumResultRows) {+ await policyV1Store.upsertPolicy({+ parentPath: props.resource,policy: {- case: "queryDataPolicy",- value: create(QueryDataPolicySchema, {- ...props.policy,- maximumResultSize: BigInt(- queryRestriction.value.maximumResultSize * 1024 * 1024- ),- maximumResultRows: queryRestriction.value.maximumResultRows,- }),+ type: PolicyType.DATA_QUERY,+ resourceType: PolicyResourceType.WORKSPACE,+ policy: {+ case: "queryDataPolicy",+ value: create(QueryDataPolicySchema, {+ ...props.policy,+ maximumResultRows: queryRestriction.value.maximumResultRows,+ }),+ },+ },+ });+ }++ if (init.maximumResultSize !== queryRestriction.value.maximumResultSize) {+ await settingV1Store.updateWorkspaceProfile({+ payload: {+ sqlResultSize: BigInt(+ queryRestriction.value.maximumResultSize * 1024 * 1024+ ),},- },- });+ updateMask: create(FieldMaskSchema, {+ paths: ["value.workspace_profile.sql_result_size"],+ }),+ });+ }};const handleInput = (value: number | null, callback: (val: number) => void) => {diff --git a/frontend/src/components/GeneralSetting/QueryDataPolicySetting.vue b/frontend/src/components/GeneralSetting/QueryDataPolicySetting.vueindex ec1d891dec..631d9d0152 100644--- a/frontend/src/components/GeneralSetting/QueryDataPolicySetting.vue+++ b/frontend/src/components/GeneralSetting/QueryDataPolicySetting.vue@@ -1,43 +1,69 @@<template>- <div v-if="hasGetPermission" class="flex-1 flex flex-col gap-y-6">+ <div class="flex-1 flex flex-col gap-y-6">+ <div class="w-full inline-flex items-center gap-x-2">+ <PermissionGuardWrapper+ v-slot="slotProps"+ :permissions="[+ 'bb.policies.update'+ ]"+ >+ <Switch+ :value="!state.disableExport"+ :text="true"+ :disabled="slotProps.disabled || !hasQueryPolicyFeature"+ @update:value="(val: boolean) => state.disableExport = !val"+ />+ </PermissionGuardWrapper>+ <span class="font-medium">+ {{ $t("settings.general.workspace.data-export") }}+ </span>+ <FeatureBadge :feature="PlanFeature.FEATURE_QUERY_POLICY" />+ </div>+ <div class="w-full inline-flex items-center gap-x-2">+ <PermissionGuardWrapper+ v-slot="slotProps"+ :permissions="[+ 'bb.policies.update'+ ]"+ >+ <Switch+ v-model:value="state.disableCopyData"+ :text="true"+ :disabled="slotProps.disabled || !hasRestrictCopyingDataFeature"+ />+ </PermissionGuardWrapper>+ <span class="textlabel">+ {{ $t("settings.general.workspace.disable-copy-data") }}+ </span>+ <FeatureBadge :feature="PlanFeature.FEATURE_RESTRICT_COPYING_DATA" />+ </div><div>- <div class="flex items-center gap-x-2">+ <div class="w-full inline-flex items-center gap-x-2"><PermissionGuardWrapperv-slot="slotProps"- :project="project":permissions="['bb.policies.update']"><Switch- :value="!disableExport"+ v-model:value="state.allowAdminDataSource":text="true":disabled="slotProps.disabled || !hasQueryPolicyFeature"- @update:value="(val: boolean) => disableExport = !val"/></PermissionGuardWrapper>- <span class="font-medium">- {{ $t("settings.general.workspace.data-export.enable") }}+ <span class="textlabel">+ {{ t("settings.general.workspace.allow-admin-data-source.self") }}</span>- <NTooltip v-if="tooltip">- <template #trigger>- <CircleQuestionMarkIcon class="w-4 textinfolabel" />- </template>- <span>- {{ tooltip }}- </span>- </NTooltip>- </div>- <div class="mt-1 text-sm text-gray-400">- {{ $t("settings.general.workspace.data-export.description") }}+ <FeatureBadge :feature="PlanFeature.FEATURE_QUERY_POLICY" /></div>+ <span class="mt-1 text-sm text-gray-400">+ {{ t("settings.general.workspace.allow-admin-data-source.description") }}+ </span></div><MaximumSQLResultSizeSettingref="maximumSQLResultSizeSettingRef":resource="resource":policy="policyPayload"- :tooltip="tooltip"- :project="project"/><div><p class="font-medium flex flex-row justify-start items-center">@@ -45,14 +71,6 @@{{ $t("settings.general.workspace.query-data-policy.timeout.self") }}</span><FeatureBadge :feature="PlanFeature.FEATURE_QUERY_POLICY" />- <NTooltip v-if="tooltip">- <template #trigger>- <CircleQuestionMarkIcon class="w-4 textinfolabel" />- </template>- <span>- {{ tooltip }}- </span>- </NTooltip></p><p class="text-sm text-gray-400 mt-1">{{@@ -65,13 +83,12 @@<div class="mt-3 w-full flex flex-row justify-start items-center gap-4"><PermissionGuardWrapperv-slot="slotProps"- :project="project":permissions="['bb.policies.update']"><NInputNumber- :value="maxQueryTimeInseconds"+ :value="state.maxQueryTimeInseconds":disabled="!hasQueryPolicyFeature || slotProps.disabled"class="w-60":min="0"@@ -91,9 +108,9 @@<script lang="ts" setup>import { create } from "@bufbuild/protobuf";import { DurationSchema } from "@bufbuild/protobuf/wkt";-import { CircleQuestionMarkIcon } from "lucide-vue-next";-import { NInputNumber, NTooltip } from "naive-ui";-import { computed, ref, watch } from "vue";+import { isEqual } from "lodash-es";+import { NInputNumber } from "naive-ui";+import { computed, reactive, ref, watch } from "vue";import PermissionGuardWrapper from "@/components/Permission/PermissionGuardWrapper.vue";import { Switch } from "@/components/v2";import { t } from "@/plugins/i18n";@@ -101,57 +118,33 @@ import {featureToRef,usePolicyByParentAndType,usePolicyV1Store,- useProjectV1Store,} from "@/store";-import { projectNamePrefix } from "@/store/modules/v1/common";-import { isValidProjectName } from "@/types";import {PolicyResourceType,PolicyType,QueryDataPolicySchema,} from "@/types/proto-es/v1/org_policy_service_pb";import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";-import { hasProjectPermissionV2, hasWorkspacePermissionV2 } from "@/utils";import { FeatureBadge } from "../FeatureGuard";import MaximumSQLResultSizeSetting from "./MaximumSQLResultSizeSetting.vue";+interface LocalState {+ maxQueryTimeInseconds: number;+ disableExport: boolean;+ disableCopyData: boolean;+ allowAdminDataSource: boolean;+}+const props = defineProps<{resource: string;}>();const policyV1Store = usePolicyV1Store();-const projectStore = useProjectV1Store();const hasQueryPolicyFeature = featureToRef(PlanFeature.FEATURE_QUERY_POLICY);--const project = computed(() => {- if (props.resource.startsWith(projectNamePrefix)) {- const proj = projectStore.getProjectByName(props.resource);- if (!isValidProjectName(proj.name)) {- return undefined;- }- return proj;- }- return undefined;-});--const hasGetPermission = computed(() => {- if (project.value) {- return hasProjectPermissionV2(project.value, "bb.policies.get");- }- return hasWorkspacePermissionV2("bb.policies.get");-});--const tooltip = computed(() => {- if (project.value) {- return t("settings.general.workspace.query-data-policy.tooltip", {- scope: t("settings.general.workspace.query-data-policy.workspace-scope"),- });- }- return t("settings.general.workspace.query-data-policy.tooltip", {- scope: t("settings.general.workspace.query-data-policy.project-scope"),- });-});+const hasRestrictCopyingDataFeature = featureToRef(+ PlanFeature.FEATURE_RESTRICT_COPYING_DATA+);const { ready } = usePolicyByParentAndType(computed(() => ({@@ -164,20 +157,22 @@ const policyPayload = computed(() => {return policyV1Store.getQueryDataPolicyByParent(props.resource);});-const initialMaxQueryTimeInseconds = computed(() =>- Number(policyPayload.value.timeout?.seconds ?? 0)-);+const getInitialState = (): LocalState => {+ return {+ maxQueryTimeInseconds: Number(policyPayload.value.timeout?.seconds ?? 0),+ disableExport: policyPayload.value.disableExport,+ disableCopyData: policyPayload.value.disableCopyData,+ allowAdminDataSource: policyPayload.value.allowAdminDataSource,+ };+};-// limit in seconds.-const maxQueryTimeInseconds = ref<number>(initialMaxQueryTimeInseconds.value);-const disableExport = ref(policyPayload.value.disableExport);+const state = reactive<LocalState>(getInitialState());const maximumSQLResultSizeSettingRef =ref<InstanceType<typeof MaximumSQLResultSizeSetting>>();const revert = () => {- maxQueryTimeInseconds.value = initialMaxQueryTimeInseconds.value;- disableExport.value = policyPayload.value.disableExport;+ Object.assign(state, getInitialState());maximumSQLResultSizeSettingRef.value?.revert();};@@ -192,8 +187,7 @@ watch(const isDirty = computed(() => {return (- maxQueryTimeInseconds.value !== initialMaxQueryTimeInseconds.value ||- disableExport.value !== policyPayload.value.disableExport ||+ !isEqual(state, getInitialState()) ||maximumSQLResultSizeSettingRef.value?.isDirty);});@@ -211,9 +205,11 @@ const updateChange = async () => {case: "queryDataPolicy",value: create(QueryDataPolicySchema, {...policyPayload.value,- disableExport: disableExport.value,+ disableExport: state.disableExport,+ disableCopyData: state.disableCopyData,+ allowAdminDataSource: state.allowAdminDataSource,timeout: create(DurationSchema, {- seconds: BigInt(maxQueryTimeInseconds.value),+ seconds: BigInt(state.maxQueryTimeInseconds),}),}),},@@ -224,7 +220,7 @@ const updateChange = async () => {const handleInput = (value: number | null) => {if (value === null) return;if (value === undefined) return;- maxQueryTimeInseconds.value = value;+ state.maxQueryTimeInseconds = value;};defineExpose({diff --git a/frontend/src/components/GeneralSetting/SQLEditorSetting.vue b/frontend/src/components/GeneralSetting/SQLEditorSetting.vuenew file mode 100644index 0000000000..efd3770c8b--- /dev/null+++ b/frontend/src/components/GeneralSetting/SQLEditorSetting.vue@@ -0,0 +1,47 @@+<template>+ <div id="security" class="py-6 lg:flex gap-y-4 lg:gap-y-0">+ <div class="text-left lg:w-1/4">+ <div class="flex items-center gap-x-2">+ <h1 class="text-2xl font-bold">+ {{ title }}+ </h1>+ </div>+ </div>++ <div class="flex-1 lg:px-4 flex flex-col gap-y-6">+ <QueryDataPolicySetting+ ref="queryDataPolicySettingRef"+ resource=""+ />+ </div>+ </div>+</template>++<script lang="ts" setup>+import { computed, ref } from "vue";+import QueryDataPolicySetting from "./QueryDataPolicySetting.vue";++const props = defineProps<{+ title: string;+}>();++const queryDataPolicySettingRef =+ ref<InstanceType<typeof QueryDataPolicySetting>>();++const isDirty = computed(() => {+ return queryDataPolicySettingRef.value?.isDirty;+});++const onUpdate = async () => {+ await queryDataPolicySettingRef.value?.update();+};++defineExpose({+ isDirty,+ update: onUpdate,+ title: props.title,+ revert: () => {+ queryDataPolicySettingRef.value?.revert();+ },+});+</script>diff --git a/frontend/src/components/GeneralSetting/SecuritySetting.vue b/frontend/src/components/GeneralSetting/SecuritySetting.vueindex c4aee1f012..c1b0c17252 100644--- a/frontend/src/components/GeneralSetting/SecuritySetting.vue+++ b/frontend/src/components/GeneralSetting/SecuritySetting.vue@@ -32,10 +32,6 @@{{ $t("settings.general.workspace.watermark.description") }}</div></div>- <QueryDataPolicySetting- ref="queryDataPolicySettingRef"- resource=""- /><MaximumRoleExpirationSettingref="maximumRoleExpirationSettingRef"/>@@ -57,7 +53,6 @@ import { PlanFeature } from "@/types/proto-es/v1/subscription_service_pb";import { FeatureBadge } from "../FeatureGuard";import DomainRestrictionSetting from "./DomainRestrictionSetting.vue";import MaximumRoleExpirationSetting from "./MaximumRoleExpirationSetting.vue";-import QueryDataPolicySetting from "./QueryDataPolicySetting.vue";const props = defineProps<{title: string;@@ -70,13 +65,10 @@ const domainRestrictionSettingRef =ref<InstanceType<typeof DomainRestrictionSetting>>();const maximumRoleExpirationSettingRef =ref<InstanceType<typeof MaximumRoleExpirationSetting>>();-const queryDataPolicySettingRef =- ref<InstanceType<typeof QueryDataPolicySetting>>();const settingRefList = computed(() => [domainRestrictionSettingRef,maximumRoleExpirationSettingRef,- queryDataPolicySettingRef,]);const initEnableWatermark = computed(() => {diff --git a/frontend/src/components/GeneralSetting/index.ts b/frontend/src/components/GeneralSetting/index.tsindex e6ca33605d..07edfedac2 100644--- a/frontend/src/components/GeneralSetting/index.ts+++ b/frontend/src/components/GeneralSetting/index.ts@@ -7,6 +7,7 @@ import GeneralSetting from "./GeneralSetting.vue";import MaximumSQLResultSizeSetting from "./MaximumSQLResultSizeSetting.vue";import ProductImprovementSetting from "./ProductImprovementSetting.vue";import SecuritySetting from "./SecuritySetting.vue";+import SQLEditorSetting from "./SQLEditorSetting.vue";export {BrandingSetting,@@ -18,4 +19,5 @@ export {AuditLogStdoutSetting,GeneralSetting,ProductImprovementSetting,+ SQLEditorSetting,};diff --git a/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/LimitsSection.vue b/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/LimitsSection.vueindex 419a528bfe..f591a5eb7c 100644--- a/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/LimitsSection.vue+++ b/frontend/src/components/Plan/components/IssueReviewView/DatabaseExportView/LimitsSection.vue@@ -7,15 +7,7 @@{{ $t("settings.general.workspace.maximum-sql-result.size.self") }}</span><span class=" font-medium">- {{ Number(policy.maximumResultSize) / 1024 / 1024 }} MB- </span>- </div>- <div class="flex items-center gap-x-2">- <span class="text-sm">- {{ $t("settings.general.workspace.maximum-sql-result.rows.self") }}- </span>- <span class=" font-medium">- {{ maximumResultRows }}+ {{ maximumResultSize }} MB</span></div></div>@@ -23,22 +15,16 @@<script lang="tsx" setup>import { computed } from "vue";-import { t } from "@/plugins/i18n";-import {- useCurrentProjectV1,- useEffectiveQueryDataPolicyForProject,-} from "@/store";+import { DEFAULT_MAX_RESULT_SIZE_IN_MB, useSettingV1Store } from "@/store";-const { project } = useCurrentProjectV1();-const { policy } = useEffectiveQueryDataPolicyForProject(- computed(() => project.value.name)-);+const settingStore = useSettingV1Store();-const maximumResultRows = computed(() => {- const { maximumResultRows } = policy.value;- if (maximumResultRows === Number.MAX_VALUE) {- return t("common.unlimited");+const maximumResultSize = computed(() => {+ let size = settingStore.workspaceProfile.sqlResultSize;+ if (size <= 0) {+ size = BigInt(DEFAULT_MAX_RESULT_SIZE_IN_MB * 1024 * 1024);}- return `${maximumResultRows} ${t("settings.general.workspace.maximum-sql-result.rows.rows")}`;++ return Number(size) / 1024 / 1024;});</script>\ No newline at end of filediff --git a/frontend/src/components/Project/Settings/ProjectSecuritySettingPanel.vue b/frontend/src/components/Project/Settings/ProjectSecuritySettingPanel.vueindex aeab3cb736..2dcddf124c 100644--- a/frontend/src/components/Project/Settings/ProjectSecuritySettingPanel.vue+++ b/frontend/src/components/Project/Settings/ProjectSecuritySettingPanel.vue@@ -4,21 +4,11 @@ref="sqlReviewForResourceRef":resource="project.name"/>- <AccessControlConfigure- ref="accessControlConfigureRef"- :resource="project.name"- />- <QueryDataPolicySetting- ref="queryDataPolicySettingRef"- :resource="project.name"- /></div></template><script setup lang="ts">import { computed, ref } from "vue";-import AccessControlConfigure from "@/components/EnvironmentForm/AccessControlConfigure.vue";-import QueryDataPolicySetting from "@/components/GeneralSetting/QueryDataPolicySetting.vue";import { SQLReviewForResource } from "@/components/SQLReview";import type { Project } from "@/types/proto-es/v1/project_service_pb";@@ -26,36 +16,19 @@ defineProps<{project: Project;}>();-const accessControlConfigureRef =- ref<InstanceType<typeof AccessControlConfigure>>();const sqlReviewForResourceRef =ref<InstanceType<typeof SQLReviewForResource>>();-const queryDataPolicySettingRef =- ref<InstanceType<typeof QueryDataPolicySetting>>();-const isDirty = computed(- () =>- accessControlConfigureRef.value?.isDirty ||- sqlReviewForResourceRef.value?.isDirty ||- queryDataPolicySettingRef.value?.isDirty-);+const isDirty = computed(() => sqlReviewForResourceRef.value?.isDirty);const onUpdate = async () => {if (sqlReviewForResourceRef.value?.isDirty) {await sqlReviewForResourceRef.value.update();}- if (accessControlConfigureRef.value?.isDirty) {- await accessControlConfigureRef.value.update();- }- if (queryDataPolicySettingRef.value?.isDirty) {- await queryDataPolicySettingRef.value.update();- }};const resetState = () => {sqlReviewForResourceRef.value?.revert();- accessControlConfigureRef.value?.revert();- queryDataPolicySettingRef.value?.revert();};defineExpose({diff --git a/frontend/src/components/v2/Model/cells/UserNameCell.vue b/frontend/src/components/v2/Model/cells/UserNameCell.vueindex 497d0d8fbd..f22a02f2e6 100644--- a/frontend/src/components/v2/Model/cells/UserNameCell.vue+++ b/frontend/src/components/v2/Model/cells/UserNameCell.vue@@ -8,7 +8,7 @@<div :class="isDeleted ? 'line-through' : ''"><HighlightLabelTextv-if="onClickUser"- class="truncate max-w-40"+ class="truncate max-w-40 cursor-pointer":keyword="keyword":text="user.title"@click="onClickUser(user, $event)"diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 09f4060fd9..6a3f24f943 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -665,9 +665,11 @@"description": "Display watermarks on pages, including username, ID and email.","enable": "Enable watermark"},- "data-export": {- "enable": "Enable data export",- "description": "Allow users to export data in SQL Editor"+ "data-export": "Enable data export",+ "disable-copy-data": "Restrict data copying",+ "allow-admin-data-source": {+ "self": "Allow querying the admin data source",+ "description": "When enabled, users can choose between admin and read-only data sources. When disabled, users are forced to use read-only data sources if configured, otherwise fall back to admin data sources."},"product-improvement": {"self": "Product Improvement",@@ -743,9 +745,7 @@},"seconds": "Seconds","project-scope": "project",- "workspace-scope": "workspace",- "environment-scope": "environment",- "tooltip": "It's also configurable at the {scope} level. Bytebase will apply the most strict value."+ "environment-scope": "environment"},"domain-restriction": {"self": "Workspace Domain",@@ -1517,20 +1517,7 @@"reorder": "Reorder Environments","successfully-updated-environment": "Successfully updated environment '{name}'.","production-environment": "Production environment",- "access-control": {- "title": "Access Control",- "disable-copy-data-from-sql-editor": "Restrict data copying in SQL Editor",- "restrict-admin-connection": {- "self": "Restrict querying admin data sources",- "disallow": "Disallow querying data from the admin data source",- "fallback": "Allow querying the admin data source if no read-only connection is available"- }- },- "statement-execution": {- "title": "Statement execution",- "disallow-ddl": "Disallow running DDL statements in the SQL editor",- "disallow-dml": "Disallow running data-modifying DML statements in the SQL Editor"- }+ "statement-execution": {}},"quick-start": {"self": "Quickstart",@@ -2117,8 +2104,7 @@}},"query-context": {- "admin-data-source-is-disallowed-to-query": "Admin data source is disallowed to query.",- "admin-data-source-is-disallowed-to-query-when-read-only-data-source-is-available": "Admin data source is disallowed to query when read-only data source is available."+ "admin-data-source-is-disallowed-to-query": "Admin data source is disallowed to query."},"manage-connections": "Manage connections","view-detail": "View detail",diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex f922b3c95a..0e0acc3c90 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -665,9 +665,11 @@"description": "Mostrar marcas de agua en las páginas, incluyendo el nombre de usuario, el ID y el correo electrónico.","enable": "Activar marca de agua"},- "data-export": {- "enable": "Habilitar la exportación de datos",- "description": "Permitir a los usuarios exportar datos en el Editor SQL"+ "data-export": "Habilitar la exportación de datos",+ "disable-copy-data": "Restringir la copia de datos",+ "allow-admin-data-source": {+ "self": "Permitir consultar la fuente de datos de administración",+ "description": "Cuando está habilitado, los usuarios pueden elegir entre fuentes de datos de administración y de solo lectura. Cuando está deshabilitado, los usuarios se ven obligados a usar fuentes de datos de solo lectura si están configuradas; de lo contrario, vuelven a usar fuentes de datos de administración."},"product-improvement": {"self": "Mejora del Producto",@@ -743,9 +745,7 @@},"seconds": "Artículos de segunda clase","project-scope": "proyecto",- "workspace-scope": "espacio de trabajo",- "environment-scope": "ambiente",- "tooltip": "También es configurable a nivel {scope}. Bytebase aplicará el valor más estricto."+ "environment-scope": "ambiente"},"domain-restriction": {"self": "Dominio de espacio de trabajo",@@ -1517,20 +1517,7 @@"reorder": "Reordenar entornos","successfully-updated-environment": "entorno '{name}' actualizado exitosamente.","production-environment": "Entorno de producción",- "access-control": {- "title": "Control de Acceso",- "disable-copy-data-from-sql-editor": "Restringir la copia de datos en el editor SQL",- "restrict-admin-connection": {- "self": "Restringir la consulta de la fuente de datos de administración",- "disallow": "No permitir la consulta de datos desde la fuente de datos de administración",- "fallback": "Permitir la consulta de la fuente de datos de administración si no hay una conexión de solo lectura disponible"- }- },- "statement-execution": {- "title": "Ejecución de la declaración",- "disallow-ddl": "No permitir la ejecución de sentencias DDL en el editor SQL",- "disallow-dml": "No permitir la ejecución de instrucciones DML que modifiquen datos en el Editor SQL"- }+ "statement-execution": {}},"quick-start": {"self": "Inicio rápido",@@ -2117,8 +2104,7 @@}},"query-context": {- "admin-data-source-is-disallowed-to-query": "No se permite realizar consultas a la fuente de datos del administrador.",- "admin-data-source-is-disallowed-to-query-when-read-only-data-source-is-available": "No se permite realizar consultas a la fuente de datos del administrador cuando la fuente de datos de solo lectura está disponible."+ "admin-data-source-is-disallowed-to-query": "No se permite realizar consultas a la fuente de datos del administrador."},"manage-connections": "Gestionar las conexiones","view-detail": "Ver detalle",diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex a1f378e5c2..b8fb7b4d56 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -665,9 +665,11 @@"description": "ユーザー名、ID、メールアドレスを含むページにウォーターマークを表示します。","enable": "ウォーターマークをオンにする"},- "data-export": {- "enable": "データのエクスポートを有効にする",- "description": "ユーザーがSQLエディタでデータをエクスポートできるようにする"+ "data-export": "データのエクスポートを有効にする",+ "disable-copy-data": "データのコピーを制限する",+ "allow-admin-data-source": {+ "self": "管理データソースのクエリを許可する",+ "description": "有効にすると、ユーザーは管理データソースと読み取り専用データソースのどちらかを選択できます。無効にすると、読み取り専用データソースが設定されている場合は強制的に読み取り専用データソースを使用し、設定されていない場合は管理データソースにフォールバックします。"},"product-improvement": {"self": "製品改善",@@ -743,9 +745,7 @@},"seconds": "秒","project-scope": "プロジェクト",- "workspace-scope": "ワークスペース",- "environment-scope": "環境",- "tooltip": "{scope} レベルでも設定可能です。Bytebase は最も厳格な値を適用します。"+ "environment-scope": "環境"},"domain-restriction": {"self": "ワークスペースドメイン",@@ -1517,20 +1517,7 @@"reorder": "環境の並べ替え","successfully-updated-environment": "環境「{name}」は正常に更新されました","production-environment": "本番環境",- "access-control": {- "title": "アクセス制御",- "disable-copy-data-from-sql-editor": "SQL エディタにおけるデータコピーの制限",- "restrict-admin-connection": {- "self": "管理データソースのクエリを制限する",- "disallow": "管理データソースからのデータのクエリを禁止する",- "fallback": "読み取り専用接続が利用できない場合は、管理データソースへのクエリを許可する"- }- },- "statement-execution": {- "title": "ステートメントの実行",- "disallow-ddl": "SQL エディタで DDL ステートメントの実行を禁止する",- "disallow-dml": "SQL エディタでデータを変更する DML ステートメントの実行を禁止する"- }+ "statement-execution": {}},"quick-start": {"self": "クイックスタート",@@ -2117,8 +2104,7 @@}},"query-context": {- "admin-data-source-is-disallowed-to-query": "管理者データ ソースはクエリできません。",- "admin-data-source-is-disallowed-to-query-when-read-only-data-source-is-available": "読み取り専用データ ソースが使用可能な場合、管理データ ソースはクエリを実行できません。"+ "admin-data-source-is-disallowed-to-query": "管理者データ ソースはクエリできません。"},"manage-connections": "接続を管理する","view-detail": "詳細を見る",diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.jsonindex ece50abbf7..59b035f0d8 100644--- a/frontend/src/locales/vi-VN.json+++ b/frontend/src/locales/vi-VN.json@@ -665,9 +665,11 @@"description": "Hiển thị hình mờ trên các trang, bao gồm tên người dùng, ID và email.","enable": "Bật hình mờ"},- "data-export": {- "enable": "Bật xuất dữ liệu",- "description": "Cho phép người dùng xuất dữ liệu trong Trình soạn thảo SQL"+ "data-export": "Bật xuất dữ liệu",+ "disable-copy-data": "Hạn chế sao chép dữ liệu",+ "allow-admin-data-source": {+ "self": "Cho phép truy vấn nguồn dữ liệu quản trị",+ "description": "Khi được bật, người dùng có thể chọn giữa nguồn dữ liệu quản trị và nguồn dữ liệu chỉ đọc. Khi bị tắt, người dùng buộc phải sử dụng nguồn dữ liệu chỉ đọc nếu được cấu hình, nếu không sẽ quay lại sử dụng nguồn dữ liệu quản trị."},"product-improvement": {"self": "Cải thiện Sản phẩm",@@ -743,9 +745,7 @@},"seconds": "Giây","project-scope": "dự án",- "workspace-scope": "không gian làm việc",- "environment-scope": "môi trường",- "tooltip": "Bạn cũng có thể cấu hình ở cấp độ {scope}. Bytebase sẽ áp dụng giá trị nghiêm ngặt nhất."+ "environment-scope": "môi trường"},"domain-restriction": {"self": "Tên miền không gian làm việc",@@ -1517,20 +1517,7 @@"reorder": "Sắp xếp lại môi trường","successfully-updated-environment": "Đã cập nhật thành công môi trường '{name}'.","production-environment": "Môi trường sản xuất",- "access-control": {- "title": "Kiểm soát truy cập",- "disable-copy-data-from-sql-editor": "Hạn chế sao chép dữ liệu trong Trình soạn thảo SQL",- "restrict-admin-connection": {- "self": "Hạn chế truy vấn nguồn dữ liệu quản trị",- "disallow": "Không cho phép truy vấn dữ liệu từ nguồn dữ liệu quản trị",- "fallback": "Cho phép truy vấn nguồn dữ liệu quản trị nếu không có kết nối chỉ đọc nào khả dụng"- }- },- "statement-execution": {- "title": "Thực thi câu lệnh",- "disallow-ddl": "Không cho phép chạy câu lệnh DDL trong trình soạn thảo SQL",- "disallow-dml": "Không cho phép chạy câu lệnh DML sửa đổi dữ liệu trong Trình soạn thảo SQL"- }+ "statement-execution": {}},"quick-start": {"self": "Bắt đầu nhanh",@@ -2117,8 +2104,7 @@}},"query-context": {- "admin-data-source-is-disallowed-to-query": "Nguồn dữ liệu quản trị không được phép truy vấn.",- "admin-data-source-is-disallowed-to-query-when-read-only-data-source-is-available": "Nguồn dữ liệu quản trị không được phép truy vấn khi có nguồn dữ liệu chỉ đọc."+ "admin-data-source-is-disallowed-to-query": "Nguồn dữ liệu quản trị không được phép truy vấn."},"manage-connections": "Quản lý kết nối","view-detail": "Xem chi tiết",diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 44a5b717a0..7cccd099c8 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -665,9 +665,11 @@"description": "在页面上显示水印,包含用户名、ID 和 Email。","enable": "开启水印"},- "data-export": {- "enable": "启用数据导出",- "description": "允许用户在 SQL 编辑器里导出数据"+ "data-export": "启用数据导出",+ "disable-copy-data": "限制复制数据",+ "allow-admin-data-source": {+ "self": "允许查询主数据源",+ "description": "启用时,用户可以在主数据源和只读数据源之间进行选择。禁用时,如果配置了只读数据源,则强制用户使用只读数据源,否则回退到使用主数据源。"},"product-improvement": {"self": "产品改进",@@ -743,9 +745,7 @@},"seconds": "秒","project-scope": "项目",- "workspace-scope": "工作区",- "environment-scope": "环境",- "tooltip": "也可在 {scope} 级别进行配置。Bytebase 将应用最严格的值。"+ "environment-scope": "环境"},"domain-restriction": {"self": "工作空间域名",@@ -1517,20 +1517,7 @@"reorder": "重新排序环境","successfully-updated-environment": "环境'{name}'更新成功","production-environment": "生产环境",- "access-control": {- "title": "访问控制",- "disable-copy-data-from-sql-editor": "限制 SQL 编辑器中的数据复制",- "restrict-admin-connection": {- "self": "限制查询主数据源",- "disallow": "不允许从主数据源查询数据",- "fallback": "如果没有可用的只读连接,则允许查询主数据源"- }- },- "statement-execution": {- "title": "语句执行",- "disallow-ddl": "禁止在 SQL 编辑器中运行 DDL 语句",- "disallow-dml": "禁止在 SQL 编辑器中运行修改数据的 DML 语句"- }+ "statement-execution": {}},"quick-start": {"self": "新手任务",@@ -2117,8 +2104,7 @@}},"query-context": {- "admin-data-source-is-disallowed-to-query": "禁止查询主数据源。",- "admin-data-source-is-disallowed-to-query-when-read-only-data-source-is-available": "当只读数据源可用时,不允许查询主数据源。"+ "admin-data-source-is-disallowed-to-query": "禁止查询主数据源。"},"manage-connections": "管理连接","view-detail": "查看详情",diff --git a/frontend/src/router/dashboard/workspaceSetting.ts b/frontend/src/router/dashboard/workspaceSetting.tsindex c6fb147fb4..26db41a65d 100644--- a/frontend/src/router/dashboard/workspaceSetting.ts+++ b/frontend/src/router/dashboard/workspaceSetting.ts@@ -41,7 +41,10 @@ const workspaceSettingRoutes: RouteRecordRaw[] = [name: SETTING_ROUTE_WORKSPACE_GENERAL,meta: {title: () => t("settings.sidebar.general"),- requiredPermissionList: () => ["bb.settings.getWorkspaceProfile"],+ requiredPermissionList: () => [+ "bb.settings.getWorkspaceProfile",+ "bb.policies.get",+ ],},component: () => import("@/views/SettingWorkspaceGeneral.vue"),props: true,diff --git a/frontend/src/store/modules/v1/auth.ts b/frontend/src/store/modules/v1/auth.tsindex 4efab7012e..6d5b46cc61 100644--- a/frontend/src/store/modules/v1/auth.ts+++ b/frontend/src/store/modules/v1/auth.ts@@ -112,11 +112,12 @@ export const useAuthStore = defineStore("auth_v1", () => {}setRequireResetPassword(resp.requireResetPassword);+ const needAdminSetup = actuatorStore.needAdminSetup;await actuatorStore.fetchServerInfo();// After user login, we need to reset the auth session key.authSessionKey.value = uniqueId();- if (actuatorStore.needAdminSetup) {+ if (needAdminSetup) {actuatorStore.onboardingState.isOnboarding = true;return router.replace({name: SETUP_MODULE,diff --git a/frontend/src/store/modules/v1/policy.ts b/frontend/src/store/modules/v1/policy.tsindex 187c7def56..762d1fb6e5 100644--- a/frontend/src/store/modules/v1/policy.ts+++ b/frontend/src/store/modules/v1/policy.ts@@ -8,7 +8,6 @@ import { silentContextKey } from "@/connect/context-key";import { policyNamePrefix } from "@/store/modules/v1/common";import type { MaybeRef } from "@/types";import { UNKNOWN_USER_NAME } from "@/types";-import type { Database } from "@/types/proto-es/v1/database_service_pb";import type {Policy,QueryDataPolicy,@@ -19,7 +18,6 @@ import {PolicyResourceType,PolicySchema,PolicyType,- QueryDataPolicy_Restriction,QueryDataPolicySchema,RolloutPolicySchema,UpdatePolicyRequestSchema,@@ -30,8 +28,6 @@ interface PolicyState {policyMapByName: Map<string, Policy>;}-export const DEFAULT_MAX_RESULT_SIZE_IN_MB = 100;-export const replacePolicyTypeNameToLowerCase = (name: string) => {const pattern = /(^|\/)policies\/([^/]+)($|\/)/;const replaced = name.replace(@@ -59,17 +55,10 @@ export const usePolicyV1Store = defineStore("policy_v1", () => {return policy?.policy?.case === "queryDataPolicy"? policy.policy.value: create(QueryDataPolicySchema, {- maximumResultSize: BigInt(- DEFAULT_MAX_RESULT_SIZE_IN_MB * 1024 * 1024- ),maximumResultRows: -1,timeout: create(DurationSchema, {seconds: BigInt(0),}),- adminDataSourceRestriction:- QueryDataPolicy_Restriction.RESTRICTION_UNSPECIFIED,- disallowDdl: false,- disallowDml: false,});};@@ -178,13 +167,9 @@ export const usePolicyV1Store = defineStore("policy_v1", () => {});const formatQueryDataPolicy = (policy: QueryDataPolicy) => {- let maximumResultSize = Number(policy.maximumResultSize);let maximumResultRows = policy.maximumResultRows;let queryTimeoutInSeconds = Number(policy.timeout?.seconds ?? 0);- if (maximumResultSize <= 0) {- maximumResultSize = DEFAULT_MAX_RESULT_SIZE_IN_MB * 1024 * 1024;- }if (maximumResultRows <= 0) {maximumResultRows = Number.MAX_VALUE;}@@ -195,7 +180,7 @@ const formatQueryDataPolicy = (policy: QueryDataPolicy) => {return {disableCopyData: policy.disableCopyData,disableExport: policy.disableExport,- maximumResultSize,+ allowAdminDataSource: policy.allowAdminDataSource,maximumResultRows,queryTimeoutInSeconds,};@@ -254,103 +239,23 @@ export const usePolicyByParentAndType = (};};-export const useDataSourceRestrictionPolicy = (- database: MaybeRef<Database>-) => {- const store = usePolicyV1Store();- const ready = ref(false);-- watchEffect(async () => {- await store.getOrFetchPolicyByParentAndType({- parentPath: unref(database).project,- policyType: PolicyType.DATA_QUERY,- });-- const environment = unref(database).effectiveEnvironment;- if (environment) {- await store.getOrFetchPolicyByParentAndType({- parentPath: environment,- policyType: PolicyType.DATA_QUERY,- });- }- ready.value = true;- });-- const dataSourceRestriction = computed(() => {- const projectLevelPolicy = store.getQueryDataPolicyByParent(- unref(database).project- );- const projectLevelAdminDSRestriction =- projectLevelPolicy.adminDataSourceRestriction;-- let envLevelAdminDSRestriction =- QueryDataPolicy_Restriction.RESTRICTION_UNSPECIFIED;- const environment = unref(database).effectiveEnvironment;- if (environment) {- const envLevelPolicy = store.getQueryDataPolicyByParent(environment);- envLevelAdminDSRestriction = envLevelPolicy.adminDataSourceRestriction;- }-- return {- environmentPolicy: envLevelAdminDSRestriction,- projectPolicy: projectLevelAdminDSRestriction,- };- });-- return {- ready,- dataSourceRestriction,- };-};--export const useEffectiveQueryDataPolicyForProject = (- project: MaybeRef<string>-) => {+export const useQueryDataPolicy = () => {const store = usePolicyV1Store();const ready = ref(false);watchEffect(() => {- const projectName = unref(project);- // Fetch both workspace-level and project-level DATA_QUERY policies- Promise.all([- store.getOrFetchPolicyByParentAndType({+ // Fetch workspace-level DATA_QUERY policies+ store+ .getOrFetchPolicyByParentAndType({parentPath: "",policyType: PolicyType.DATA_QUERY,- }),- store.getOrFetchPolicyByParentAndType({- parentPath: projectName,- policyType: PolicyType.DATA_QUERY,- }),- ]).finally(() => (ready.value = true));+ })+ .finally(() => (ready.value = true));});- const policy = computed(() => {- const workspacePolicy = formatQueryDataPolicy(- store.getQueryDataPolicyByParent("")- );- const projectPolicy = formatQueryDataPolicy(- store.getQueryDataPolicyByParent(unref(project))- );-- return {- disableCopyData:- projectPolicy.disableCopyData || workspacePolicy.disableCopyData,- disableExport:- projectPolicy.disableExport || workspacePolicy.disableExport,- maximumResultRows: Math.min(- projectPolicy.maximumResultRows,- workspacePolicy.maximumResultRows- ),- maximumResultSize: Math.min(- projectPolicy.maximumResultSize,- workspacePolicy.maximumResultSize- ),- queryTimeoutInSeconds: Math.min(- projectPolicy.queryTimeoutInSeconds,- workspacePolicy.queryTimeoutInSeconds- ),- };- });+ const policy = computed(() =>+ formatQueryDataPolicy(store.getQueryDataPolicyByParent(""))+ );return {policy,diff --git a/frontend/src/store/modules/v1/setting.ts b/frontend/src/store/modules/v1/setting.tsindex f78e4a1427..c44228ecbd 100644--- a/frontend/src/store/modules/v1/setting.ts+++ b/frontend/src/store/modules/v1/setting.ts@@ -20,6 +20,8 @@ import {} from "@/types/proto-es/v1/setting_service_pb";import { useActuatorV1Store } from "./actuator";+export const DEFAULT_MAX_RESULT_SIZE_IN_MB = 100;+export const useSettingV1Store = defineStore("setting_v1", () => {const settingMapByName = reactive(new Map<string, Setting>());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.tsindex 0f66429547..df7b059c31 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@@ -297,56 +297,59 @@ export declare type RolloutPolicy = Message<"bytebase.v1.RolloutPolicy"> & {export declare const RolloutPolicySchema: GenMessage<RolloutPolicy>;/**- * QueryDataPolicy is the policy configuration for querying data.+ * QueryDataPolicy is the policy configuration for querying data in the SQL Editor.** @generated from message bytebase.v1.QueryDataPolicy*/export declare type QueryDataPolicy = Message<"bytebase.v1.QueryDataPolicy"> & {/**- * The query timeout duration.+ * workspace-level policy+ * The query timeout duration in the SQL editor.** @generated from field: google.protobuf.Duration timeout = 1;*/timeout?: Duration;/**- * Disable data export in the SQL editor.- *- * @generated from field: bool disable_export = 2;- */- disableExport: boolean;-- /**- * The maximum result size limit in bytes.- * The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.+ * workspace-level policy+ * The maximum number of rows to return in the SQL editor.+ * The default value is -1, means no limit.*- * @generated from field: int64 maximum_result_size = 3;+ * @generated from field: int32 maximum_result_rows = 2;*/- maximumResultSize: bigint;+ maximumResultRows: number;/**- * The maximum number of rows to return.- * The default value is -1, means no limit.+ * workspace-level policy+ * Disable data export in the SQL editor.*- * @generated from field: int32 maximum_result_rows = 4;+ * @generated from field: bool disable_export = 3;*/- maximumResultRows: number;+ disableExport: boolean;/**- * Disable copying query results.+ * workspace-level policy+ * Disable copying query results in the SQL editor.*- * @generated from field: bool disable_copy_data = 5;+ * @generated from field: bool disable_copy_data = 4;*/disableCopyData: boolean;/**- * Restriction for admin data source queries.+ * workspace-level policy+ * Allow using the admin data source to query in the SQL editor.+ * If true, users can select the admin data source or read-only data source+ * If false,+ * 1. when read-only data source is configured, users're force to use the read-only data source+ * 2. otherwise fallback to use the admin data source.*- * @generated from field: bytebase.v1.QueryDataPolicy.Restriction admin_data_source_restriction = 6;+ * @generated from field: bool allow_admin_data_source = 5;*/- adminDataSourceRestriction: QueryDataPolicy_Restriction;+ allowAdminDataSource: boolean;/**+ * ================+ * Deprecate following fields.* Disallow running DDL statements in the SQL editor.** @generated from field: bool disallow_ddl = 7;@@ -367,39 +370,6 @@ export declare type QueryDataPolicy = Message<"bytebase.v1.QueryDataPolicy"> & {*/export declare const QueryDataPolicySchema: GenMessage<QueryDataPolicy>;-/**- * Restriction level for admin data source access.- *- * @generated from enum bytebase.v1.QueryDataPolicy.Restriction- */-export enum QueryDataPolicy_Restriction {- /**- * Unspecified restriction.- *- * @generated from enum value: RESTRICTION_UNSPECIFIED = 0;- */- RESTRICTION_UNSPECIFIED = 0,-- /**- * Allow querying admin data sources when there is no read-only data source.- *- * @generated from enum value: FALLBACK = 1;- */- FALLBACK = 1,-- /**- * Disallow querying admin data sources.- *- * @generated from enum value: DISALLOW = 2;- */- DISALLOW = 2,-}--/**- * Describes the enum bytebase.v1.QueryDataPolicy.Restriction.- */-export declare const QueryDataPolicy_RestrictionSchema: GenEnum<QueryDataPolicy_Restriction>;-/*** MaskingExemptionPolicy is the allowlist of users who can access sensitive data.*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.jsindex f11b991033..7bfffdad25 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+kEVEhNieXRlYmFzZS5jb20vUG9saWN5EigKBnBvbGljeRgCIAEoCzITLmJ5dGViYXNlLnYxLlBvbGljeUID4EECEiUKBHR5cGUYAyABKA4yFy5ieXRlYmFzZS52MS5Qb2xpY3lUeXBlIocBChNVcGRhdGVQb2xpY3lSZXF1ZXN0EigKBnBvbGljeRgBIAEoCzITLmJ5dGViYXNlLnYxLlBvbGljeUID4EECEi8KC3VwZGF0ZV9tYXNrGAIgASgLMhouZ29vZ2xlLnByb3RvYnVmLkZpZWxkTWFzaxIVCg1hbGxvd19taXNzaW5nGAMgASgIIkAKE0RlbGV0ZVBvbGljeVJlcXVlc3QSKQoEbmFtZRgBIAEoCUIb4EEC+kEVChNieXRlYmFzZS5jb20vUG9saWN5Ij0KEEdldFBvbGljeVJlcXVlc3QSKQoEbmFtZRgBIAEoCUIb4EEC+kEVChNieXRlYmFzZS5jb20vUG9saWN5IpsBChNMaXN0UG9saWNpZXNSZXF1ZXN0EisKBnBhcmVudBgBIAEoCUIb4EEC+kEVEhNieXRlYmFzZS5jb20vUG9saWN5EjEKC3BvbGljeV90eXBlGAIgASgOMh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5hbWU9cG9saWNpZXMvKn0SsAIKDERlbGV0ZVBvbGljeRIgLmJ5dGViYXNlLnYxLkRlbGV0ZVBvbGljeVJlcXVlc3QaFi5nb29nbGUucHJvdG9idWYuRW1wdHki5QHaQQRuYW1liuowEmJiLnBvbGljaWVzLmRlbGV0ZZDqMAKY6jABgtPkkwK5AVoiKiAvdjEve25hbWU9cHJvamVjdHMvKi9wb2xpY2llcy8qfVomKiQvdjEve25hbWU9ZW52aXJvbm1lbnRzLyovcG9saWNpZXMvKn1aIyohL3YxL3tuYW1lPWluc3RhbmNlcy8qL3BvbGljaWVzLyp9Wi8qLS92MS97bmFtZT1pbnN0YW5jZXMvKi9kYXRhYmFzZXMvKi9wb2xpY2llcy8qfSoVL3YxL3tuYW1lPXBvbGljaWVzLyp9QqsBCg9jb20uYnl0ZWJhc2UudjFCFU9yZ1BvbGljeVNlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [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+kEVEhNieXRlYmFzZS5jb20vUG9saWN5EigKBnBvbGljeRgCIAEoCzITLmJ5dGViYXNlLnYxLlBvbGljeUID4EECEiUKBHR5cGUYAyABKA4yFy5ieXRlYmFzZS52MS5Qb2xpY3lUeXBlIocBChNVcGRhdGVQb2xpY3lSZXF1ZXN0EigKBn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twb2xpY3kubmFtZT1lbnZpcm9ubWVudHMvKi9wb2xpY2llcy8qfVoyOgZwb2xpY3kyKC92MS97cG9saWN5Lm5hbWU9aW5zdGFuY2VzLyovcG9saWNpZXMvKn1aPjoGcG9saWN5MjQvdjEve3BvbGljeS5uYW1lPWluc3RhbmNlcy8qL2RhdGFiYXNlcy8qL3BvbGljaWVzLyp9MhwvdjEve3BvbGljeS5uYW1lPXBvbGljaWVzLyp9ErACCgxEZWxldGVQb2xpY3kSIC5ieXRlYmFzZS52MS5EZWxldGVQb2xpY3lSZXF1ZXN0GhYuZ29vZ2xlLnByb3RvYnVmLkVtcHR5IuUB2kEEbmFtZYrqMBJiYi5wb2xpY2llcy5kZWxldGWQ6jACmOowAYLT5JMCuQFaIiogL3YxL3tuYW1lPXByb2plY3RzLyovcG9saWNpZXMvKn1aJiokL3YxL3tuYW1lPWVudmlyb25tZW50cy8qL3BvbGljaWVzLyp9WiMqIS92MS97bmFtZT1pbnN0YW5jZXMvKi9wb2xpY2llcy8qfVovKi0vdjEve25hbWU9aW5zdGFuY2VzLyovZGF0YWJhc2VzLyovcG9saWNpZXMvKn0qFS92MS97bmFtZT1wb2xpY2llcy8qfUKrAQoPY29tLmJ5dGViYXNlLnYxQhVPcmdQb2xpY3lTZXJ2aWNlUHJvdG9QAVo0Z2l0aHViLmNvbS9ieXRlYmFzZS9ieXRlYmFzZS9iYWNrZW5kL2dlbmVyYXRlZC1nby92MaICA0JYWKoCC0J5dGViYXNlLlYxygILQnl0ZWJhc2VcVjHiAhdCeXRlYmFzZVxWMVxHUEJNZXRhZGF0YeoCDEJ5dGViYXNlOjpWMWIGcHJvdG8z", [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.@@ -80,20 +80,6 @@ export const RolloutPolicySchema = /*@__PURE__*/export const QueryDataPolicySchema = /*@__PURE__*/messageDesc(file_v1_org_policy_service, 8);-/**- * Describes the enum bytebase.v1.QueryDataPolicy.Restriction.- */-export const QueryDataPolicy_RestrictionSchema = /*@__PURE__*/- enumDesc(file_v1_org_policy_service, 8, 0);--/**- * Restriction level for admin data source access.- *- * @generated from enum bytebase.v1.QueryDataPolicy.Restriction- */-export const QueryDataPolicy_Restriction = /*@__PURE__*/- tsEnum(QueryDataPolicy_RestrictionSchema);-/*** Describes the message bytebase.v1.MaskingExemptionPolicy.* Use `create(MaskingExemptionPolicySchema)` to create a new message.diff --git a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts b/frontend/src/types/proto-es/v1/setting_service_pb.d.tsindex 15ef9a94ae..d0db206f5f 100644--- a/frontend/src/types/proto-es/v1/setting_service_pb.d.ts+++ b/frontend/src/types/proto-es/v1/setting_service_pb.d.ts@@ -612,6 +612,14 @@ export declare type WorkspaceProfileSetting = Message<"bytebase.v1.WorkspaceProf* @generated from field: bool enable_debug = 19;*/enableDebug: boolean;++ /**+ * The maximum result size limit in bytes for query and export, works for the SQL Editor and Export Center.+ * The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.+ *+ * @generated from field: int64 sql_result_size = 20;+ */+ sqlResultSize: bigint;};/**diff --git a/frontend/src/types/proto-es/v1/setting_service_pb.js b/frontend/src/types/proto-es/v1/setting_service_pb.jsindex 4579c3b041..10e98c2f2c 100644--- a/frontend/src/types/proto-es/v1/setting_service_pb.js+++ b/frontend/src/types/proto-es/v1/setting_service_pb.js@@ -17,7 +17,7 @@ import { file_v1_issue_service } from "./issue_service_pb";* Describes the file v1/setting_service.proto.*/export const file_v1_setting_service = /*@__PURE__*/- fileDesc("Chh2MS9zZXR0aW5nX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIhUKE0xpc3RTZXR0aW5nc1JlcXVlc3QiPgoUTGlzdFNldHRpbmdzUmVzcG9uc2USJgoIc2V0dGluZ3MYASADKAsyFC5ieXRlYmFzZS52MS5TZX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YxLkxpc3RTZXR0aW5nc1Jlc3BvbnNlIi/aQQCK6jAQYmIuc2V0dGluZ3MubGlzdJDqMAGC0+STAg4SDC92MS9zZXR0aW5ncxJ/CgpHZXRTZXR0aW5nEh4uYnl0ZWJhc2UudjEuR2V0U2V0dGluZ1JlcXVlc3QaFC5ieXRlYmFzZS52MS5TZXR0aW5nIjvaQQRuYW1liuowD2JiLnNldHRpbmdzLmdldJDqMAKC0+STAhcSFS92MS97bmFtZT1zZXR0aW5ncy8qfRKTAQoNVXBkYXRlU2V0dGluZxIhLmJ5dGViYXNlLnYxLlVwZGF0ZVNldHRpbmdSZXF1ZXN0GhQuYnl0ZWJhc2UudjEuU2V0dGluZyJJiuowD2JiLnNldHRpbmdzLnNldJDqMAKY6jABgtPkkwIoOgdzZXR0aW5nMh0vdjEve3NldHRpbmcubmFtZT1zZXR0aW5ncy8qfUKpAQoPY29tLmJ5dGViYXNlLnYxQhNTZXR0aW5nU2VydmljZVByb3RvUAFaNGdpdGh1Yi5jb20vYnl0ZWJhc2UvYnl0ZWJhc2UvYmFja2VuZC9nZW5lcmF0ZWQtZ28vdjGiAgNCWFiqAgtCeXRlYmFzZS5WMcoCC0J5dGViYXNlXFYx4gIXQnl0ZWJhc2VcVjFcR1BCTWV0YWRhdGHqAgxCeXRlYmFzZTo6VjFiBnByb3RvMw", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation, file_v1_common, file_v1_issue_service]);+ fileDesc("Chh2MS9zZXR0aW5nX3NlcnZpY2UucHJvdG8SC2J5dGViYXNlLnYxIhUKE0xpc3RTZXR0aW5nc1JlcXVlc3QiPgoUTGlzdFNldHRpbmdzUmVzcG9uc2USJgoIc2V0dGluZ3MYASADKAsyFC5ieXRlYmFzZS52MS5TZXR0aW5nIj8KEUdldFNldHRpbmdSZXF1ZXN0EioKBG5hbWUYASABKAlCHOBBAvpBFgoUYnl0ZWJ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NSZXNwb25zZSIv2kEAiuowEGJiLnNldHRpbmdzLmxpc3SQ6jABgtPkkwIOEgwvdjEvc2V0dGluZ3MSfwoKR2V0U2V0dGluZxIeLmJ5dGViYXNlLnYxLkdldFNldHRpbmdSZXF1ZXN0GhQuYnl0ZWJhc2UudjEuU2V0dGluZyI72kEEbmFtZYrqMA9iYi5zZXR0aW5ncy5nZXSQ6jACgtPkkwIXEhUvdjEve25hbWU9c2V0dGluZ3MvKn0SkwEKDVVwZGF0ZVNldHRpbmcSIS5ieXRlYmFzZS52MS5VcGRhdGVTZXR0aW5nUmVxdWVzdBoULmJ5dGViYXNlLnYxLlNldHRpbmciSYrqMA9iYi5zZXR0aW5ncy5zZXSQ6jACmOowAYLT5JMCKDoHc2V0dGluZzIdL3YxL3tzZXR0aW5nLm5hbWU9c2V0dGluZ3MvKn1CqQEKD2NvbS5ieXRlYmFzZS52MUITU2V0dGluZ1NlcnZpY2VQcm90b1ABWjRnaXRodWIuY29tL2J5dGViYXNlL2J5dGViYXNlL2JhY2tlbmQvZ2VuZXJhdGVkLWdvL3YxogIDQlhYqgILQnl0ZWJhc2UuVjHKAgtCeXRlYmFzZVxWMeICF0J5dGViYXNlXFYxXEdQQk1ldGFkYXRh6gIMQnl0ZWJhc2U6OlYxYgZwcm90bzM", [file_google_api_annotations, file_google_api_client, file_google_api_field_behavior, file_google_api_resource, file_google_protobuf_duration, file_google_protobuf_field_mask, file_google_type_expr, file_v1_annotation, file_v1_common, file_v1_issue_service]);/*** Describes the message bytebase.v1.ListSettingsRequest.diff --git a/frontend/src/utils/sqlEditor.ts b/frontend/src/utils/sqlEditor.tsindex f1cf8e4f91..5af2ffe170 100644--- a/frontend/src/utils/sqlEditor.ts+++ b/frontend/src/utils/sqlEditor.ts@@ -1,7 +1,7 @@import dayjs from "dayjs";import { head } from "lodash-es";import { v1 as uuidv1 } from "uuid";-import { useDatabaseV1Store, useDataSourceRestrictionPolicy } from "@/store";+import { useDatabaseV1Store, useQueryDataPolicy } from "@/store";import type {QueryDataSourceType,SQLEditorConnection,@@ -19,7 +19,6 @@ import {DataSourceType,type InstanceResource,} from "@/types/proto-es/v1/instance_service_pb";-import { QueryDataPolicy_Restriction } from "@/types/proto-es/v1/org_policy_service_pb";import { wrapRefAsPromise } from "@/utils";import {extractDatabaseResourceName,@@ -132,32 +131,6 @@ export const isConnectedSQLEditorTab = (tab: SQLEditorTab) => {return database && isValidDatabaseName(database.name);};-const getDataSourceBehavior = async (database: Database) => {- const { ready, dataSourceRestriction } =- useDataSourceRestrictionPolicy(database);- await wrapRefAsPromise(ready, /* expected */ true);-- let behavior: "RO" | "FALLBACK" | "ALLOW_ADMIN";- if (- dataSourceRestriction.value.environmentPolicy ===- QueryDataPolicy_Restriction.DISALLOW ||- dataSourceRestriction.value.projectPolicy ===- QueryDataPolicy_Restriction.DISALLOW- ) {- behavior = "RO";- } else if (- dataSourceRestriction.value.environmentPolicy ===- QueryDataPolicy_Restriction.FALLBACK ||- dataSourceRestriction.value.projectPolicy ===- QueryDataPolicy_Restriction.FALLBACK- ) {- behavior = "FALLBACK";- } else {- behavior = "ALLOW_ADMIN";- }- return behavior;-};-export const getValidDataSourceByPolicy = async (database: Database,type?: QueryDataSourceType@@ -170,24 +143,18 @@ export const getValidDataSourceByPolicy = async ((ds) => ds.type === DataSourceType.READ_ONLY);- const behavior = await getDataSourceBehavior(database);+ const { ready, policy } = useQueryDataPolicy();+ await wrapRefAsPromise(ready, /* expected */ true);- switch (behavior) {- case "ALLOW_ADMIN":- // ALLOW_ADMIN means no policy restriction.- case "FALLBACK": {- // FALLBACK means try to use read-only data source, it can also accept admin data source if no read-only data source exists.- switch (type) {- case DataSourceType.ADMIN:- return adminDataSource.id;- default:- // try to use read-only data source first.- return head(readonlyDataSources)?.id ?? adminDataSource.id;- }- }- case "RO": {- // RO only accept the read-only data source.- return head(readonlyDataSources)?.id;+ if (policy.value.allowAdminDataSource) {+ switch (type) {+ case DataSourceType.ADMIN:+ return adminDataSource.id;+ default:+ // try to use read-only data source first.+ return head(readonlyDataSources)?.id ?? adminDataSource.id;}}++ return head(readonlyDataSources)?.id ?? adminDataSource.id;};diff --git a/frontend/src/views/SettingWorkspaceGeneral.vue b/frontend/src/views/SettingWorkspaceGeneral.vueindex 72576238fa..0e7e8e3f50 100644--- a/frontend/src/views/SettingWorkspaceGeneral.vue+++ b/frontend/src/views/SettingWorkspaceGeneral.vue@@ -16,6 +16,10 @@ref="securitySettingRef":title="$t('settings.general.workspace.security')"/>+ <SQLEditorSetting+ ref="sqlEditorSettingRef"+ :title="$t('sql-editor.self')"+ /><AIAugmentationSettingref="aiAugmentationSettingRef":title="$t('settings.general.workspace.ai-assistant.self')"@@ -76,6 +80,7 @@ import {GeneralSetting,ProductImprovementSetting,SecuritySetting,+ SQLEditorSetting,} from "@/components/GeneralSetting";import PermissionGuardWrapper from "@/components/Permission/PermissionGuardWrapper.vue";import { useRouteChangeGuard } from "@/composables/useRouteChangeGuard";@@ -89,6 +94,7 @@ const accountSettingRef = ref<InstanceType<typeof AccountSetting>>();const generalSettingRef = ref<InstanceType<typeof GeneralSetting>>();const brandingSettingRef = ref<InstanceType<typeof BrandingSetting>>();const securitySettingRef = ref<InstanceType<typeof SecuritySetting>>();+const sqlEditorSettingRef = ref<InstanceType<typeof SQLEditorSetting>>();const aiAugmentationSettingRef =ref<InstanceType<typeof AIAugmentationSetting>>();const announcementSettingRef = ref<InstanceType<typeof AnnouncementSetting>>();@@ -103,6 +109,7 @@ const settingRefList = computed(() => {generalSettingRef,brandingSettingRef,securitySettingRef,+ sqlEditorSettingRef,aiAugmentationSettingRef,announcementSettingRef,productImprovementSettingRef,diff --git a/frontend/src/views/SettingWorkspaceUsers.vue b/frontend/src/views/SettingWorkspaceUsers.vueindex f93612a58f..9d10414199 100644--- a/frontend/src/views/SettingWorkspaceUsers.vue+++ b/frontend/src/views/SettingWorkspaceUsers.vue@@ -29,7 +29,6 @@:show-roles="false":user-list="list":loading="loading"- :on-click-user="onUserClick"@select-group="handleUpdateGroup"@update-user="handleUserUpdated"/>@@ -55,7 +54,6 @@<UserDataTableByGroup:groups="list":loading="loading"- :on-click-user="onUserClick"v-model:expanded-keys="expandedKeys"@update-group="handleUpdateGroup"@remove-group="handleRemoveGroup"@@ -227,7 +225,6 @@ import UserDataTable from "@/components/User/Settings/UserDataTable/index.vue";import UserDataTableByGroup from "@/components/User/Settings/UserDataTableByGroup/index.vue";import { SearchBox } from "@/components/v2";import PagedTable from "@/components/v2/Model/PagedTable.vue";-import { WORKSPACE_ROUTE_USER_PROFILE } from "@/router/dashboard/workspaceRoutes";import { SETTING_ROUTE_WORKSPACE_GENERAL } from "@/router/dashboard/workspaceSetting";import {featureToRef,@@ -261,10 +258,6 @@ type LocalState = {editingGroup?: Group;};-const props = defineProps<{- onClickUser?: (user: User, event: MouseEvent) => void;-}>();-const state = reactive<LocalState>({typeTab: defaultTab,activeUserFilterText: "",@@ -482,16 +475,4 @@ const handleGroupUpdated = (group: Group) => {expandedKeys.value = [...expanded];});};--const onUserClick = (user: User, event: MouseEvent) => {- if (props.onClickUser) {- return props.onClickUser(user, event);- }- router.push({- name: WORKSPACE_ROUTE_USER_PROFILE,- params: {- principalEmail: user.email,- },- });-};</script>diff --git a/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vue b/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vueindex 3a6eb6016c..cfe73b5d47 100644--- a/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vue+++ b/frontend/src/views/sql-editor/EditorCommon/QueryContextSettingPopover.vue@@ -88,7 +88,7 @@<MaxRowCountSelectv-model:value="resultRowsLimit":quaternary="true"- :maximum-export-count="maximumResultRows"+ :maximum-export-count="policy.maximumResultRows"/></div></div>@@ -109,10 +109,7 @@ import {useSQLEditorStore,useSQLEditorTabStore,} from "@/store";-import {- useDataSourceRestrictionPolicy,- useEffectiveQueryDataPolicyForProject,-} from "@/store/modules/v1/policy";+import { useQueryDataPolicy } from "@/store/modules/v1/policy";import { isValidDatabaseName } from "@/types";import { Engine } from "@/types/proto-es/v1/common_pb";import type { DataSource } from "@/types/proto-es/v1/instance_service_pb";@@ -120,7 +117,6 @@ import {DataSource_RedisType,DataSourceType,} from "@/types/proto-es/v1/instance_service_pb";-import { QueryDataPolicy_Restriction } from "@/types/proto-es/v1/org_policy_service_pb";import { QueryOption_RedisRunCommandsOn } from "@/types/proto-es/v1/sql_service_pb";import {getInstanceResource,@@ -136,18 +132,11 @@ const { t } = useI18n();const tabStore = useSQLEditorTabStore();const { connection, database } = useConnectionOfCurrentSQLEditorTab();-const { redisCommandOption, resultRowsLimit, project } = storeToRefs(+const { redisCommandOption, resultRowsLimit } = storeToRefs(useSQLEditorStore());-const { policy: effectiveQueryDataPolicy } =- useEffectiveQueryDataPolicyForProject(project);--const { dataSourceRestriction } = useDataSourceRestrictionPolicy(database);--const maximumResultRows = computed(() => {- return effectiveQueryDataPolicy.value.maximumResultRows;-});+const { policy } = useQueryDataPolicy();const show = computed(() => {return tabStore.currentTab?.mode !== "ADMIN";@@ -179,34 +168,21 @@ const dataSources = computed(() => {const dataSourceUnaccessibleReason = (dataSource: DataSource): string | undefined => {- if (dataSource.type === DataSourceType.ADMIN) {- if (- dataSourceRestriction.value.environmentPolicy ===- QueryDataPolicy_Restriction.DISALLOW ||- dataSourceRestriction.value.projectPolicy ===- QueryDataPolicy_Restriction.DISALLOW- ) {- return t(- "sql-editor.query-context.admin-data-source-is-disallowed-to-query"- );- }- const readOnlyDataSources = dataSources.value.filter(- (ds) => ds.type === DataSourceType.READ_ONLY- );- if (- readOnlyDataSources.length > 0 &&- (dataSourceRestriction.value.environmentPolicy ===- QueryDataPolicy_Restriction.FALLBACK ||- dataSourceRestriction.value.projectPolicy ===- QueryDataPolicy_Restriction.FALLBACK)- ) {- return t(- "sql-editor.query-context.admin-data-source-is-disallowed-to-query-when-read-only-data-source-is-available"- );- }+ if (policy.value.allowAdminDataSource) {+ return undefined;+ }+ if (dataSource.type !== DataSourceType.ADMIN) {+ return undefined;+ }++ const readOnlyDataSources = dataSources.value.filter(+ (ds) => ds.type === DataSourceType.READ_ONLY+ );+ if (readOnlyDataSources.length === 0) {+ return undefined;}- return undefined;+ return t("sql-editor.query-context.admin-data-source-is-disallowed-to-query");};const onDataSourceSelected = (dataSourceId?: string) => {@@ -233,8 +209,8 @@ watch();watchEffect(() => {- if (resultRowsLimit.value > maximumResultRows.value) {- resultRowsLimit.value = maximumResultRows.value;+ if (resultRowsLimit.value > policy.value.maximumResultRows) {+ resultRowsLimit.value = policy.value.maximumResultRows;}});</script>diff --git a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vueindex d81982f3f7..d49b0e4b86 100644--- a/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue+++ b/frontend/src/views/sql-editor/EditorCommon/ResultView/ResultViewV1.vue@@ -173,8 +173,7 @@ import {NTabs,NTooltip,} from "naive-ui";-import { storeToRefs } from "pinia";-import { computed, ref, toRef, watchEffect } from "vue";+import { computed, ref, toRef } from "vue";import { useI18n } from "vue-i18n";import { darkThemeOverrides } from "@/../naive-ui.config";import { BBSpin } from "@/bbkit";@@ -187,10 +186,10 @@ import type {import DataExportButton from "@/components/DataExportButton.vue";import { parseStringToResource } from "@/components/GrantRequestPanel/DatabaseResourceForm/common";import { Drawer } from "@/components/v2";-import { useSQLEditorStore, useSQLEditorTabStore, useSQLStore } from "@/store";+import { useSQLEditorTabStore, useSQLStore } from "@/store";import {- useEffectiveQueryDataPolicyForProject,usePolicyV1Store,+ useQueryDataPolicy,} from "@/store/modules/v1/policy";import type {DatabaseResource,@@ -199,7 +198,6 @@ import type {} from "@/types";import { ExportFormat } from "@/types/proto-es/v1/common_pb";import type { Database } from "@/types/proto-es/v1/database_service_pb";-import { PolicyType } from "@/types/proto-es/v1/org_policy_service_pb";import { ExportRequestSchema } from "@/types/proto-es/v1/sql_service_pb";import { extractDatabaseResourceName } from "@/utils";import type { SQLResultViewContext } from "./context";@@ -237,20 +235,8 @@ defineEmits<{const { t } = useI18n();const policyStore = usePolicyV1Store();const tabStore = useSQLEditorTabStore();-const { project } = storeToRefs(useSQLEditorStore());-const { policy: effectiveQueryDataPolicy } =- useEffectiveQueryDataPolicyForProject(project);--watchEffect(() => {- const environment = props.database.effectiveEnvironment;- if (environment) {- policyStore.getOrFetchPolicyByParentAndType({- parentPath: environment,- policyType: PolicyType.DATA_QUERY,- });- }-});+const { policy: effectiveQueryDataPolicy } = useQueryDataPolicy();const detail: SQLResultViewContext["detail"] = ref(undefined);diff --git a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vueindex 1c9c6a929a..55f703323d 100644--- a/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue+++ b/frontend/src/views/sql-editor/EditorPanel/ResultPanel/BatchQuerySelect.vue@@ -126,11 +126,10 @@ import { t } from "@/plugins/i18n";import {pushNotification,useDatabaseV1Store,- useSQLEditorStore,useSQLEditorTabStore,useSQLStore,} from "@/store";-import { useEffectiveQueryDataPolicyForProject } from "@/store/modules/v1/policy";+import { useQueryDataPolicy } from "@/store/modules/v1/policy";import type { SQLEditorDatabaseQueryContext } from "@/types";import { ExportFormat } from "@/types/proto-es/v1/common_pb";import type { Database } from "@/types/proto-es/v1/database_service_pb";@@ -163,12 +162,10 @@ const { currentTab: tab } = storeToRefs(tabStore);const databaseStore = useDatabaseV1Store();const sqlStore = useSQLStore();const showEmpty = ref<boolean>(true);-const { project } = storeToRefs(useSQLEditorStore());const contextMenu = provideResultTabListContext();const contextMenuRef = ref<InstanceType<typeof ContextMenu>>();-const { policy: effectiveQueryDataPolicy } =- useEffectiveQueryDataPolicyForProject(project);+const { policy: effectiveQueryDataPolicy } = useQueryDataPolicy();const selectedDatabaseNameList = ref<string[]>([]);diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yamlindex 22c1b0e377..ce37be5aff 100644--- a/proto/gen/grpc-doc/openapi.yaml+++ b/proto/gen/grpc-doc/openapi.yaml@@ -18103,55 +18103,54 @@ components:properties:timeout:title: timeout- description: The query timeout duration.- $ref: '#/components/schemas/google.protobuf.Duration'- disableExport:- type: boolean- title: disable_export- description: Disable data export in the SQL editor.- maximumResultSize:- type:- - integer- - string- title: maximum_result_size- format: int64description: |-- The maximum result size limit in bytes.- The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.+ workspace-level policy+ The query timeout duration in the SQL editor.+ $ref: '#/components/schemas/google.protobuf.Duration'maximumResultRows:type: integertitle: maximum_result_rowsformat: int32description: |-- The maximum number of rows to return.+ workspace-level policy+ The maximum number of rows to return in the SQL editor.The default value is -1, means no limit.+ disableExport:+ type: boolean+ title: disable_export+ description: |-+ workspace-level policy+ Disable data export in the SQL editor.disableCopyData:type: booleantitle: disable_copy_data- description: Disable copying query results.- adminDataSourceRestriction:- title: admin_data_source_restriction- description: Restriction for admin data source queries.- $ref: '#/components/schemas/bytebase.v1.QueryDataPolicy.Restriction'+ description: |-+ workspace-level policy+ Disable copying query results in the SQL editor.+ allowAdminDataSource:+ type: boolean+ title: allow_admin_data_source+ description: |-+ workspace-level policy+ Allow using the admin data source to query in the SQL editor.+ If true, users can select the admin data source or read-only data source+ If false,+ 1. when read-only data source is configured, users're force to use the read-only data source+ 2. otherwise fallback to use the admin data source.disallowDdl:type: booleantitle: disallow_ddl- description: Disallow running DDL statements in the SQL editor.+ description: |-+ ================+ Deprecate following fields.+ Disallow running DDL statements in the SQL editor.disallowDml:type: booleantitle: disallow_dmldescription: Disallow running DML statements in the SQL editor.title: QueryDataPolicyadditionalProperties: false- description: QueryDataPolicy is the policy configuration for querying data.- bytebase.v1.QueryDataPolicy.Restriction:- type: string- title: Restriction- enum:- - RESTRICTION_UNSPECIFIED- - FALLBACK- - DISALLOW- description: Restriction level for admin data source access.+ description: QueryDataPolicy is the policy configuration for querying data in the SQL Editor.bytebase.v1.QueryHistory:type: objectproperties:@@ -22797,6 +22796,15 @@ components:type: booleantitle: enable_debugdescription: Whether debug mode is enabled.+ sqlResultSize:+ type:+ - integer+ - string+ title: sql_result_size+ format: int64+ description: |-+ The maximum result size limit in bytes for query and export, works for the SQL Editor and Export Center.+ The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.title: WorkspaceProfileSettingadditionalProperties: falsebytebase.v1.WorkspaceProfileSetting.PasswordRestriction:diff --git a/proto/gen/grpc-doc/store/README.md b/proto/gen/grpc-doc/store/README.mdindex 0f322165d0..3a015be4d2 100644--- a/proto/gen/grpc-doc/store/README.md+++ b/proto/gen/grpc-doc/store/README.md@@ -190,7 +190,6 @@- [Policy.Resource](#bytebase-store-Policy-Resource)- [Policy.Type](#bytebase-store-Policy-Type)- - [QueryDataPolicy.Restriction](#bytebase-store-QueryDataPolicy-Restriction)- [store/project.proto](#store_project-proto)- [Label](#bytebase-store-Label)@@ -3204,18 +3203,17 @@ For example: resource.instance_id == "local" && resource.databas<a name="bytebase-store-QueryDataPolicy"></a>### QueryDataPolicy-QueryDataPolicy is the policy configuration for querying data.+QueryDataPolicy is the policy configuration for querying data in the SQL Editor.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| timeout | [google.protobuf.Duration](#google-protobuf-Duration) | | The query timeout duration. |-| disable_export | [bool](#bool) | | Disable exporting data in the SQL editor. |-| maximum_result_size | [int64](#int64) | | The size limit in bytes. The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0. |-| maximum_result_rows | [int32](#int32) | | The return rows limit. The default value is -1, means no limit. |-| disable_copy_data | [bool](#bool) | | Disable copying data. |-| admin_data_source_restriction | [QueryDataPolicy.Restriction](#bytebase-store-QueryDataPolicy-Restriction) | | Restriction for admin data source queries. |-| disallow_ddl | [bool](#bool) | | Disallow running DDL statements in the SQL editor. |+| timeout | [google.protobuf.Duration](#google-protobuf-Duration) | | workspace-level policy The query timeout duration. |+| disable_export | [bool](#bool) | | workspace-level policy Disable exporting data in the SQL editor. |+| maximum_result_rows | [int32](#int32) | | workspace-level policy The return rows limit. The default value is -1, means no limit. |+| disable_copy_data | [bool](#bool) | | workspace-level policy Disable copying data. |+| allow_admin_data_source | [bool](#bool) | | workspace-level policy Allow using the admin data source to query in the SQL editor. |+| disallow_ddl | [bool](#bool) | | ================ Deprecate following fields. Disallow running DDL statements in the SQL editor. || disallow_dml | [bool](#bool) | | Disallow running DML statements in the SQL editor. |@@ -3302,19 +3300,6 @@ QueryDataPolicy is the policy configuration for querying data.| TAG | 6 | |--<a name="bytebase-store-QueryDataPolicy-Restriction"></a>--### QueryDataPolicy.Restriction---| Name | Number | Description |-| ---- | ------ | ----------- |-| RESTRICTION_UNSPECIFIED | 0 | |-| FALLBACK | 1 | Allow to query admin data sources when there is no read-only data source. |-| DISALLOW | 2 | Disallow to query admin data sources. |--@@ -4425,6 +4410,7 @@ The severity level for SQL review rules.| password_restriction | [WorkspaceProfileSetting.PasswordRestriction](#bytebase-store-WorkspaceProfileSetting-PasswordRestriction) | | Password restriction settings. || access_token_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | The duration for access token. Default is 1 hour. || enable_debug | [bool](#bool) | | Whether debug mode is enabled. |+| sql_result_size | [int64](#int64) | | The maximum result size limit in bytes for query and export, works for the SQL Editor and Export Center. The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0. |diff --git a/proto/gen/grpc-doc/store/index.html b/proto/gen/grpc-doc/store/index.htmlindex 997edec961..b9bae80a58 100644--- a/proto/gen/grpc-doc/store/index.html+++ b/proto/gen/grpc-doc/store/index.html@@ -924,10 +924,6 @@<a href="#bytebase.store.Policy.Type"><span class="badge">E</span>Policy.Type</a></li>- <li>- <a href="#bytebase.store.QueryDataPolicy.Restriction"><span class="badge">E</span>QueryDataPolicy.Restriction</a>- </li>-</ul>@@ -9155,7 +9151,7 @@ resource.instance_id == "local" && resource.database_name == <h3 id="bytebase.store.QueryDataPolicy">QueryDataPolicy</h3>- <p>QueryDataPolicy is the policy configuration for querying data.</p>+ <p>QueryDataPolicy is the policy configuration for querying data in the SQL Editor.</p><table class="field-table">@@ -9168,29 +9164,24 @@ resource.instance_id == "local" && resource.database_name == <td>timeout</td><td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td><td></td>- <td><p>The query timeout duration. </p></td>+ <td><p>workspace-level policy+The query timeout duration. </p></td></tr><tr><td>disable_export</td><td><a href="#bool">bool</a></td><td></td>- <td><p>Disable exporting data in the SQL editor. </p></td>- </tr>-- <tr>- <td>maximum_result_size</td>- <td><a href="#int64">int64</a></td>- <td></td>- <td><p>The size limit in bytes.-The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0. </p></td>+ <td><p>workspace-level policy+Disable exporting data in the SQL editor. </p></td></tr><tr><td>maximum_result_rows</td><td><a href="#int32">int32</a></td><td></td>- <td><p>The return rows limit.+ <td><p>workspace-level policy+The return rows limit.The default value is -1, means no limit. </p></td></tr>@@ -9198,21 +9189,25 @@ The default value is -1, means no limit. </p></td><td>disable_copy_data</td><td><a href="#bool">bool</a></td><td></td>- <td><p>Disable copying data. </p></td>+ <td><p>workspace-level policy+Disable copying data. </p></td></tr><tr>- <td>admin_data_source_restriction</td>- <td><a href="#bytebase.store.QueryDataPolicy.Restriction">QueryDataPolicy.Restriction</a></td>+ <td>allow_admin_data_source</td>+ <td><a href="#bool">bool</a></td><td></td>- <td><p>Restriction for admin data source queries. </p></td>+ <td><p>workspace-level policy+Allow using the admin data source to query in the SQL editor. </p></td></tr><tr><td>disallow_ddl</td><td><a href="#bool">bool</a></td><td></td>- <td><p>Disallow running DDL statements in the SQL editor. </p></td>+ <td><p>================+Deprecate following fields.+Disallow running DDL statements in the SQL editor. </p></td></tr><tr>@@ -9406,35 +9401,6 @@ For example, the environment resource can have the SQL review config tag, such a</tbody></table>- <h3 id="bytebase.store.QueryDataPolicy.Restriction">QueryDataPolicy.Restriction</h3>- <p></p>- <table class="enum-table">- <thead>- <tr><td>Name</td><td>Number</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>RESTRICTION_UNSPECIFIED</td>- <td>0</td>- <td><p></p></td>- </tr>-- <tr>- <td>FALLBACK</td>- <td>1</td>- <td><p>Allow to query admin data sources when there is no read-only data source.</p></td>- </tr>-- <tr>- <td>DISALLOW</td>- <td>2</td>- <td><p>Disallow to query admin data sources.</p></td>- </tr>-- </tbody>- </table>-@@ -12236,6 +12202,14 @@ Requires ENTERPRISE license. </p></td><td><p>Whether debug mode is enabled. </p></td></tr>+ <tr>+ <td>sql_result_size</td>+ <td><a href="#int64">int64</a></td>+ <td></td>+ <td><p>The maximum result size limit in bytes for query and export, works for the SQL Editor and Export Center.+The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0. </p></td>+ </tr>+</tbody></table>diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.mdindex 67fb782118..77111aa152 100644--- a/proto/gen/grpc-doc/v1/README.md+++ b/proto/gen/grpc-doc/v1/README.md@@ -399,7 +399,6 @@- [PolicyResourceType](#bytebase-v1-PolicyResourceType)- [PolicyType](#bytebase-v1-PolicyType)- - [QueryDataPolicy.Restriction](#bytebase-v1-QueryDataPolicy-Restriction)- [OrgPolicyService](#bytebase-v1-OrgPolicyService)@@ -2153,6 +2152,7 @@ For examples: resource.environment_id == "prod" && statement.aff| password_restriction | [WorkspaceProfileSetting.PasswordRestriction](#bytebase-v1-WorkspaceProfileSetting-PasswordRestriction) | | Password restriction settings. || access_token_duration | [google.protobuf.Duration](#google-protobuf-Duration) | | The duration for access token. Default is 1 hour. || enable_debug | [bool](#bool) | | Whether debug mode is enabled. |+| sql_result_size | [int64](#int64) | | The maximum result size limit in bytes for query and export, works for the SQL Editor and Export Center. The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0. |@@ -6619,18 +6619,17 @@ For example: resource.environment_id == "test" && resource.proje<a name="bytebase-v1-QueryDataPolicy"></a>### QueryDataPolicy-QueryDataPolicy is the policy configuration for querying data.+QueryDataPolicy is the policy configuration for querying data in the SQL Editor.| Field | Type | Label | Description || ----- | ---- | ----- | ----------- |-| timeout | [google.protobuf.Duration](#google-protobuf-Duration) | | The query timeout duration. |-| disable_export | [bool](#bool) | | Disable data export in the SQL editor. |-| maximum_result_size | [int64](#int64) | | The maximum result size limit in bytes. The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0. |-| maximum_result_rows | [int32](#int32) | | The maximum number of rows to return. The default value is -1, means no limit. |-| disable_copy_data | [bool](#bool) | | Disable copying query results. |-| admin_data_source_restriction | [QueryDataPolicy.Restriction](#bytebase-v1-QueryDataPolicy-Restriction) | | Restriction for admin data source queries. |-| disallow_ddl | [bool](#bool) | | Disallow running DDL statements in the SQL editor. |+| timeout | [google.protobuf.Duration](#google-protobuf-Duration) | | workspace-level policy The query timeout duration in the SQL editor. |+| maximum_result_rows | [int32](#int32) | | workspace-level policy The maximum number of rows to return in the SQL editor. The default value is -1, means no limit. |+| disable_export | [bool](#bool) | | workspace-level policy Disable data export in the SQL editor. |+| disable_copy_data | [bool](#bool) | | workspace-level policy Disable copying query results in the SQL editor. |+| allow_admin_data_source | [bool](#bool) | | workspace-level policy Allow using the admin data source to query in the SQL editor. If true, users can select the admin data source or read-only data source If false, 1. when read-only data source is configured, users're force to use the read-only data source 2. otherwise fallback to use the admin data source. |+| disallow_ddl | [bool](#bool) | | ================ Deprecate following fields. Disallow running DDL statements in the SQL editor. || disallow_dml | [bool](#bool) | | Disallow running DML statements in the SQL editor. |@@ -6735,19 +6734,6 @@ The type of organizational policy.| DATA_QUERY | 6 | Query data access policy. |--<a name="bytebase-v1-QueryDataPolicy-Restriction"></a>--### QueryDataPolicy.Restriction-Restriction level for admin data source access.--| Name | Number | Description |-| ---- | ------ | ----------- |-| RESTRICTION_UNSPECIFIED | 0 | Unspecified restriction. |-| FALLBACK | 1 | Allow querying admin data sources when there is no read-only data source. |-| DISALLOW | 2 | Disallow querying admin data sources. |--diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.htmlindex 38dfc6ff0b..67c6b99e4a 100644--- a/proto/gen/grpc-doc/v1/index.html+++ b/proto/gen/grpc-doc/v1/index.html@@ -1698,10 +1698,6 @@<a href="#bytebase.v1.PolicyType"><span class="badge">E</span>PolicyType</a></li>- <li>- <a href="#bytebase.v1.QueryDataPolicy.Restriction"><span class="badge">E</span>QueryDataPolicy.Restriction</a>- </li>-<li>@@ -6622,6 +6618,14 @@ Requires ENTERPRISE license. </p></td><td><p>Whether debug mode is enabled. </p></td></tr>+ <tr>+ <td>sql_result_size</td>+ <td><a href="#int64">int64</a></td>+ <td></td>+ <td><p>The maximum result size limit in bytes for query and export, works for the SQL Editor and Export Center.+The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0. </p></td>+ </tr>+</tbody></table>@@ -18752,7 +18756,7 @@ Database resource name: instances/instance-id/databases/database-name. </p></td><h3 id="bytebase.v1.QueryDataPolicy">QueryDataPolicy</h3>- <p>QueryDataPolicy is the policy configuration for querying data.</p>+ <p>QueryDataPolicy is the policy configuration for querying data in the SQL Editor.</p><table class="field-table">@@ -18765,51 +18769,54 @@ Database resource name: instances/instance-id/databases/database-name. </p></td><td>timeout</td><td><a href="#google.protobuf.Duration">google.protobuf.Duration</a></td><td></td>- <td><p>The query timeout duration. </p></td>+ <td><p>workspace-level policy+The query timeout duration in the SQL editor. </p></td></tr><tr>- <td>disable_export</td>- <td><a href="#bool">bool</a></td>+ <td>maximum_result_rows</td>+ <td><a href="#int32">int32</a></td><td></td>- <td><p>Disable data export in the SQL editor. </p></td>+ <td><p>workspace-level policy+The maximum number of rows to return in the SQL editor.+The default value is -1, means no limit. </p></td></tr><tr>- <td>maximum_result_size</td>- <td><a href="#int64">int64</a></td>+ <td>disable_export</td>+ <td><a href="#bool">bool</a></td><td></td>- <td><p>The maximum result size limit in bytes.-The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0. </p></td>- </tr>-- <tr>- <td>maximum_result_rows</td>- <td><a href="#int32">int32</a></td>- <td></td>- <td><p>The maximum number of rows to return.-The default value is -1, means no limit. </p></td>+ <td><p>workspace-level policy+Disable data export in the SQL editor. </p></td></tr><tr><td>disable_copy_data</td><td><a href="#bool">bool</a></td><td></td>- <td><p>Disable copying query results. </p></td>+ <td><p>workspace-level policy+Disable copying query results in the SQL editor. </p></td></tr><tr>- <td>admin_data_source_restriction</td>- <td><a href="#bytebase.v1.QueryDataPolicy.Restriction">QueryDataPolicy.Restriction</a></td>+ <td>allow_admin_data_source</td>+ <td><a href="#bool">bool</a></td><td></td>- <td><p>Restriction for admin data source queries. </p></td>+ <td><p>workspace-level policy+Allow using the admin data source to query in the SQL editor.+If true, users can select the admin data source or read-only data source+If false,+1. when read-only data source is configured, users're force to use the read-only data source+2. otherwise fallback to use the admin data source. </p></td></tr><tr><td>disallow_ddl</td><td><a href="#bool">bool</a></td><td></td>- <td><p>Disallow running DDL statements in the SQL editor. </p></td>+ <td><p>================+Deprecate following fields.+Disallow running DDL statements in the SQL editor. </p></td></tr><tr>@@ -19043,35 +19050,6 @@ In this situation, `update_mask` is ignored. </p></td></tbody></table>- <h3 id="bytebase.v1.QueryDataPolicy.Restriction">QueryDataPolicy.Restriction</h3>- <p>Restriction level for admin data source access.</p>- <table class="enum-table">- <thead>- <tr><td>Name</td><td>Number</td><td>Description</td></tr>- </thead>- <tbody>-- <tr>- <td>RESTRICTION_UNSPECIFIED</td>- <td>0</td>- <td><p>Unspecified restriction.</p></td>- </tr>-- <tr>- <td>FALLBACK</td>- <td>1</td>- <td><p>Allow querying admin data sources when there is no read-only data source.</p></td>- </tr>-- <tr>- <td>DISALLOW</td>- <td>2</td>- <td><p>Disallow querying admin data sources.</p></td>- </tr>-- </tbody>- </table>-diff --git a/proto/store/store/policy.proto b/proto/store/store/policy.protoindex f1c441efeb..9714e6aee6 100644--- a/proto/store/store/policy.proto+++ b/proto/store/store/policy.proto@@ -101,35 +101,33 @@ message IamPolicy {repeated Binding bindings = 1;}-// QueryDataPolicy is the policy configuration for querying data.+// QueryDataPolicy is the policy configuration for querying data in the SQL Editor.message QueryDataPolicy {+ reserved 3;++ // workspace-level policy// The query timeout duration.google.protobuf.Duration timeout = 1;+ // workspace-level policy// Disable exporting data in the SQL editor.bool disable_export = 2;- // The size limit in bytes.- // The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.- int64 maximum_result_size = 3;-+ // workspace-level policy// The return rows limit.// The default value is -1, means no limit.int32 maximum_result_rows = 4;+ // workspace-level policy// Disable copying data.bool disable_copy_data = 5;- enum Restriction {- RESTRICTION_UNSPECIFIED = 0;- // Allow to query admin data sources when there is no read-only data source.- FALLBACK = 1;- // Disallow to query admin data sources.- DISALLOW = 2;- }- // Restriction for admin data source queries.- Restriction admin_data_source_restriction = 6;+ // workspace-level policy+ // Allow using the admin data source to query in the SQL editor.+ bool allow_admin_data_source = 9;+ // ================+ // Deprecate following fields.// Disallow running DDL statements in the SQL editor.bool disallow_ddl = 7;// Disallow running DML statements in the SQL editor.diff --git a/proto/store/store/setting.proto b/proto/store/store/setting.protoindex bd97f79c96..d732642669 100644--- a/proto/store/store/setting.proto+++ b/proto/store/store/setting.proto@@ -135,6 +135,10 @@ message WorkspaceProfileSetting {// Whether debug mode is enabled.bool enable_debug = 19;++ // The maximum result size limit in bytes for query and export, works for the SQL Editor and Export Center.+ // The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.+ int64 sql_result_size = 20;}message WorkspaceApprovalSetting {diff --git a/proto/v1/v1/org_policy_service.proto b/proto/v1/v1/org_policy_service.protoindex 331a819f03..5111e92be4 100644--- a/proto/v1/v1/org_policy_service.proto+++ b/proto/v1/v1/org_policy_service.proto@@ -281,37 +281,35 @@ message RolloutPolicy {repeated string roles = 2;}-// QueryDataPolicy is the policy configuration for querying data.+// QueryDataPolicy is the policy configuration for querying data in the SQL Editor.message QueryDataPolicy {- // The query timeout duration.+ // workspace-level policy+ // The query timeout duration in the SQL editor.google.protobuf.Duration timeout = 1;- // Disable data export in the SQL editor.- bool disable_export = 2;-- // The maximum result size limit in bytes.- // The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.- int64 maximum_result_size = 3;-- // The maximum number of rows to return.+ // workspace-level policy+ // The maximum number of rows to return in the SQL editor.// The default value is -1, means no limit.- int32 maximum_result_rows = 4;-- // Disable copying query results.- bool disable_copy_data = 5;-- // Restriction level for admin data source access.- enum Restriction {- // Unspecified restriction.- RESTRICTION_UNSPECIFIED = 0;- // Allow querying admin data sources when there is no read-only data source.- FALLBACK = 1;- // Disallow querying admin data sources.- DISALLOW = 2;- }- // Restriction for admin data source queries.- Restriction admin_data_source_restriction = 6;+ int32 maximum_result_rows = 2;+ // workspace-level policy+ // Disable data export in the SQL editor.+ bool disable_export = 3;++ // workspace-level policy+ // Disable copying query results in the SQL editor.+ bool disable_copy_data = 4;++ // workspace-level policy+ // Allow using the admin data source to query in the SQL editor.+ // If true, users can select the admin data source or read-only data source+ // If false,+ // 1. when read-only data source is configured, users're force to use the read-only data source+ // 2. otherwise fallback to use the admin data source.+ bool allow_admin_data_source = 5;++ // ================+ // Deprecate following fields.// Disallow running DDL statements in the SQL editor.bool disallow_ddl = 7;// Disallow running DML statements in the SQL editor.diff --git a/proto/v1/v1/setting_service.proto b/proto/v1/v1/setting_service.protoindex 1bef0e0d50..76b17e8f75 100644--- a/proto/v1/v1/setting_service.proto+++ b/proto/v1/v1/setting_service.proto@@ -245,6 +245,10 @@ message WorkspaceProfileSetting {// Whether debug mode is enabled.bool enable_debug = 19;++ // The maximum result size limit in bytes for query and export, works for the SQL Editor and Export Center.+ // The default value is 100MB, we will use the default value if the setting not exists, or the limit <= 0.+ int64 sql_result_size = 20;}message Announcement {