mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-08-01 16:38:48 +02:00
- fact_key 校验放开大写字母,支持驼峰命名(如 finding/info-disclosure-messageBundle): - internal/database/project.go: 正则 ^[a-z0-9]... 改为 ^[a-zA-Z0-9]...,并更新错误提示 - internal/project/fact_body_links.go: body 解析正则(依赖事实/相关 fact_key)同步放开大写 - authorizeProjectTool 区分「未绑定项目 / 查询出错 / 真实无权限」三种情况: 未绑定项目时返回明确可执行提示,替代误导性的 no access to project - internal/app/mcp_authorization.go Co-authored-by: sycmacmini <sycmacmini@sycmacminis-Mac-mini.local>
This commit is contained in:
@@ -10,7 +10,7 @@ import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
var factKeyPattern = regexp.MustCompile(`^[a-z0-9][a-z0-9._/-]*$`)
|
||||
var factKeyPattern = regexp.MustCompile(`^[a-zA-Z0-9][a-zA-Z0-9._/-]*$`)
|
||||
|
||||
// ValidateFactKey 校验事实 key(项目内唯一标识)。
|
||||
func ValidateFactKey(key string) error {
|
||||
@@ -22,7 +22,7 @@ func ValidateFactKey(key string) error {
|
||||
return fmt.Errorf("fact_key 过长(最多 128 字符)")
|
||||
}
|
||||
if !factKeyPattern.MatchString(key) {
|
||||
return fmt.Errorf("fact_key 格式无效,仅允许小写字母、数字及 . _ / -,且须以小写字母或数字开头")
|
||||
return fmt.Errorf("fact_key 格式无效,仅允许字母、数字及 . _ / -,且须以字母或数字开头(支持驼峰命名)")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user