Skip to content

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

chore: update comment for IAM expression (#19312)

ecmadao7f66e9ee86a4
diff --git a/backend/api/mcp/gen/openapi.yaml b/backend/api/mcp/gen/openapi.yaml
index 63b4eabd52..843ced8009 100644
--- a/backend/api/mcp/gen/openapi.yaml
+++ b/backend/api/mcp/gen/openapi.yaml
@@ -7918,11 +7918,13 @@ components:
resource.database: the database full name in "instances/{instance}/databases/{database}" format, used by the "roles/sqlEditorUser" role, support "==" operator.
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.
+ resource.environment_id: the environment to allow the DDL/DML operation in the SQL Editor, only works for the role with bb.sql.ddl or bb.sql.dml permissions. Support "in" operator.
request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`.
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"]
+ resource.database == "instances/local-pg/databases/postgres" && resource.environment_id in ["test"]
request.time < timestamp("2025-04-26T11:24:48.655Z")
$ref: '#/components/schemas/google.type.Expr'
parsedExpr:
diff --git a/backend/generated-go/v1/iam_policy.pb.go b/backend/generated-go/v1/iam_policy.pb.go
index 56d8b67dfb..95d796b912 100644
--- a/backend/generated-go/v1/iam_policy.pb.go
+++ b/backend/generated-go/v1/iam_policy.pb.go
@@ -269,11 +269,13 @@ type Binding struct {
// resource.database: the database full name in "instances/{instance}/databases/{database}" format, used by the "roles/sqlEditorUser" role, support "==" operator.
// 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.
+ // resource.environment_id: the environment to allow the DDL/DML operation in the SQL Editor, only works for the role with bb.sql.ddl or bb.sql.dml permissions. Support "in" operator.
// request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`.
//
// 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"]
+ // resource.database == "instances/local-pg/databases/postgres" && resource.environment_id in ["test"]
// 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.
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 9d6af12253..d8791da12e 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
@@ -133,11 +133,13 @@ export declare type Binding = Message<"bytebase.v1.Binding"> & {
* resource.database: the database full name in "instances/{instance}/databases/{database}" format, used by the "roles/sqlEditorUser" role, support "==" operator.
* 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.
+ * resource.environment_id: the environment to allow the DDL/DML operation in the SQL Editor, only works for the role with bb.sql.ddl or bb.sql.dml permissions. Support "in" operator.
* request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`.
*
* 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"]
+ * resource.database == "instances/local-pg/databases/postgres" && resource.environment_id in ["test"]
* request.time < timestamp("2025-04-26T11:24:48.655Z")
*
* @generated from field: google.type.Expr condition = 3;
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 3710e2ed5a..b88387a211 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -16894,11 +16894,13 @@ components:
resource.database: the database full name in "instances/{instance}/databases/{database}" format, used by the "roles/sqlEditorUser" role, support "==" operator.
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.
+ resource.environment_id: the environment to allow the DDL/DML operation in the SQL Editor, only works for the role with bb.sql.ddl or bb.sql.dml permissions. Support "in" operator.
request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`.
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"]
+ resource.database == "instances/local-pg/databases/postgres" && resource.environment_id in ["test"]
request.time < timestamp("2025-04-26T11:24:48.655Z")
$ref: '#/components/schemas/google.type.Expr'
parsedExpr:
diff --git a/proto/gen/grpc-doc/v1/README.md b/proto/gen/grpc-doc/v1/README.md
index 5058a3d864..62be784974 100644
--- a/proto/gen/grpc-doc/v1/README.md
+++ b/proto/gen/grpc-doc/v1/README.md
@@ -2755,9 +2755,9 @@ Binding associates members with a role and optional conditions.
| 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} For service accounts, the member should be: serviceAccount:{email} For workload identities, the member should be: workloadIdentity:{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;)`.
+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. resource.environment_id: the environment to allow the DDL/DML operation in the SQL Editor, only works for the role with bb.sql.ddl or bb.sql.dml permissions. Support &#34;in&#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;) |
+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;] resource.database == &#34;instances/local-pg/databases/postgres&#34; &amp;&amp; resource.environment_id in [&#34;test&#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 02dc35e000..8bfb39f48b 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -8311,11 +8311,13 @@ 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.
+resource.environment_id: the environment to allow the DDL/DML operation in the SQL Editor, only works for the role with bb.sql.ddl or bb.sql.dml permissions. Support &#34;in&#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;]
+resource.database == &#34;instances/local-pg/databases/postgres&#34; &amp;&amp; resource.environment_id in [&#34;test&#34;]
request.time &lt; timestamp(&#34;2025-04-26T11:24:48.655Z&#34;) </p></td>
</tr>
diff --git a/proto/v1/v1/iam_policy.proto b/proto/v1/v1/iam_policy.proto
index 5edd7b7b88..76683614c8 100644
--- a/proto/v1/v1/iam_policy.proto
+++ b/proto/v1/v1/iam_policy.proto
@@ -70,11 +70,13 @@ message Binding {
// resource.database: the database full name in "instances/{instance}/databases/{database}" format, used by the "roles/sqlEditorUser" role, support "==" operator.
// 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.
+ // resource.environment_id: the environment to allow the DDL/DML operation in the SQL Editor, only works for the role with bb.sql.ddl or bb.sql.dml permissions. Support "in" operator.
// request.time: the expiration. Only support "<" operation in `request.time < timestamp("{ISO datetime string format}")`.
//
// 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"]
+ // resource.database == "instances/local-pg/databases/postgres" && resource.environment_id in ["test"]
// request.time < timestamp("2025-04-26T11:24:48.655Z")
google.type.Expr condition = 3;