Skip to content

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

chore: deprecate the request.row_limit (#17673)

ecmadaoe09f4b57f405
diff --git a/backend/api/v1/sql_service.go b/backend/api/v1/sql_service.go
index b0fc26279e..49061fc713 100644
--- a/backend/api/v1/sql_service.go
+++ b/backend/api/v1/sql_service.go
@@ -271,7 +271,7 @@ func (s *SQLService) Query(ctx context.Context, req *connect.Request[v1pb.QueryR
for _, result := range results {
// AllowExport is a validate only check.
- checkErr := s.accessCheck(ctx, instance, database, user, spans, int(result.RowsCount), request.Explain)
+ checkErr := s.accessCheck(ctx, instance, database, user, spans, request.Explain)
result.AllowExport = checkErr == nil
}
@@ -312,7 +312,7 @@ func getMaximumSQLResultLimit(
return value
}
-type accessCheckFunc func(context.Context, *store.InstanceMessage, *store.DatabaseMessage, *store.UserMessage, []*parserbase.QuerySpan, int, bool /* isExplain */) error
+type accessCheckFunc func(context.Context, *store.InstanceMessage, *store.DatabaseMessage, *store.UserMessage, []*parserbase.QuerySpan, bool /* isExplain */) error
func extractSourceTable(comment string) (string, string, string, error) {
pattern := `\((\w+),\s*(\w+)(?:,\s*(\w+))?\)`
@@ -479,7 +479,7 @@ func queryRetry(
}
if optionalAccessCheck != nil {
// Check query access
- if err := optionalAccessCheck(ctx, instance, database, user, spans, queryContext.Limit, queryContext.Explain); err != nil {
+ if err := optionalAccessCheck(ctx, instance, database, user, spans, queryContext.Explain); err != nil {
return nil, nil, time.Duration(0), err
}
slog.Debug("optional access check", slog.String("instance", instance.ResourceID), slog.String("database", database.DatabaseName))
@@ -929,7 +929,7 @@ func DoExport(
}
if len(results) == 1 {
if optionalAccessCheck != nil {
- if err := optionalAccessCheck(ctx, instance, database, user, spans, int(results[0].RowsCount), queryContext.Explain); err != nil {
+ if err := optionalAccessCheck(ctx, instance, database, user, spans, queryContext.Explain); err != nil {
return nil, duration, err
}
}
@@ -1378,7 +1378,6 @@ func (s *SQLService) accessCheck(
database *store.DatabaseMessage,
user *store.UserMessage,
spans []*parserbase.QuerySpan,
- limit int,
isExplain bool,
) error {
project, err := s.store.GetProjectV2(ctx, &store.FindProjectMessage{ResourceID: &database.ProjectID})
@@ -1430,7 +1429,6 @@ func (s *SQLService) accessCheck(
for column := range span.SourceColumns {
attributes := map[string]any{
common.CELAttributeRequestTime: time.Now(),
- common.CELAttributeRequestRowLimit: limit,
common.CELAttributeResourceDatabase: common.FormatDatabase(instance.ResourceID, column.Database),
common.CELAttributeResourceSchemaName: column.Schema,
common.CELAttributeResourceTableName: column.Table,
diff --git a/backend/common/cel.go b/backend/common/cel.go
index 3af5178270..a27ce463b3 100644
--- a/backend/common/cel.go
+++ b/backend/common/cel.go
@@ -47,7 +47,6 @@ var IAMPolicyConditionCELAttributes = []cel.EnvOption{
cel.Variable(CELAttributeResourceDatabase, cel.StringType),
cel.Variable(CELAttributeResourceSchemaName, cel.StringType),
cel.Variable(CELAttributeResourceTableName, cel.StringType),
- cel.Variable(CELAttributeRequestRowLimit, cel.IntType),
cel.Variable(CELAttributeRequestTime, cel.TimestampType),
cel.ParserExpressionSizeLimit(celLimit),
}
diff --git a/backend/common/cel_attributes.go b/backend/common/cel_attributes.go
index 48c5ce251e..3f60eb66d4 100644
--- a/backend/common/cel_attributes.go
+++ b/backend/common/cel_attributes.go
@@ -45,8 +45,6 @@ const (
CELAttributeRequestExpirationDays = "request.expiration_days"
// CELAttributeRequestRole is the requested role.
CELAttributeRequestRole = "request.role"
- // CELAttributeRequestRowLimit is the maximum number of rows requested.
- CELAttributeRequestRowLimit = "request.row_limit"
// CELAttributeRequestTime is the timestamp of the request.
CELAttributeRequestTime = "request.time"
)
diff --git a/backend/common/cel_test.go b/backend/common/cel_test.go
index d558477005..0405d6e67f 100644
--- a/backend/common/cel_test.go
+++ b/backend/common/cel_test.go
@@ -41,7 +41,7 @@ func TestPartialEval(t *testing.T) {
},
{
name: "partial false 1",
- expr: "request.time < timestamp(\"2024-02-01T00:00:00Z\") && request.row_limit <= 1000",
+ expr: "request.time < timestamp(\"2024-02-01T00:00:00Z\")",
input: map[string]any{"request.time": time20240201},
want: false,
},
@@ -53,7 +53,7 @@ func TestPartialEval(t *testing.T) {
},
{
name: "partial true 1",
- expr: "request.time < timestamp(\"2024-02-01T00:00:00Z\") && request.row_limit <= 1000",
+ expr: "request.time < timestamp(\"2024-02-01T00:00:00Z\")",
input: map[string]any{"request.time": time20240201.AddDate(0, 0, -1)},
want: true,
},
@@ -79,13 +79,13 @@ func TestGetQueryExportFactors(t *testing.T) {
want QueryExportFactors
}{
{
- expression: "request.time < timestamp(\"2023-07-04T06:09:03.384Z\") && request.row_limit == 1000 && (resource.database == \"instances/postgres-sample/databases/employee\" && resource.schema_name == \"public\" && resource.table_name in [\"dept_manager\"])",
+ expression: "request.time < timestamp(\"2023-07-04T06:09:03.384Z\") && (resource.database == \"instances/postgres-sample/databases/employee\" && resource.schema_name == \"public\" && resource.table_name in [\"dept_manager\"])",
want: QueryExportFactors{
Databases: []string{"instances/postgres-sample/databases/employee"},
},
},
{
- expression: "request.time < timestamp(\"2023-07-04T07:40:05.658Z\") && request.row_limit == 1000 && (resource.database in [\"instances/postgres-sample/databases/employee\"])",
+ expression: "request.time < timestamp(\"2023-07-04T07:40:05.658Z\") && (resource.database in [\"instances/postgres-sample/databases/employee\"])",
want: QueryExportFactors{
Databases: []string{"instances/postgres-sample/databases/employee"},
},
diff --git a/backend/generated-go/v1/iam_policy.pb.go b/backend/generated-go/v1/iam_policy.pb.go
index b52f39b828..7067c39db7 100644
--- a/backend/generated-go/v1/iam_policy.pb.go
+++ b/backend/generated-go/v1/iam_policy.pb.go
@@ -261,12 +261,11 @@ type Binding struct {
// resource.schema_name: the schema name, used by the "roles/sqlEditorUser" role, support "==" operator.
// resource.table_name: the table name, used by the "roles/sqlEditorUser" role, support "==" operator.
// request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`.
- // request.row_limit: the maximum export rows, used by the "roles/sqlEditorUser" role. Only support "<=" operation.
//
// For example:
// resource.database == "instances/local-pg/databases/postgres" && resource.schema_name in ["public","another_schema"]
// resource.database == "instances/local-pg/databases/bytebase" && resource.schema_name == "public" && resource.table_name in ["audit_log"]
- // request.time < timestamp("2025-04-26T11:24:48.655Z") && request.row_limit <= 1000
+ // request.time < timestamp("2025-04-26T11:24:48.655Z")
Condition *expr.Expr `protobuf:"bytes,3,opt,name=condition,proto3" json:"condition,omitempty"`
// The parsed expression of the condition.
ParsedExpr *v1alpha1.Expr `protobuf:"bytes,4,opt,name=parsed_expr,json=parsedExpr,proto3" json:"parsed_expr,omitempty"`
diff --git a/backend/migrator/migration/3.11/0006##remove_row_limit.sql b/backend/migrator/migration/3.11/0006##remove_row_limit.sql
new file mode 100644
index 0000000000..e587f2b898
--- /dev/null
+++ b/backend/migrator/migration/3.11/0006##remove_row_limit.sql
@@ -0,0 +1,71 @@
+-- Remove request.row_limit from IAM policy condition expressions
+--
+-- This migration removes the deprecated request.row_limit attribute from condition expressions
+-- in IAM policies for SQL Editor User role bindings.
+--
+-- Background:
+-- The request.row_limit condition was previously used to limit the number of rows that could be
+-- queried by users with the SQL Editor User role. This functionality is being removed, and any
+-- existing conditions that reference request.row_limit need to be cleaned up.
+--
+-- Changes:
+-- - Remove " && request.row_limit <operator> <number>" patterns from condition expressions
+-- - Remove "request.row_limit <operator> <number> && " patterns from condition expressions
+-- - Supported operators: <, >, <=, >=, ==, !=
+--
+-- Example transformation:
+-- Before: "request.time < timestamp(\"2025-10-18T06:05:51.000Z\") && request.row_limit <= 5000"
+-- After: "request.time < timestamp(\"2025-10-18T06:05:51.000Z\")"
+--
+-- Affected table:
+-- - policy (type='IAM', resource_type='PROJECT'): IAM policy condition expressions for SQL Editor User role
+
+UPDATE policy
+SET payload = (
+ SELECT jsonb_set(
+ payload,
+ '{bindings}',
+ (
+ SELECT jsonb_agg(
+ CASE
+ -- Only update bindings for sqlEditorUser role that have conditions with request.row_limit
+ WHEN binding->>'role' = 'roles/sqlEditorUser'
+ AND binding->'condition'->>'expression' IS NOT NULL
+ AND binding->'condition'->>'expression' LIKE '%request.row_limit%'
+ THEN jsonb_set(
+ binding,
+ '{condition,expression}',
+ to_jsonb(
+ -- Remove " && request.row_limit <operator> <number>" pattern
+ regexp_replace(
+ -- Remove "request.row_limit <operator> <number> && " pattern
+ regexp_replace(
+ binding->'condition'->>'expression',
+ 'request\.row_limit\s*(<=|>=|<|>|==|!=)\s*\d+\s*&&\s*',
+ '',
+ 'g'
+ ),
+ '\s*&&\s*request\.row_limit\s*(<=|>=|<|>|==|!=)\s*\d+',
+ '',
+ 'g'
+ )
+ )
+ )
+ ELSE binding
+ END
+ )
+ FROM jsonb_array_elements(payload->'bindings') AS binding
+ )
+ )
+ FROM policy p2
+ WHERE p2.id = policy.id
+)
+WHERE type = 'IAM'
+ AND resource_type = 'PROJECT'
+ AND payload->'bindings' IS NOT NULL
+ AND EXISTS (
+ SELECT 1
+ FROM jsonb_array_elements(payload->'bindings') AS binding
+ WHERE binding->>'role' = 'roles/sqlEditorUser'
+ AND binding->'condition'->>'expression' LIKE '%request.row_limit%'
+ );
diff --git a/backend/migrator/migrator_test.go b/backend/migrator/migrator_test.go
index 2238a7519c..eaabce9725 100644
--- a/backend/migrator/migrator_test.go
+++ b/backend/migrator/migrator_test.go
@@ -12,7 +12,7 @@ import (
func TestLatestVersion(t *testing.T) {
files, err := getSortedVersionedFiles()
require.NoError(t, err)
- require.Equal(t, semver.MustParse("3.11.5"), *files[len(files)-1].version)
+ require.Equal(t, semver.MustParse("3.11.6"), *files[len(files)-1].version)
}
func TestVersionUnique(t *testing.T) {
diff --git a/frontend/src/components/GrantRequestPanel/MaxRowCountSelect.vue b/frontend/src/components/GrantRequestPanel/MaxRowCountSelect.vue
index 38777f1d10..edea5b57ff 100644
--- a/frontend/src/components/GrantRequestPanel/MaxRowCountSelect.vue
+++ b/frontend/src/components/GrantRequestPanel/MaxRowCountSelect.vue
@@ -1,6 +1,6 @@
<template>
<NPopselect
- :value="value ?? 0"
+ :value="value"
:options="options"
trigger="click"
placement="bottom-start"
@@ -8,11 +8,7 @@
@update:value="handleUpdateValue"
>
<NButton class="bb-overlay-stack-ignore-esc">
- {{
- value !== undefined
- ? $t("common.rows.n-rows", { n: value })
- : $t("issue.grant-request.unlimited-query-rows")
- }}
+ {{ $t("common.rows.n-rows", { n: value }) }}
</NButton>
<template #action>
<div class="flex items-center justify-between gap-1">
@@ -39,19 +35,19 @@ import { usePolicyV1Store } from "@/store";
import { minmax } from "@/utils";
defineProps<{
- value?: number;
+ value: number;
}>();
const emit = defineEmits<{
- (event: "update:value", value: number | undefined): void;
+ (event: "update:value", value: number): void;
}>();
const { t } = useI18n();
const policyStore = usePolicyV1Store();
const rowCountOptions = computed(() => {
- const list = [0, 1, 100, 500, 1000, 5000, 10000, 100000].filter(
- (num) => num === 0 || num <= policyStore.maximumResultRows
+ const list = [1, 100, 500, 1000, 5000, 10000, 100000].filter(
+ (num) => num <= policyStore.maximumResultRows
);
if (
policyStore.maximumResultRows !== Number.MAX_VALUE &&
@@ -64,16 +60,13 @@ const rowCountOptions = computed(() => {
const options = computed((): SelectOption[] => {
return rowCountOptions.value.map((n) => ({
- label:
- n === 0
- ? t("issue.grant-request.unlimited-query-rows")
- : t("common.rows.n-rows", { n }),
+ label: t("common.rows.n-rows", { n }),
value: n,
}));
});
const handleUpdateValue = (value: number) => {
- emit("update:value", value === 0 ? undefined : value);
+ emit("update:value", value);
};
const handleInput = (value: number | null) => {
@@ -82,6 +75,6 @@ const handleInput = (value: number | null) => {
first(rowCountOptions.value)!,
last(rowCountOptions.value)!
);
- emit("update:value", normalizedValue === 0 ? undefined : normalizedValue);
+ emit("update:value", normalizedValue);
};
</script>
diff --git a/frontend/src/components/IssueV1/GrantRequestIssueDetailPage.vue b/frontend/src/components/IssueV1/GrantRequestIssueDetailPage.vue
index e141d03be6..5a0e4c2980 100644
--- a/frontend/src/components/IssueV1/GrantRequestIssueDetailPage.vue
+++ b/frontend/src/components/IssueV1/GrantRequestIssueDetailPage.vue
@@ -44,18 +44,6 @@
/>
</div>
</div>
- <div class="w-full flex flex-col justify-start items-start">
- <span class="flex items-center textinfolabel mb-2">
- {{ $t("issue.grant-request.query-rows") }}
- </span>
- <div class="flex flex-row justify-start items-start">
- {{
- condition?.rowLimit
- ? condition.rowLimit
- : $t("issue.grant-request.unlimited-query-rows")
- }}
- </div>
- </div>
<div class="w-full flex flex-col justify-start items-start">
<span class="flex items-center textinfolabel mb-2">
{{ $t("issue.grant-request.expired-at") }}
diff --git a/frontend/src/components/ProjectMember/AddProjectMember/AddProjectMemberForm.vue b/frontend/src/components/ProjectMember/AddProjectMember/AddProjectMemberForm.vue
index a5f49bebf5..78ba983be5 100644
--- a/frontend/src/components/ProjectMember/AddProjectMember/AddProjectMemberForm.vue
+++ b/frontend/src/components/ProjectMember/AddProjectMember/AddProjectMemberForm.vue
@@ -58,15 +58,6 @@
:include-cloumn="false"
/>
</div>
- <template v-if="roleSupportExport">
- <div class="w-full flex flex-col justify-start items-start space-y-2">
- <div class="flex items-center gap-x-1">
- <span>{{ $t("issue.grant-request.query-rows") }}</span>
- <RequiredStar />
- </div>
- <MaxRowCountSelect v-model:value="state.maxRowCount" />
- </div>
- </template>
<div class="w-full flex flex-col gap-y-2">
<div class="flex items-center gap-x-1">
@@ -90,7 +81,6 @@ import { NButton, NInput } from "naive-ui";
import { computed, reactive, watch, ref } from "vue";
import ExpirationSelector from "@/components/ExpirationSelector.vue";
import QuerierDatabaseResourceForm from "@/components/GrantRequestPanel/DatabaseResourceForm/index.vue";
-import MaxRowCountSelect from "@/components/GrantRequestPanel/MaxRowCountSelect.vue";
import MembersBindingSelect from "@/components/Member/MembersBindingSelect.vue";
import RequiredStar from "@/components/RequiredStar.vue";
import { RoleSelect } from "@/components/v2/Select";
@@ -129,8 +119,6 @@ interface LocalState {
expirationTimestampInMS?: number;
// Querier and exporter options.
databaseResources?: DatabaseResource[];
- // Exporter options.
- maxRowCount?: number;
databaseId?: string;
}
@@ -139,7 +127,6 @@ const getInitialState = (): LocalState => {
role: props.binding.role,
memberList: props.binding.members,
reason: "",
- maxRowCount: undefined,
databaseResources: props.databaseResource
? [{ ...props.databaseResource }]
: undefined,
@@ -157,19 +144,12 @@ watch(
state.databaseResources = props.databaseResource
? [{ ...props.databaseResource }]
: undefined;
- state.maxRowCount = undefined;
},
{
immediate: true,
}
);
-const roleSupportExport = computed(
- () =>
- state.role !== PresetRoleType.PROJECT_OWNER &&
- checkRoleContainsAnyPermission(state.role, "bb.sql.select")
-);
-
watch(
() => state,
() => {
@@ -181,7 +161,6 @@ watch(
role: state.role,
description: state.reason,
expirationTimestampInMS: state.expirationTimestampInMS,
- rowLimit: state.maxRowCount,
databaseResources: state.databaseResources,
});
},
diff --git a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue
index 29162029c1..a71472935a 100644
--- a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue
+++ b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/EditProjectRolePanel.vue
@@ -40,21 +40,6 @@
:required-feature="PlanFeature.FEATURE_IAM"
/>
</div>
-
- <!-- Exporter blocks -->
- <template
- v-if="
- binding.role !== PresetRoleType.PROJECT_OWNER &&
- checkRoleContainsAnyPermission(binding.role, 'bb.sql.select')
- "
- >
- <div class="w-full flex flex-col justify-start items-start">
- <p class="mb-2">
- {{ $t("issue.grant-request.query-rows") }}
- </p>
- <MaxRowCountSelect v-model:value="state.maxRowCount" />
- </div>
- </template>
</template>
<div class="w-full">
@@ -121,7 +106,6 @@ import { useI18n } from "vue-i18n";
import { BBButtonConfirm } from "@/bbkit";
import ExpirationSelector from "@/components/ExpirationSelector.vue";
import QuerierDatabaseResourceForm from "@/components/GrantRequestPanel/DatabaseResourceForm/index.vue";
-import MaxRowCountSelect from "@/components/GrantRequestPanel/MaxRowCountSelect.vue";
import MembersBindingSelect from "@/components/Member/MembersBindingSelect.vue";
import RequiredStar from "@/components/RequiredStar.vue";
import { Drawer, DrawerContent } from "@/components/v2";
@@ -154,8 +138,6 @@ interface LocalState {
expirationTimestamp?: number;
// Querier and exporter options.
databaseResources?: DatabaseResource[];
- // Exporter options.
- maxRowCount?: number;
isLoading: boolean;
}
@@ -164,7 +146,6 @@ const { t } = useI18n();
const state = reactive<LocalState>({
title: "",
description: "",
- maxRowCount: undefined,
isLoading: true,
});
const expirationSelectorRef = ref<InstanceType<typeof ExpirationSelector>>();
@@ -196,7 +177,6 @@ const bindingCondition = computed(() =>
role: props.binding.role,
description: state.description,
expirationTimestampInMS: state.expirationTimestamp,
- rowLimit: state.maxRowCount,
databaseResources: state.databaseResources,
})
);
@@ -224,9 +204,6 @@ onMounted(() => {
if (conditionExpr.databaseResources) {
state.databaseResources = conditionExpr.databaseResources;
}
- if (conditionExpr.rowLimit) {
- state.maxRowCount = conditionExpr.rowLimit;
- }
}
state.isLoading = false;
diff --git a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue
index 7ec51c207b..349d444c57 100644
--- a/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue
+++ b/frontend/src/components/ProjectMember/ProjectMemberRolePanel/index.vue
@@ -178,7 +178,6 @@ interface SingleBinding {
databaseResource?: DatabaseResource;
expiration?: Date;
description: string;
- rowLimit?: number;
rawBinding: Binding;
}
@@ -487,7 +486,6 @@ const handleDeleteCondition = async (
role: item.role,
description: bindingList[0].description,
expirationTimestampInMS: bindingList[0].expiration?.getTime(),
- rowLimit: bindingList[0].rowLimit,
databaseResources: databaseResources,
}),
})
@@ -583,7 +581,6 @@ watch(
if (conditionExpr.expiredTime) {
singleBinding.expiration = new Date(conditionExpr.expiredTime);
}
- singleBinding.rowLimit = conditionExpr.rowLimit;
if (
Array.isArray(conditionExpr.databaseResources) &&
conditionExpr.databaseResources.length > 0
diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.json
index cc110517bc..0c4490f985 100644
--- a/frontend/src/locales/en-US.json
+++ b/frontend/src/locales/en-US.json
@@ -982,8 +982,6 @@
"waiting-for-review": "Waiting for review",
"issue-name": "Issue name",
"grant-request": {
- "query-rows": "Max query rows",
- "unlimited-query-rows": "Unlimited",
"expired-at": "Expired at",
"all-databases": "All",
"all-databases-tip": "All current and future databases in this project.",
diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.json
index 67ff872939..6e18224849 100644
--- a/frontend/src/locales/es-ES.json
+++ b/frontend/src/locales/es-ES.json
@@ -982,8 +982,6 @@
"waiting-for-review": "Esperando revisión",
"issue-name": "Nombre de la incidencia",
"grant-request": {
- "query-rows": "Máximo de filas de consulta",
- "unlimited-query-rows": "Ilimitado",
"expired-at": "tiempo de caducidad",
"all-databases": "todas las bases de datos",
"all-databases-tip": "Todas las bases de datos actuales y futuras de este proyecto.",
@@ -2927,4 +2925,4 @@
"last-visit": "Última visita",
"changelog-for-version": "Registro de cambios para {version}"
}
-}
\ No newline at end of file
+}
diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.json
index cdb6610bbc..e90fb1b744 100644
--- a/frontend/src/locales/ja-JP.json
+++ b/frontend/src/locales/ja-JP.json
@@ -982,8 +982,6 @@
"waiting-for-review": "モデレート済み",
"issue-name": "イシュー名",
"grant-request": {
- "query-rows": "最大クエリ行数",
- "unlimited-query-rows": "無制限",
"expired-at": "有効期限",
"all-databases": "すべてのデータベース",
"all-databases-tip": "このプロジェクトに属する現在および将来のすべてのデータベース。",
@@ -2927,4 +2925,4 @@
"last-visit": "最終訪問",
"changelog-for-version": "{version} の変更履歴"
}
-}
\ No newline at end of file
+}
diff --git a/frontend/src/locales/vi-VN.json b/frontend/src/locales/vi-VN.json
index fcc85237c7..0b269ca3b0 100644
--- a/frontend/src/locales/vi-VN.json
+++ b/frontend/src/locales/vi-VN.json
@@ -982,8 +982,6 @@
"waiting-for-review": "Đang chờ xem xét",
"issue-name": "Tên vấn đề",
"grant-request": {
- "query-rows": "Số hàng truy vấn tối đa",
- "unlimited-query-rows": "Không giới hạn",
"expired-at": "Hết hạn vào",
"all-databases": "Tất cả",
"all-databases-tip": "Tất cả cơ sở dữ liệu hiện tại và tương lai trong dự án này.",
@@ -2927,4 +2925,4 @@
"last-visit": "Lần truy cập cuối",
"changelog-for-version": "Nhật ký thay đổi cho phiên bản {version}"
}
-}
\ No newline at end of file
+}
diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.json
index ecb752c02d..83ab1710c8 100644
--- a/frontend/src/locales/zh-CN.json
+++ b/frontend/src/locales/zh-CN.json
@@ -982,8 +982,6 @@
"waiting-for-review": "等待审核",
"issue-name": "工单名称",
"grant-request": {
- "query-rows": "最大查询行数",
- "unlimited-query-rows": "无限制",
"expired-at": "过期时间",
"all-databases": "所有数据库",
"all-databases-tip": "所有当前和未来属于这个项目的数据库。",
diff --git a/frontend/src/plugins/cel/types/factor.ts b/frontend/src/plugins/cel/types/factor.ts
index 72c276d9b7..85db350231 100644
--- a/frontend/src/plugins/cel/types/factor.ts
+++ b/frontend/src/plugins/cel/types/factor.ts
@@ -2,7 +2,6 @@ import {
CEL_ATTRIBUTE_STATEMENT_AFFECTED_ROWS,
CEL_ATTRIBUTE_STATEMENT_TABLE_ROWS,
CEL_ATTRIBUTE_LEVEL,
- CEL_ATTRIBUTE_REQUEST_ROW_LIMIT,
CEL_ATTRIBUTE_REQUEST_EXPIRATION_DAYS,
CEL_ATTRIBUTE_SOURCE,
CEL_ATTRIBUTE_RESOURCE_ENVIRONMENT_ID,
@@ -27,9 +26,6 @@ export const NumberFactorList = [
CEL_ATTRIBUTE_STATEMENT_TABLE_ROWS,
CEL_ATTRIBUTE_LEVEL,
- // Grant request issue related factors
- CEL_ATTRIBUTE_REQUEST_ROW_LIMIT,
-
// Request query/export factors
CEL_ATTRIBUTE_REQUEST_EXPIRATION_DAYS,
] as const;
diff --git a/frontend/src/plugins/cel/types/operator.ts b/frontend/src/plugins/cel/types/operator.ts
index 7499351876..32318291eb 100644
--- a/frontend/src/plugins/cel/types/operator.ts
+++ b/frontend/src/plugins/cel/types/operator.ts
@@ -16,7 +16,6 @@ import {
CEL_ATTRIBUTE_RESOURCE_CLASSIFICATION_LEVEL,
CEL_ATTRIBUTE_LEVEL,
CEL_ATTRIBUTE_SOURCE,
- CEL_ATTRIBUTE_REQUEST_ROW_LIMIT,
CEL_ATTRIBUTE_REQUEST_TIME,
CEL_ATTRIBUTE_REQUEST_EXPIRATION_DAYS,
CEL_ATTRIBUTE_REQUEST_ROLE,
@@ -155,7 +154,6 @@ const OperatorList: Record<Factor, Operator[]> = {
]),
// These factors don't have operator candidates for user selection.
- [CEL_ATTRIBUTE_REQUEST_ROW_LIMIT]: [],
[CEL_ATTRIBUTE_RESOURCE_DATABASE]: [],
[CEL_ATTRIBUTE_REQUEST_TIME]: [],
};
diff --git a/frontend/src/types/proto-es/v1/iam_policy_pb.d.ts b/frontend/src/types/proto-es/v1/iam_policy_pb.d.ts
index c1023e604e..71e2b82bc8 100644
--- a/frontend/src/types/proto-es/v1/iam_policy_pb.d.ts
+++ b/frontend/src/types/proto-es/v1/iam_policy_pb.d.ts
@@ -124,12 +124,11 @@ export declare type Binding = Message<"bytebase.v1.Binding"> & {
* resource.schema_name: the schema name, used by the "roles/sqlEditorUser" role, support "==" operator.
* resource.table_name: the table name, used by the "roles/sqlEditorUser" role, support "==" operator.
* request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`.
- * request.row_limit: the maximum export rows, used by the "roles/sqlEditorUser" role. Only support "<=" operation.
*
* For example:
* resource.database == "instances/local-pg/databases/postgres" && resource.schema_name in ["public","another_schema"]
* resource.database == "instances/local-pg/databases/bytebase" && resource.schema_name == "public" && resource.table_name in ["audit_log"]
- * request.time < timestamp("2025-04-26T11:24:48.655Z") && request.row_limit <= 1000
+ * request.time < timestamp("2025-04-26T11:24:48.655Z")
*
* @generated from field: google.type.Expr condition = 3;
*/
diff --git a/frontend/src/utils/cel-attributes.ts b/frontend/src/utils/cel-attributes.ts
index 2a30efb293..785cdeb6b9 100644
--- a/frontend/src/utils/cel-attributes.ts
+++ b/frontend/src/utils/cel-attributes.ts
@@ -22,7 +22,6 @@ export const CEL_ATTRIBUTE_STATEMENT_TEXT = "statement.text";
// CEL attribute names for request scope.
export const CEL_ATTRIBUTE_REQUEST_EXPIRATION_DAYS = "request.expiration_days";
export const CEL_ATTRIBUTE_REQUEST_ROLE = "request.role";
-export const CEL_ATTRIBUTE_REQUEST_ROW_LIMIT = "request.row_limit";
export const CEL_ATTRIBUTE_REQUEST_TIME = "request.time";
// CEL attribute names for approval scope (deprecated, kept for backward compatibility).
diff --git a/frontend/src/utils/issue/cel.ts b/frontend/src/utils/issue/cel.ts
index b2bc55771b..d27d9b8bec 100644
--- a/frontend/src/utils/issue/cel.ts
+++ b/frontend/src/utils/issue/cel.ts
@@ -18,7 +18,6 @@ import {
} from "@/utils";
import {
CEL_ATTRIBUTE_REQUEST_TIME,
- CEL_ATTRIBUTE_REQUEST_ROW_LIMIT,
CEL_ATTRIBUTE_RESOURCE_DATABASE,
CEL_ATTRIBUTE_RESOURCE_SCHEMA_NAME,
CEL_ATTRIBUTE_RESOURCE_TABLE_NAME,
@@ -50,7 +49,6 @@ type DatabaseResourceCondition =
export interface ConditionExpression {
databaseResources?: DatabaseResource[];
expiredTime?: string;
- rowLimit?: number;
exportFormat?: string;
}
@@ -119,19 +117,16 @@ export const buildConditionExpr = ({
description,
expirationTimestampInMS,
databaseResources,
- rowLimit,
}: {
title?: string;
role: string;
description: string;
expirationTimestampInMS?: number;
databaseResources?: DatabaseResource[];
- rowLimit?: number;
}): ConditionExpr => {
const expresson = stringifyConditionExpression({
expirationTimestampInMS,
databaseResources,
- rowLimit,
});
return create(ConditionExprSchema, {
title:
@@ -202,14 +197,12 @@ export const stringifyDatabaseResources = (resources: DatabaseResource[]) => {
return cel;
};
-export const stringifyConditionExpression = ({
+const stringifyConditionExpression = ({
expirationTimestampInMS,
databaseResources,
- rowLimit,
}: {
expirationTimestampInMS?: number;
databaseResources?: DatabaseResource[];
- rowLimit?: number;
}): string => {
const expression: string[] = [];
if (databaseResources !== undefined && databaseResources.length > 0) {
@@ -220,9 +213,6 @@ export const stringifyConditionExpression = ({
`${CEL_ATTRIBUTE_REQUEST_TIME} < timestamp("${dayjs(expirationTimestampInMS).toISOString()}")`
);
}
- if (rowLimit) {
- expression.push(`${CEL_ATTRIBUTE_REQUEST_ROW_LIMIT} <= ${rowLimit}`);
- }
return expression.join(" && ");
};
@@ -432,11 +422,6 @@ export const convertFromExpr = (expr: Expr): ConditionExpression => {
}
}
conditionExpression.databaseResources?.push(databaseResource);
- } else if (typeof right === "number") {
- // Deprecated. Use _<=_ instead.
- if (left === CEL_ATTRIBUTE_REQUEST_ROW_LIMIT) {
- conditionExpression.rowLimit = right;
- }
}
}
} else if (expr.operator === "_<_") {
@@ -444,16 +429,6 @@ export const convertFromExpr = (expr: Expr): ConditionExpression => {
if (left === CEL_ATTRIBUTE_REQUEST_TIME) {
conditionExpression.expiredTime = (right as Date).toISOString();
}
- } else if (expr.operator === "_<=_") {
- const [left, right] = expr.args;
- if (
- left === CEL_ATTRIBUTE_REQUEST_ROW_LIMIT &&
- typeof right === "number"
- ) {
- if (left === CEL_ATTRIBUTE_REQUEST_ROW_LIMIT) {
- conditionExpression.rowLimit = right;
- }
- }
}
}
processCondition(simpleExpr);
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 51187a4b9b..760d4eece5 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -8921,12 +8921,11 @@ components:
resource.schema_name: the schema name, used by the "roles/sqlEditorUser" role, support "==" operator.
resource.table_name: the table name, used by the "roles/sqlEditorUser" role, support "==" operator.
request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`.
- request.row_limit: the maximum export rows, used by the "roles/sqlEditorUser" role. Only support "<=" operation.
For example:
resource.database == "instances/local-pg/databases/postgres" && resource.schema_name in ["public","another_schema"]
resource.database == "instances/local-pg/databases/bytebase" && resource.schema_name == "public" && resource.table_name in ["audit_log"]
- request.time < timestamp("2025-04-26T11:24:48.655Z") && request.row_limit <= 1000
+ request.time < timestamp("2025-04-26T11:24:48.655Z")
parsedExpr:
readOnly: true
allOf:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 741623c660..36d0477152 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -5330,9 +5330,9 @@ The theme resources.
| members | [string](#string) | repeated | Specifies the principals requesting access for a Bytebase resource. For users, the member should be: user:{email} For groups, the member should be: group:{email} |
| condition | [google.type.Expr](#google-type-Expr) | | The condition that is associated with this binding, only used in the project IAM policy. If the condition evaluates to true, then this binding applies to the current request. If the condition evaluates to false, then this binding does not apply to the current request. However, a different role binding might grant the same role to one or more of the principals in this binding. The syntax and semantics of CEL are documented at https://github.com/google/cel-spec
-Support variables: resource.database: the database full name in &#34;instances/{instance}/databases/{database}&#34; format, used by the &#34;roles/sqlEditorUser&#34; role, support &#34;==&#34; operator. resource.schema_name: the schema name, used by the &#34;roles/sqlEditorUser&#34; role, support &#34;==&#34; operator. resource.table_name: the table name, used by the &#34;roles/sqlEditorUser&#34; role, support &#34;==&#34; operator. request.time: the expiration. Only support &#34;&lt;&#34; operation in `request.time &lt; timestamp(&#34;{ISO datetime string format}&#34;)`. request.row_limit: the maximum export rows, used by the &#34;roles/sqlEditorUser&#34; role. Only support &#34;&lt;=&#34; operation.
+Support variables: resource.database: the database full name in &#34;instances/{instance}/databases/{database}&#34; format, used by the &#34;roles/sqlEditorUser&#34; role, support &#34;==&#34; operator. resource.schema_name: the schema name, used by the &#34;roles/sqlEditorUser&#34; role, support &#34;==&#34; operator. resource.table_name: the table name, used by the &#34;roles/sqlEditorUser&#34; role, support &#34;==&#34; operator. request.time: the expiration. Only support &#34;&lt;&#34; operation in `request.time &lt; timestamp(&#34;{ISO datetime string format}&#34;)`.
-For example: resource.database == &#34;instances/local-pg/databases/postgres&#34; &amp;&amp; resource.schema_name in [&#34;public&#34;,&#34;another_schema&#34;] resource.database == &#34;instances/local-pg/databases/bytebase&#34; &amp;&amp; resource.schema_name == &#34;public&#34; &amp;&amp; resource.table_name in [&#34;audit_log&#34;] request.time &lt; timestamp(&#34;2025-04-26T11:24:48.655Z&#34;) &amp;&amp; request.row_limit &lt;= 1000 |
+For example: resource.database == &#34;instances/local-pg/databases/postgres&#34; &amp;&amp; resource.schema_name in [&#34;public&#34;,&#34;another_schema&#34;] resource.database == &#34;instances/local-pg/databases/bytebase&#34; &amp;&amp; resource.schema_name == &#34;public&#34; &amp;&amp; resource.table_name in [&#34;audit_log&#34;] request.time &lt; timestamp(&#34;2025-04-26T11:24:48.655Z&#34;) |
| parsed_expr | [google.api.expr.v1alpha1.Expr](#google-api-expr-v1alpha1-Expr) | | The parsed expression of the condition. |
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index a04affbf68..7d0554029f 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -15530,12 +15530,11 @@ resource.database: the database full name in &#34;instances/{instance}/databases
resource.schema_name: the schema name, used by the &#34;roles/sqlEditorUser&#34; role, support &#34;==&#34; operator.
resource.table_name: the table name, used by the &#34;roles/sqlEditorUser&#34; role, support &#34;==&#34; operator.
request.time: the expiration. Only support &#34;&lt;&#34; operation in `request.time &lt; timestamp(&#34;{ISO datetime string format}&#34;)`.
-request.row_limit: the maximum export rows, used by the &#34;roles/sqlEditorUser&#34; role. Only support &#34;&lt;=&#34; operation.
For example:
resource.database == &#34;instances/local-pg/databases/postgres&#34; &amp;&amp; resource.schema_name in [&#34;public&#34;,&#34;another_schema&#34;]
resource.database == &#34;instances/local-pg/databases/bytebase&#34; &amp;&amp; resource.schema_name == &#34;public&#34; &amp;&amp; resource.table_name in [&#34;audit_log&#34;]
-request.time &lt; timestamp(&#34;2025-04-26T11:24:48.655Z&#34;) &amp;&amp; request.row_limit &lt;= 1000 </p></td>
+request.time &lt; timestamp(&#34;2025-04-26T11:24:48.655Z&#34;) </p></td>
</tr>
<tr>
diff --git a/proto/v1/v1/iam_policy.proto b/proto/v1/v1/iam_policy.proto
index 5bf8d37b7f..979c11490d 100644
--- a/proto/v1/v1/iam_policy.proto
+++ b/proto/v1/v1/iam_policy.proto
@@ -65,12 +65,11 @@ message Binding {
// resource.schema_name: the schema name, used by the "roles/sqlEditorUser" role, support "==" operator.
// resource.table_name: the table name, used by the "roles/sqlEditorUser" role, support "==" operator.
// request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`.
- // request.row_limit: the maximum export rows, used by the "roles/sqlEditorUser" role. Only support "<=" operation.
//
// For example:
// resource.database == "instances/local-pg/databases/postgres" && resource.schema_name in ["public","another_schema"]
// resource.database == "instances/local-pg/databases/bytebase" && resource.schema_name == "public" && resource.table_name in ["audit_log"]
- // request.time < timestamp("2025-04-26T11:24:48.655Z") && request.row_limit <= 1000
+ // request.time < timestamp("2025-04-26T11:24:48.655Z")
google.type.Expr condition = 3;
// The parsed expression of the condition.