Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: check ddl/dml policy (#14034)
ecmadaoe6a65a561a8d
diff --git a/frontend/src/components/EnvironmentForm/AccessControlConfigure.vue b/frontend/src/components/EnvironmentForm/AccessControlConfigure.vueindex 58251a43bb..16c9c0898e 100644--- a/frontend/src/components/EnvironmentForm/AccessControlConfigure.vue+++ b/frontend/src/components/EnvironmentForm/AccessControlConfigure.vue@@ -61,9 +61,14 @@</div></div></div>- <div v-if="isDev()" class="flex flex-col gap-y-2">+ <div+ v-if="isDev() && databaseChangeMode === 'PIPELINE'"+ class="flex flex-col gap-y-2"+ ><div class="textlabel flex items-center space-x-2">- <label> Statement execution </label>+ <label>+ {{ $t("environment.statement-execution.title") }}+ </label></div><div><div class="w-full inline-flex items-center gap-x-2">@@ -78,7 +83,7 @@"/><span class="textlabel">- Allow running DDL statements in the SQL editor+ {{ $t("environment.statement-execution.allow-ddl") }}</span></div><div class="w-full inline-flex items-center gap-x-2">@@ -93,7 +98,7 @@"/><span class="textlabel">- Allow running DML statements in the SQL editor+ {{ $t("environment.statement-execution.allow-dml") }}</span></div></div>@@ -104,7 +109,12 @@import { NRadioGroup, NRadio } from "naive-ui";import { computed, watchEffect } from "vue";import { useI18n } from "vue-i18n";-import { hasFeature, pushNotification, usePolicyV1Store } from "@/store";+import {+ hasFeature,+ pushNotification,+ usePolicyV1Store,+ useAppFeature,+} from "@/store";import {DataSourceQueryPolicy,DataSourceQueryPolicy_Restriction,@@ -121,6 +131,7 @@ const props = defineProps<{const policyStore = usePolicyV1Store();const { t } = useI18n();+const databaseChangeMode = useAppFeature("bb.feature.database-change-mode");watchEffect(async () => {await Promise.all([diff --git a/frontend/src/composables/useExecuteSQL.ts b/frontend/src/composables/useExecuteSQL.tsindex 4b92bad575..bae06552cd 100644--- a/frontend/src/composables/useExecuteSQL.ts+++ b/frontend/src/composables/useExecuteSQL.ts@@ -2,7 +2,11 @@ import Emittery from "emittery";import { head, isEmpty } from "lodash-es";import { Status } from "nice-grpc-common";import { markRaw, reactive } from "vue";-import { parseSQL } from "@/components/MonacoEditor/sqlParser";+import {+ parseSQL,+ isDDLStatement,+ isDMLStatement,+} from "@/components/MonacoEditor/sqlParser";import { sqlServiceClient } from "@/grpcweb";import { t } from "@/plugins/i18n";import {@@ -318,11 +322,20 @@ const useExecuteSQL = () => {try {let resultSet: SQLResultSetV1;- if (- changeMode === "RO" &&- !policy?.dataSourceQueryPolicy?.enableDdl &&- !policy?.dataSourceQueryPolicy?.enableDml- ) {++ if (changeMode === "RO") {+ const isDDL = isDDLStatement(data, "some");+ const isDML = isDMLStatement(data, "some");++ if (+ (isDDL && !policy?.dataSourceQueryPolicy?.enableDdl) ||+ (isDML && !policy?.dataSourceQueryPolicy?.enableDml)+ ) {+ sqlEditorStore.isShowExecutingHint = true;+ sqlEditorStore.executingHintDatabase = database;+ return cleanup();+ }+const instance = isValidDatabaseName(database.name)? database.instance: params.connection.instance;diff --git a/frontend/src/locales/en-US.json b/frontend/src/locales/en-US.jsonindex 24ff68f994..9170d61b3d 100644--- a/frontend/src/locales/en-US.json+++ b/frontend/src/locales/en-US.json@@ -1637,6 +1637,11 @@"disallow": "Disallow querying data from the admin connection","fallback": "Fallback to the admin connection if no read-only connection is available"}+ },+ "statement-execution": {+ "title": "Statement execution",+ "allow-ddl": "Allow running DDL statements in the SQL editor",+ "allow-dml": "Allow running DML statements in the SQL editor"}},"quick-start": {diff --git a/frontend/src/locales/es-ES.json b/frontend/src/locales/es-ES.jsonindex 3d1c63faa9..9ce923112e 100644--- a/frontend/src/locales/es-ES.json+++ b/frontend/src/locales/es-ES.json@@ -1637,6 +1637,11 @@"disallow": "Prohibir consultar datos desde la conexión de administrador","fallback": "Volver a la conexión de administrador si no hay una conexión de solo lectura disponible"}+ },+ "statement-execution": {+ "title": "Ejecución de la declaración",+ "allow-ddl": "Permitir la ejecución de sentencias DDL en el editor SQL",+ "allow-dml": "Permitir la ejecución de sentencias DML en el editor SQL"}},"quick-start": {diff --git a/frontend/src/locales/ja-JP.json b/frontend/src/locales/ja-JP.jsonindex 5c2b91991e..177ce93961 100644--- a/frontend/src/locales/ja-JP.json+++ b/frontend/src/locales/ja-JP.json@@ -1637,6 +1637,11 @@"disallow": "管理者接続からのデータクエリを禁止する","fallback": "読み取り専用接続が利用できない場合、管理者接続にフォールバックする"}+ },+ "statement-execution": {+ "title": "ステートメントの実行",+ "allow-ddl": "SQLエディタでDDL文を実行できるようにする",+ "allow-dml": "SQL エディタで DML ステートメントを実行できるようにする"}},"quick-start": {diff --git a/frontend/src/locales/zh-CN.json b/frontend/src/locales/zh-CN.jsonindex 481099ee90..ea9f7ebde7 100644--- a/frontend/src/locales/zh-CN.json+++ b/frontend/src/locales/zh-CN.json@@ -1637,6 +1637,11 @@"disallow": "禁止用管理员连接查询数据","fallback": "如果没有只读连接可用,则回退到管理员连接"}+ },+ "statement-execution": {+ "title": "语句执行",+ "allow-ddl": "允许在 SQL 编辑器中运行 DDL 语句",+ "allow-dml": "允许在 SQL 编辑器中运行 DML 语句"}},"quick-start": {