Skip to content

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

chore: tweak rule name (#10875)

boojack879eb05282fa
diff --git a/backend/plugin/advisor/advisor.go b/backend/plugin/advisor/advisor.go
index cb6d811495..96ef5451f0 100644
--- a/backend/plugin/advisor/advisor.go
+++ b/backend/plugin/advisor/advisor.go
@@ -230,8 +230,8 @@ const (
// MySQLStatementSelectFullTableScan is an advisor type for checking MySQL select full table scan or not.
MySQLStatementSelectFullTableScan Type = "bb.plugin.advisor.mysql.statement.select-full-table-scan"
- // MySQLDisallowProcedure is an advisor type for MySQL disallow procedure.
- MySQLDisallowProcedure Type = "bb.plugin.advisor.mysql.disallow-procedure"
+ // MySQLProcedureDisallowCreate is an advisor type for MySQL disallow create procedure.
+ MySQLProcedureDisallowCreate Type = "bb.plugin.advisor.mysql.procedure.disallow-create"
// MySQLEventDisallowCreate is an advisor type for MySQL disallow create event.
MySQLEventDisallowCreate Type = "bb.plugin.advisor.mysql.event.disallow-create"
// MySQLViewDisallowCreate is an advisor type for MySQL disallow create view.
diff --git a/backend/plugin/advisor/config/sql-review.dev.yaml b/backend/plugin/advisor/config/sql-review.dev.yaml
index 7544b511f5..39977cd9a9 100644
--- a/backend/plugin/advisor/config/sql-review.dev.yaml
+++ b/backend/plugin/advisor/config/sql-review.dev.yaml
@@ -213,11 +213,11 @@ ruleList:
level: WARNING
payload:
number: 64
- - type: system.procedure.disallow
- level: ERROR
- - type: system.event.disallow
+ - type: system.procedure.disallow-create
+ level: WARNING
+ - type: system.event.disallow-create
level: WARNING
- - type: system.view.disallow
+ - type: system.view.disallow-create
level: WARNING
- type: system.function.disallow-create
level: WARNING
diff --git a/backend/plugin/advisor/config/sql-review.prod.yaml b/backend/plugin/advisor/config/sql-review.prod.yaml
index 9d09d94a0c..0f20abe3a0 100644
--- a/backend/plugin/advisor/config/sql-review.prod.yaml
+++ b/backend/plugin/advisor/config/sql-review.prod.yaml
@@ -213,11 +213,11 @@ ruleList:
level: WARNING
payload:
number: 64
- - type: system.procedure.disallow
- level: ERROR
- - type: system.event.disallow
+ - type: system.procedure.disallow-create
+ level: WARNING
+ - type: system.event.disallow-create
level: WARNING
- - type: system.view.disallow
+ - type: system.view.disallow-create
level: WARNING
- type: system.function.disallow-create
level: WARNING
diff --git a/backend/plugin/advisor/mysql/advisor_disallow_procedure.go b/backend/plugin/advisor/mysql/advisor_disallow_procedure.go
index 0cbadec4a2..c6fbf259a7 100644
--- a/backend/plugin/advisor/mysql/advisor_disallow_procedure.go
+++ b/backend/plugin/advisor/mysql/advisor_disallow_procedure.go
@@ -14,19 +14,19 @@ import (
)
var (
- _ advisor.Advisor = (*DisallowProcedureAdvisor)(nil)
+ _ advisor.Advisor = (*ProcedureDisallowCreateAdvisor)(nil)
)
func init() {
- advisor.Register(storepb.Engine_MYSQL, advisor.MySQLDisallowProcedure, &DisallowProcedureAdvisor{})
+ advisor.Register(storepb.Engine_MYSQL, advisor.MySQLProcedureDisallowCreate, &ProcedureDisallowCreateAdvisor{})
}
-// DisallowProcedureAdvisor is the advisor checking for disallow procedure.
-type DisallowProcedureAdvisor struct {
+// ProcedureDisallowCreateAdvisor is the advisor checking for disallow create procedure.
+type ProcedureDisallowCreateAdvisor struct {
}
-// Check checks for disallow procedure.
-func (*DisallowProcedureAdvisor) Check(ctx advisor.Context, _ string) ([]advisor.Advice, error) {
+// Check checks for disallow create procedure.
+func (*ProcedureDisallowCreateAdvisor) 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")
@@ -36,7 +36,7 @@ func (*DisallowProcedureAdvisor) Check(ctx advisor.Context, _ string) ([]advisor
if err != nil {
return nil, err
}
- checker := &disallowProcedureChecker{
+ checker := &procedureDisallowCreateChecker{
level: level,
title: string(ctx.Rule.Type),
}
@@ -57,7 +57,7 @@ func (*DisallowProcedureAdvisor) Check(ctx advisor.Context, _ string) ([]advisor
return checker.adviceList, nil
}
-type disallowProcedureChecker struct {
+type procedureDisallowCreateChecker struct {
*mysql.BaseMySQLParserListener
baseLine int
@@ -67,12 +67,12 @@ type disallowProcedureChecker struct {
text string
}
-func (checker *disallowProcedureChecker) EnterQuery(ctx *mysql.QueryContext) {
+func (checker *procedureDisallowCreateChecker) EnterQuery(ctx *mysql.QueryContext) {
checker.text = ctx.GetParser().GetTokenStream().GetTextFromRuleContext(ctx)
}
-// EnterCreateProcedure is to check if the procedure is forbidden.
-func (checker *disallowProcedureChecker) EnterCreateProcedure(ctx *mysql.CreateProcedureContext) {
+// EnterCreateProcedure is to check if creating procedure is forbidden.
+func (checker *procedureDisallowCreateChecker) EnterCreateProcedure(ctx *mysql.CreateProcedureContext) {
code := advisor.Ok
if ctx.ProcedureName() != nil {
code = advisor.DisallowCreateProcedure
diff --git a/backend/plugin/advisor/mysql/mysql_rules_test.go b/backend/plugin/advisor/mysql/mysql_rules_test.go
index 8c5dfe0fa3..724c85498c 100644
--- a/backend/plugin/advisor/mysql/mysql_rules_test.go
+++ b/backend/plugin/advisor/mysql/mysql_rules_test.go
@@ -128,12 +128,12 @@ func TestMySQLRules(t *testing.T) {
advisor.SchemaRuleCharsetAllowlist,
// advisor.SchemaRuleCollationAllowlist enforce the collation allowlist.
advisor.SchemaRuleCollationAllowlist,
- // advisor.SchemaRuleDisallowProcedure enforce the disallow procedure.
- advisor.SchemaRuleDisallowProcedure,
- // advisor.SchemaRuleDisallowEvent enforce the disallow event.
- advisor.SchemaRuleDisallowEvent,
- // advisor.SchemaRuleDisallowView enforce the disallow view.
- advisor.SchemaRuleDisallowView,
+ // advisor.SchemaRuleDisallowProcedure enforce the disallow create procedure.
+ advisor.SchemaRuleProcedureDisallowCreate,
+ // advisor.SchemaRuleDisallowEvent enforce the disallow create event.
+ advisor.SchemaRuleEventDisallowCreate,
+ // advisor.SchemaRuleDisallowView enforce the disallow create view.
+ advisor.SchemaRuleViewDisallowCreate,
// advisor.SchemaRuleFunctionDisallowCreate enforce the disallow create function.
advisor.SchemaRuleFunctionDisallowCreate,
}
diff --git a/backend/plugin/advisor/mysql/test/system_event_disallow.yaml b/backend/plugin/advisor/mysql/test/system_event_disallow_create.yaml
similarity index 94%
rename from backend/plugin/advisor/mysql/test/system_event_disallow.yaml
rename to backend/plugin/advisor/mysql/test/system_event_disallow_create.yaml
index 91a82def05..c34bcb2c1f 100644
--- a/backend/plugin/advisor/mysql/test/system_event_disallow.yaml
+++ b/backend/plugin/advisor/mysql/test/system_event_disallow_create.yaml
@@ -18,7 +18,7 @@
want:
- status: WARN
code: 1501
- title: system.event.disallow
+ title: system.event.disallow-create
content: |-
Event is forbidden, but "CREATE EVENT daily_backup
ON SCHEDULE
diff --git a/backend/plugin/advisor/mysql/test/system_procedure_disallow.yaml b/backend/plugin/advisor/mysql/test/system_procedure_disallow_create.yaml
similarity index 91%
rename from backend/plugin/advisor/mysql/test/system_procedure_disallow.yaml
rename to backend/plugin/advisor/mysql/test/system_procedure_disallow_create.yaml
index f5c34649b6..4e2b7c32be 100644
--- a/backend/plugin/advisor/mysql/test/system_procedure_disallow.yaml
+++ b/backend/plugin/advisor/mysql/test/system_procedure_disallow_create.yaml
@@ -14,7 +14,7 @@
want:
- status: WARN
code: 1401
- title: system.procedure.disallow
+ title: system.procedure.disallow-create
content: |-
Procedure is forbidden, but "CREATE PROCEDURE simpleProcedure()
BEGIN
diff --git a/backend/plugin/advisor/mysql/test/system_view_disallow.yaml b/backend/plugin/advisor/mysql/test/system_view_disallow_create.yaml
similarity index 89%
rename from backend/plugin/advisor/mysql/test/system_view_disallow.yaml
rename to backend/plugin/advisor/mysql/test/system_view_disallow_create.yaml
index 2d69bf1b27..3c3ab1beaa 100644
--- a/backend/plugin/advisor/mysql/test/system_view_disallow.yaml
+++ b/backend/plugin/advisor/mysql/test/system_view_disallow_create.yaml
@@ -11,7 +11,7 @@
want:
- status: WARN
code: 1601
- title: system.view.disallow
+ title: system.view.disallow-create
content: |-
View is forbidden, but "CREATE VIEW get_one AS SELECT 1;" creates
line: 1
diff --git a/backend/plugin/advisor/sql_review.go b/backend/plugin/advisor/sql_review.go
index 5fa4a9bcb7..8307b7f973 100644
--- a/backend/plugin/advisor/sql_review.go
+++ b/backend/plugin/advisor/sql_review.go
@@ -179,12 +179,12 @@ const (
SchemaRuleCollationAllowlist SQLReviewRuleType = "system.collation.allowlist"
// SchemaRuleCommentLength limit comment length.
SchemaRuleCommentLength SQLReviewRuleType = "system.comment.length"
- // SchemaRuleDisallowProcedure disallow procedure.
- SchemaRuleDisallowProcedure SQLReviewRuleType = "system.procedure.disallow"
- // SchemaRuleDisallowEvent disallow event.
- SchemaRuleDisallowEvent SQLReviewRuleType = "system.event.disallow"
- // SchemaRuleDisallowView disallow view.
- SchemaRuleDisallowView SQLReviewRuleType = "system.view.disallow"
+ // SchemaRuleProcedureDisallowCreate disallow create procedure.
+ SchemaRuleProcedureDisallowCreate SQLReviewRuleType = "system.procedure.disallow-create"
+ // SchemaRuleEventDisallowCreate disallow create event.
+ SchemaRuleEventDisallowCreate SQLReviewRuleType = "system.event.disallow-create"
+ // SchemaRuleViewDisallowCreate disallow create view.
+ SchemaRuleViewDisallowCreate SQLReviewRuleType = "system.view.disallow-create"
// SchemaRuleFunctionDisallowCreate disallow create function.
SchemaRuleFunctionDisallowCreate SQLReviewRuleType = "system.function.disallow-create"
@@ -1468,15 +1468,15 @@ func getAdvisorTypeByRule(ruleType SQLReviewRuleType, engine storepb.Engine) (Ty
if engine == storepb.Engine_POSTGRES {
return PostgreSQLCommentConvention, nil
}
- case SchemaRuleDisallowProcedure:
+ case SchemaRuleProcedureDisallowCreate:
if engine == storepb.Engine_MYSQL {
- return MySQLDisallowProcedure, nil
+ return MySQLProcedureDisallowCreate, nil
}
- case SchemaRuleDisallowEvent:
+ case SchemaRuleEventDisallowCreate:
if engine == storepb.Engine_MYSQL {
return MySQLEventDisallowCreate, nil
}
- case SchemaRuleDisallowView:
+ case SchemaRuleViewDisallowCreate:
if engine == storepb.Engine_MYSQL {
return MySQLViewDisallowCreate, nil
}
diff --git a/backend/plugin/advisor/utils_for_tests.go b/backend/plugin/advisor/utils_for_tests.go
index dd248327ff..cd74fc828c 100644
--- a/backend/plugin/advisor/utils_for_tests.go
+++ b/backend/plugin/advisor/utils_for_tests.go
@@ -355,9 +355,9 @@ func SetDefaultSQLReviewRulePayload(ruleTp SQLReviewRuleType, dbType storepb.Eng
SchemaRuleIndexTypeNoBlob,
SchemaRuleIdentifierNoKeyword,
SchemaRuleTableNameNoKeyword,
- SchemaRuleDisallowProcedure,
- SchemaRuleDisallowEvent,
- SchemaRuleDisallowView,
+ SchemaRuleProcedureDisallowCreate,
+ SchemaRuleEventDisallowCreate,
+ SchemaRuleViewDisallowCreate,
SchemaRuleFunctionDisallowCreate,
SchemaRuleStatementCreateSpecifySchema:
case SchemaRuleTableDropNamingConvention:
diff --git a/frontend/src/locales/sql-review/en-US.json b/frontend/src/locales/sql-review/en-US.json
index b1ff286cad..d2b05e0dd9 100644
--- a/frontend/src/locales/sql-review/en-US.json
+++ b/frontend/src/locales/sql-review/en-US.json
@@ -456,15 +456,15 @@
}
}
},
- "system-procedure-disallow": {
+ "system-procedure-disallow-create": {
"title": "Disallow to create procedures",
- "description": "This rule prohibits the execution of procedures within the database. System procedures often perform critical operations that could impact the stability and security of the database environment. By disallowing their execution, it helps prevent unintended changes and potential vulnerabilities. Suggested error level: Error"
+ "description": "This rule prohibits the execution of procedures within the database. System procedures often perform critical operations that could impact the stability and security of the database environment. By disallowing their execution, it helps prevent unintended changes and potential vulnerabilities. Suggested error level: Warning"
},
- "system-event-disallow": {
+ "system-event-disallow-create": {
"title": "Disallow to create events",
"description": "This rule prohibits the creation of events within the database. System events often perform automated tasks that could affect the database environment. By disallowing their creation, it helps maintain control over database operations and prevents potential disruptions. Suggested error level: Warning"
},
- "system-view-disallow": {
+ "system-view-disallow-create": {
"title": "Disallow to create views",
"description": "This rule prohibits the creation of views within the database. Views provide a virtual representation of data that can simplify queries and enhance data security. By disallowing their creation, it helps maintain control over database schema and prevents potential security risks. Suggested error level: Warning"
}
diff --git a/frontend/src/locales/sql-review/es-ES.json b/frontend/src/locales/sql-review/es-ES.json
index b297d2c6ee..030a388402 100644
--- a/frontend/src/locales/sql-review/es-ES.json
+++ b/frontend/src/locales/sql-review/es-ES.json
@@ -456,15 +456,15 @@
}
}
},
- "system-procedure-disallow": {
+ "system-procedure-disallow-create": {
"title": "Prohibir la ejecución de procedimientos del sistema",
- "description": "Los procedimientos del sistema pueden realizar operaciones de alto riesgo, como la eliminación de datos, la modificación de la estructura de la base de datos, etc. Nivel de error sugerido: Error"
+ "description": "Los procedimientos del sistema pueden realizar operaciones de alto riesgo, como la eliminación de datos, la modificación de la estructura de la base de datos, etc. Nivel de error sugerido: Advertencia"
},
- "system-event-disallow": {
+ "system-event-disallow-create": {
"title": "Prohibir la creación de eventos",
"description": "Esta regla prohíbe la creación de eventos dentro de la base de datos. Los eventos del sistema a menudo realizan tareas automatizadas que podrían afectar el entorno de la base de datos. Al prohibir su creación, ayuda a mantener el control sobre las operaciones de la base de datos y previene posibles interrupciones. Nivel de error sugerido: Advertencia"
},
- "system-view-disallow": {
+ "system-view-disallow-create": {
"title": "Prohibir la creación de vistas",
"description": "Esta regla prohíbe la creación de vistas dentro de la base de datos. Las vistas proporcionan una representación virtual de los datos que puede simplificar las consultas y mejorar la seguridad de los datos. Al prohibir su creación, ayuda a mantener el control sobre el esquema de la base de datos y previene posibles riesgos de seguridad. Nivel de error sugerido: Advertencia"
}
diff --git a/frontend/src/locales/sql-review/ja-JP.json b/frontend/src/locales/sql-review/ja-JP.json
index f115ec4a8a..5fdb9cb881 100644
--- a/frontend/src/locales/sql-review/ja-JP.json
+++ b/frontend/src/locales/sql-review/ja-JP.json
@@ -456,15 +456,15 @@
}
}
},
- "system-procedure-disallow": {
+ "system-procedure-disallow-create": {
"title": "システムプロシージャの実行を禁止する",
- "description": "システムプロシージャは、データベースのメタデータを変更するために使用されるため、誤って実行するとデータベースの整合性が失われる可能性があります。提案エラーレベル:エラー"
+ "description": "システムプロシージャは、データベースのメタデータを変更するために使用されるため、誤って実行するとデータベースの整合性が失われる可能性があります。提案エラーレベル:警告"
},
- "system-event-disallow": {
- "title": "Không cho phép tạo sự kiện",
- "description": "Quy tắc này cấm tạo sự kiện trong cơ sở dữ liệu. Các sự kiện hệ thống thường thực hiện các tác vụ tự động có thể ảnh hưởng đến môi trường cơ sở 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 về các hoạt động cơ sở dữ liệu và ngăn chặn các sự cố tiềm ẩn. Mức độ lỗi được đề xuất: Cảnh báo"
+ "system-event-disallow-create": {
+ "title": "イベントの作成は許可されていません",
+ "description": "このルールは、データベース内でのイベントの作成を禁止します。システム イベントは、多くの場合、データベース環境に影響を与える可能性のある自動タスクを実行します。イベントの作成を禁止することで、データベース操作の制御を維持し、潜在的な問題を防ぐことができます。推奨エラー レベル:警告"
},
- "system-view-disallow": {
+ "system-view-disallow-create": {
"title": "ビューの作成を禁止",
"description": "このルールは、データベース内でのビューの作成を禁止します。ビューは、クエリを単純化し、データのセキュリティを向上させることができるデータの仮想表現を提供します。その作成を禁止することで、データベーススキーマの管理を維持し、潜在的なセキュリティリスクを防ぐのに役立ちます。推奨されるエラーレベル:警告"
}
diff --git a/frontend/src/locales/sql-review/vi-VN.json b/frontend/src/locales/sql-review/vi-VN.json
index 8db1b0e4be..74384877bd 100644
--- a/frontend/src/locales/sql-review/vi-VN.json
+++ b/frontend/src/locales/sql-review/vi-VN.json
@@ -456,15 +456,15 @@
}
}
},
- "system-procedure-disallow": {
+ "system-procedure-disallow-create": {
"title": "Cấm thực thi các thủ tục hệ thống",
- "description": "Cấm thực thi các thủ tục hệ thống. Mức độ lỗi đề xuất: Lỗi"
+ "description": "Cấm thực thi các thủ tục hệ thống. Mức độ lỗi đề xuất: Cảnh báo"
},
- "system-event-disallow": {
+ "system-event-disallow-create": {
"title": "Không cho phép tạo sự kiện",
"description": "Quy tắc này cấm tạo sự kiện trong cơ sở dữ liệu. Các sự kiện hệ thống thường thực hiện các tác vụ tự động có thể ảnh hưởng đến môi trường cơ sở 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 về các hoạt động cơ sở dữ liệu và ngăn chặn các sự cố tiềm ẩn. Mức độ lỗi được đề xuất: Cảnh báo"
},
- "system-view-disallow": {
+ "system-view-disallow-create": {
"title": "Không cho phép tạo view",
"description": "Quy tắc này cấm tạo view trong cơ sở dữ liệu. View cung cấp một biểu diễn ảo của dữ liệu có thể đơn giản hóa các truy vấn và tăng cường bảo mật 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 về cấu trúc cơ sở dữ liệu và ngăn chặn các rủi ro bảo mật tiềm ẩ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.json
index dfba85212b..d0cd69cf95 100644
--- a/frontend/src/locales/sql-review/zh-CN.json
+++ b/frontend/src/locales/sql-review/zh-CN.json
@@ -456,15 +456,15 @@
}
}
},
- "system-procedure-disallow": {
+ "system-procedure-disallow-create": {
"title": "禁止创建存储过程",
- "description": "存储过程通常会执行可能影响数据库环境稳定性和安全性的关键操作。禁止创建存储过程有助于防止意外更改和潜在漏洞。建议错误等级:错误"
+ "description": "存储过程通常会执行可能影响数据库环境稳定性和安全性的关键操作。禁止创建存储过程有助于防止意外更改和潜在漏洞。建议错误等级:警告"
},
- "system-event-disallow": {
+ "system-event-disallow-create": {
"title": "禁止创建事件",
"description": "该规则禁止在数据库中创建事件。系统事件通常执行可能影响数据库环境的自动化任务。通过禁止创建它们,有助于控制数据库操作并防止潜在的中断。建议的错误级别:警告"
},
- "system-view-disallow": {
+ "system-view-disallow-create": {
"title": "禁止创建视图",
"description": "该规则禁止在数据库中创建视图。视图提供了数据的虚拟表示,可以简化查询并增强数据安全性。通过禁止创建它们,有助于维护对数据库模式的控制,并防止潜在的安全风险。建议的错误级别:警告"
}
diff --git a/frontend/src/types/sql-review-schema.yaml b/frontend/src/types/sql-review-schema.yaml
index f946783d48..090ef6e46a 100644
--- a/frontend/src/types/sql-review-schema.yaml
+++ b/frontend/src/types/sql-review-schema.yaml
@@ -741,17 +741,17 @@ ruleList:
payload:
type: NUMBER
default: 64
- - type: system.procedure.disallow
+ - type: system.procedure.disallow-create
category: SYSTEM
engineList:
- MYSQL
componentList: []
- - type: system.event.disallow
+ - type: system.event.disallow-create
category: SYSTEM
engineList:
- MYSQL
componentList: []
- - type: system.view.disallow
+ - type: system.view.disallow-create
category: SYSTEM
engineList:
- MYSQL