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: add i18n to function disallowed list rule (#10977)
boojackb6d8273c890d
diff --git a/backend/plugin/advisor/advisor.go b/backend/plugin/advisor/advisor.goindex 6046ab2e04..6d9592b176 100644--- a/backend/plugin/advisor/advisor.go+++ b/backend/plugin/advisor/advisor.go@@ -244,8 +244,8 @@ const (MySQLViewDisallowCreate Type = "bb.plugin.advisor.mysql.view.disallow-create"// MySQLFunctionDisallowCreate is an advisor type for MySQL disallow create function.MySQLFunctionDisallowCreate Type = "bb.plugin.advisor.mysql.function.disallow-create"- // MySQLFunctionDisallowList is an advisor type for MySQL function disallow list.- MySQLFunctionDisallowList Type = "bb.plugin.advisor.mysql.function.disallow-list"+ // MySQLFunctionDisallowedList is an advisor type for MySQL disallowed function list.+ MySQLFunctionDisallowedList Type = "bb.plugin.advisor.mysql.function.disallowed-list"// PostgreSQL Advisor.diff --git a/backend/plugin/advisor/config/sql-review.dev.yaml b/backend/plugin/advisor/config/sql-review.dev.yamlindex a747b3a8e6..2529cbe543 100644--- a/backend/plugin/advisor/config/sql-review.dev.yaml+++ b/backend/plugin/advisor/config/sql-review.dev.yaml@@ -223,7 +223,7 @@ ruleList:level: WARNING- type: system.function.disallow-createlevel: WARNING- - type: system.function.disallow-list+ - type: system.function.disallowed-listlevel: WARNINGpayload:list:diff --git a/backend/plugin/advisor/config/sql-review.prod.yaml b/backend/plugin/advisor/config/sql-review.prod.yamlindex 4468325710..b2c4308e64 100644--- a/backend/plugin/advisor/config/sql-review.prod.yaml+++ b/backend/plugin/advisor/config/sql-review.prod.yaml@@ -223,7 +223,7 @@ ruleList:level: WARNING- type: system.function.disallow-createlevel: WARNING- - type: system.function.disallow-list+ - type: system.function.disallowed-listlevel: WARNINGpayload:list:diff --git a/backend/plugin/advisor/mysql/advisor_function_disallow_list.go b/backend/plugin/advisor/mysql/advisor_function_disallowed_list.gosimilarity index 77%rename from backend/plugin/advisor/mysql/advisor_function_disallow_list.gorename to backend/plugin/advisor/mysql/advisor_function_disallowed_list.goindex a4067d5594..77709486a6 100644--- a/backend/plugin/advisor/mysql/advisor_function_disallow_list.go+++ b/backend/plugin/advisor/mysql/advisor_function_disallowed_list.go@@ -16,18 +16,18 @@ import ()var (- _ advisor.Advisor = (*FunctionDisallowListAdvisor)(nil)+ _ advisor.Advisor = (*FunctionDisallowedListAdvisor)(nil))func init() {- advisor.Register(storepb.Engine_MYSQL, advisor.MySQLFunctionDisallowList, &FunctionDisallowListAdvisor{})+ advisor.Register(storepb.Engine_MYSQL, advisor.MySQLFunctionDisallowedList, &FunctionDisallowedListAdvisor{})}-// FunctionDisallowListAdvisor is the advisor checking for disallow function list.-type FunctionDisallowListAdvisor struct {+// FunctionDisallowedListAdvisor is the advisor checking for disallowed function list.+type FunctionDisallowedListAdvisor struct {}-func (*FunctionDisallowListAdvisor) Check(ctx advisor.Context, _ string) ([]advisor.Advice, error) {+func (*FunctionDisallowedListAdvisor) Check(ctx advisor.Context, _ string) ([]advisor.Advice, error) {stmtList, ok := ctx.AST.([]*mysqlparser.ParseResult)if !ok {return nil, errors.Errorf("failed to convert to mysql parser result")@@ -41,7 +41,7 @@ func (*FunctionDisallowListAdvisor) Check(ctx advisor.Context, _ string) ([]adviif err != nil {return nil, err}- checker := &functionDisallowListChecker{+ checker := &functionDisallowedListChecker{level: level,title: string(ctx.Rule.Type),}@@ -65,7 +65,7 @@ func (*FunctionDisallowListAdvisor) Check(ctx advisor.Context, _ string) ([]advireturn checker.adviceList, nil}-type functionDisallowListChecker struct {+type functionDisallowedListChecker struct {*mysql.BaseMySQLParserListenerbaseLine int@@ -76,11 +76,11 @@ type functionDisallowListChecker struct {disallowList []string}-func (checker *functionDisallowListChecker) EnterQuery(ctx *mysql.QueryContext) {+func (checker *functionDisallowedListChecker) EnterQuery(ctx *mysql.QueryContext) {checker.text = ctx.GetParser().GetTokenStream().GetTextFromRuleContext(ctx)}-func (checker *functionDisallowListChecker) EnterFunctionCall(ctx *mysql.FunctionCallContext) {+func (checker *functionDisallowedListChecker) EnterFunctionCall(ctx *mysql.FunctionCallContext) {pi := ctx.PureIdentifier()if pi != nil {functionName := pi.IDENTIFIER().GetText()diff --git a/backend/plugin/advisor/mysql/test/system_function_disallow_list.yaml b/backend/plugin/advisor/mysql/test/system_function_disallowed_list.yamlsimilarity index 87%rename from backend/plugin/advisor/mysql/test/system_function_disallow_list.yamlrename to backend/plugin/advisor/mysql/test/system_function_disallowed_list.yamlindex 6f7fa99335..8c2fffaedc 100644--- a/backend/plugin/advisor/mysql/test/system_function_disallow_list.yaml+++ b/backend/plugin/advisor/mysql/test/system_function_disallowed_list.yaml@@ -10,7 +10,7 @@want:- status: WARNcode: 1702- title: system.function.disallow-list+ title: system.function.disallowed-listcontent: |-Function "RAND" is disallowed, but "SELECT RAND();" usesline: 1@@ -24,7 +24,7 @@want:- status: WARNcode: 1702- title: system.function.disallow-list+ title: system.function.disallowed-listcontent: |-Function "UUID" is disallowed, but "CREATE TABLE employee (id VARCHAR(36) DEFAULT (UUID()) PRIMARY KEY,@@ -37,7 +37,7 @@want:- status: WARNcode: 1702- title: system.function.disallow-list+ title: system.function.disallowed-listcontent: |-Function "SLEEP" is disallowed, but "SELECT SLEEP(5);" usesline: 1diff --git a/backend/plugin/advisor/sql_review.go b/backend/plugin/advisor/sql_review.goindex 4e7fb003b4..78d20162f1 100644--- a/backend/plugin/advisor/sql_review.go+++ b/backend/plugin/advisor/sql_review.go@@ -189,8 +189,8 @@ const (SchemaRuleViewDisallowCreate SQLReviewRuleType = "system.view.disallow-create"// SchemaRuleFunctionDisallowCreate disallow create function.SchemaRuleFunctionDisallowCreate SQLReviewRuleType = "system.function.disallow-create"- // SchemaRuleFunctionDisallowList enforce the function disallow list.- SchemaRuleFunctionDisallowList SQLReviewRuleType = "system.function.disallow-list"+ // SchemaRuleFunctionDisallowList enforce the disallowed function list.+ SchemaRuleFunctionDisallowList SQLReviewRuleType = "system.function.disallowed-list"// SchemaRuleOnlineMigration advises using online migration to migrate large tables.SchemaRuleOnlineMigration SQLReviewRuleType = "advice.online-migration"@@ -1503,7 +1503,7 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty}case SchemaRuleFunctionDisallowList:if engine == storepb.Engine_MYSQL {- return MySQLFunctionDisallowList, nil+ return MySQLFunctionDisallowedList, nil}case SchemaRuleOnlineMigration:if engine == storepb.Engine_MYSQL {diff --git a/frontend/src/locales/sql-review/en-US.json b/frontend/src/locales/sql-review/en-US.jsonindex 855657350b..c6ce58930d 100644--- a/frontend/src/locales/sql-review/en-US.json+++ b/frontend/src/locales/sql-review/en-US.json@@ -477,6 +477,15 @@"title": "Disallow to create functions","description": "This rule prohibits the creation of functions within the database. Functions provide reusable logic that can simplify queries and enhance data integrity. By disallowing their creation, it helps maintain control over database schema and prevents potential security risks. Suggested error level: Warning"},+ "system-function-disallowed-list": {+ "title": "Prohibit the use of certain functions",+ "description": "This rule restricts the usage of specific functions within the database. By disallowing the use of these functions, it helps maintain data consistency and security. Suggested error level: Warning",+ "component": {+ "list": {+ "title": "Disallow list"+ }+ }+ },"advice-online-migration": {"title": "Advise enabling online migration","description": "Advise enabling online migration if the migrated table row count exceeds your setting. Suggested error level: Warning"diff --git a/frontend/src/locales/sql-review/es-ES.json b/frontend/src/locales/sql-review/es-ES.jsonindex f867cd7d71..abbbd13698 100644--- a/frontend/src/locales/sql-review/es-ES.json+++ b/frontend/src/locales/sql-review/es-ES.json@@ -477,6 +477,15 @@"title": "Prohibición de crear funciones","description": "Esta regla prohíbe la creación de funciones dentro de la base de datos. Las funciones proporcionan lógica reutilizable que puede simplificar las consultas y mejorar la integridad de los datos. Al prohibir su creación, se ayuda a mantener el control sobre el esquema de la base de datos y se previenen posibles riesgos de seguridad. Nivel de error sugerido: Advertencia"},+ "system-function-disallowed-list": {+ "title": "Prohibir el uso de ciertas funciones",+ "description": "Esta regla restringe el uso de funciones específicas dentro de la base de datos. Al prohibir el uso de estas funciones, ayuda a mantener la consistencia y seguridad de los datos. Nivel de error sugerido: Advertencia",+ "component": {+ "list": {+ "title": "Prohibir lista"+ }+ }+ },"advice-online-migration": {"title": "Se recomienda habilitar la migración en línea","description": "Se recomienda habilitar la migración en línea si el recuento de filas de la tabla migrada supera su configuración. Nivel de error sugerido: Advertencia"diff --git a/frontend/src/locales/sql-review/ja-JP.json b/frontend/src/locales/sql-review/ja-JP.jsonindex e6a6300f25..b570c65986 100644--- a/frontend/src/locales/sql-review/ja-JP.json+++ b/frontend/src/locales/sql-review/ja-JP.json@@ -477,6 +477,15 @@"title": "関数の作成を禁止する","description": "このルールは、データベース内での関数の作成を禁止します。関数は再利用可能なロジックを提供し、クエリを簡素化し、データの整合性を向上させることができます。その作成を禁止することで、データベーススキーマの制御を維持し、潜在的なセキュリティリスクを防止します。推奨されるエラーレベル:警告"},+ "system-function-disallowed-list": {+ "title": "特定の関数の使用を禁止する",+ "description": "このルールは、データベース内の特定の関数の使用を制限します。これらの関数の使用を禁止することで、データの一貫性とセキュリティを維持するのに役立ちます。推奨エラーレベル:警告",+ "component": {+ "list": {+ "title": "禁止リスト"+ }+ }+ },"advice-online-migration": {"title": "オンライン移行の有効化を推奨","description": "移行されたテーブル行数が設定値を超えた場合、オンライン移行の有効化を推奨します。推奨されるエラーレベル: 警告"diff --git a/frontend/src/locales/sql-review/vi-VN.json b/frontend/src/locales/sql-review/vi-VN.jsonindex 3ede1988b9..e80f14ed7b 100644--- a/frontend/src/locales/sql-review/vi-VN.json+++ b/frontend/src/locales/sql-review/vi-VN.json@@ -477,6 +477,15 @@"title": "Không cho phép tạo hàm","description": "Quy tắc này cấm việc tạo các hàm trong cơ sở dữ liệu. Các hàm cung cấp logic có thể tái sử dụng giúp đơn giản hóa các truy vấn và tăng cường tính toàn vẹn dữ liệu. Bằng cách không cho phép tạo chúng, nó giúp duy trì kiểm soát đối với cấu trúc cơ sở dữ liệu và ngăn ngừa các rủi ro bảo mật tiềm ẩn. Mức độ lỗi đề xuất: Cảnh báo"},+ "system-function-disallowed-list": {+ "title": "Cấm sử dụng một số hàm",+ "description": "Quy tắc này hạn chế việc sử dụng các hàm cụ thể trong cơ sở dữ liệu. Bằng cách cấm sử dụng các hàm này, nó giúp duy trì tính nhất quán và bảo mật dữ liệu. Mức độ lỗi đề xuất: Cảnh báo",+ "component": {+ "list": {+ "title": "Danh sách không cho phép"+ }+ }+ },"advice-online-migration": {"title": "Khuyến nghị bật di chuyển trực tuyến","description": "Nếu số lượng hàng bảng được di chuyển vượt quá cài đặt của bạn, hãy bật di chuyển trực tuyến. Mức lỗi được đề xuất: Cảnh báo"diff --git a/frontend/src/locales/sql-review/zh-CN.json b/frontend/src/locales/sql-review/zh-CN.jsonindex 349ca30d0d..5006158494 100644--- a/frontend/src/locales/sql-review/zh-CN.json+++ b/frontend/src/locales/sql-review/zh-CN.json@@ -477,8 +477,17 @@"title": "禁止创建函数","description": "该规则禁止在数据库中创建函数。函数提供可重用的逻辑,可以简化查询并增强数据完整性。通过禁止创建它们,有助于保持对数据库架构的控制,并预防潜在的安全风险。建议的错误级别:警告"},+ "system-function-disallowed-list": {+ "title": "禁止使用的函数",+ "description": "此规则限制数据库内特定函数的使用。通过禁止使用这些函数,有助于维护数据一致性和安全性。建议错误级别:警告",+ "component": {+ "list": {+ "title": "禁止的函数"+ }+ }+ },"advice-online-migration": {- "title": "建议启用在线大表变更",+ "title": "建议启用在线大表变更","description": "如果迁移的表行数超过您的设置,建议启用在线迁移。建议的错误级别: 警告"}},diff --git a/frontend/src/types/sql-review-schema.yaml b/frontend/src/types/sql-review-schema.yamlindex cbc698db35..ea23c43377 100644--- a/frontend/src/types/sql-review-schema.yaml+++ b/frontend/src/types/sql-review-schema.yaml@@ -770,6 +770,15 @@ ruleList:engineList:- MYSQLcomponentList: []+ - type: system.function.disallowed-list+ category: SYSTEM+ engineList:+ - MYSQL+ componentList:+ - key: list+ payload:+ type: STRING_ARRAY+ default: []- type: advice.online-migrationcategory: ADVICEengineList:diff --git a/frontend/src/types/sqlReview.ts b/frontend/src/types/sqlReview.tsindex 260627f269..528ea2b9fe 100644--- a/frontend/src/types/sqlReview.ts+++ b/frontend/src/types/sqlReview.ts@@ -161,6 +161,7 @@ export type RuleType =| "system.event.disallow-create"| "system.view.disallow-create"| "system.function.disallow-create"+ | "system.function.disallowed-list"| "index.no-duplicate-column"| "index.type-no-blob"| "index.key-number-limit"