Skip to content

Commit f1e2c4f

Browse files
committed
fix: optimize role code validator to avoid sql injects
1 parent 1d69aa2 commit f1e2c4f

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

api/desc/core/role.api

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type (
1515
Name *string `json:"name,optional" validate:"omitempty,max=30"`
1616

1717
// Role code | 角色码
18-
Code *string `json:"code,optional" validate:"omitempty,max=20"`
18+
Code *string `json:"code,optional" validate:"omitempty,max=15,alphanum"`
1919

2020
// DefaultRouter | 默认首页
2121
DefaultRouter *string `json:"defaultRouter,optional" validate:"omitempty,max=80"`

api/internal/handler/routes.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/internal/types/types.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6128,7 +6128,7 @@
61286128
"code": {
61296129
"description": "Role code | 角色码",
61306130
"type": "string",
6131-
"maxLength": 20,
6131+
"maxLength": 15,
61326132
"x-go-name": "Code"
61336133
},
61346134
"createdAt": {

0 commit comments

Comments
 (0)