feat: 加固 Agent CLI 执行边界并更新模型目录
收紧 SSH 命令护栏、权限校验与远程执行会话,并同步主流大模型供应商列表。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
67660ae1d6
commit
2fd1624bec
18 files changed
+480
-49
No files matched your search
@@ -15,7 +15,7 @@ var sensitivePatterns = []*regexp.Regexp{
|
||||
regexp.MustCompile(`(?i)((?:mysql|postgres|postgresql|redis|mongodb)://[^:\s/@]+:)[^@\s]+(@)`),
|
||||
regexp.MustCompile(`(?is)-----BEGIN [A-Z ]*PRIVATE KEY-----.*?-----END [A-Z ]*PRIVATE KEY-----`),
|
||||
regexp.MustCompile(`(?i)((?:Cookie|Set-Cookie):\s*)[^\r\n]+`),
|
||||
regexp.MustCompile(`(?i)(AKIA[0-9A-Z]{16})`),
|
||||
regexp.MustCompile(`(?i)AKIA[0-9A-Z]{16}`),
|
||||
}
|
||||
|
||||
var sensitiveKeys = map[string]bool{
|
||||
@@ -65,6 +65,18 @@ func SanitizeJSON(raw string) string {
|
||||
return string(b)
|
||||
}
|
||||
|
||||
// SanitizeMap 返回脱敏后的参数副本,避免事件、审计和记忆泄露工具参数中的凭证。 // Logan.Li
|
||||
func SanitizeMap(input map[string]interface{}) map[string]interface{} {
|
||||
if input == nil {
|
||||
return nil
|
||||
}
|
||||
sanitized, ok := sanitizeValue(input).(map[string]interface{})
|
||||
if !ok {
|
||||
return map[string]interface{}{}
|
||||
}
|
||||
return sanitized
|
||||
}
|
||||
|
||||
func sanitizeValue(v interface{}) interface{} {
|
||||
switch val := v.(type) {
|
||||
case map[string]interface{}:
|
||||
|
||||
Reference in new issue
Block a user