fix(security): ensure custom deny patterns extend defaults instead of replacing them (#479)
* fix (security): custom deny patterns denying default patterns * fix formatting whitespace
This commit is contained in:
parent
2fa51d7b86
commit
09b1992dd7
1 changed files with 1 additions and 2 deletions
|
|
@ -81,6 +81,7 @@ func NewExecToolWithConfig(workingDir string, restrict bool, config *config.Conf
|
||||||
execConfig := config.Tools.Exec
|
execConfig := config.Tools.Exec
|
||||||
enableDenyPatterns = execConfig.EnableDenyPatterns
|
enableDenyPatterns = execConfig.EnableDenyPatterns
|
||||||
if enableDenyPatterns {
|
if enableDenyPatterns {
|
||||||
|
denyPatterns = append(denyPatterns, defaultDenyPatterns...)
|
||||||
if len(execConfig.CustomDenyPatterns) > 0 {
|
if len(execConfig.CustomDenyPatterns) > 0 {
|
||||||
fmt.Printf("Using custom deny patterns: %v\n", execConfig.CustomDenyPatterns)
|
fmt.Printf("Using custom deny patterns: %v\n", execConfig.CustomDenyPatterns)
|
||||||
for _, pattern := range execConfig.CustomDenyPatterns {
|
for _, pattern := range execConfig.CustomDenyPatterns {
|
||||||
|
|
@ -91,8 +92,6 @@ func NewExecToolWithConfig(workingDir string, restrict bool, config *config.Conf
|
||||||
}
|
}
|
||||||
denyPatterns = append(denyPatterns, re)
|
denyPatterns = append(denyPatterns, re)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
denyPatterns = append(denyPatterns, defaultDenyPatterns...)
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// If deny patterns are disabled, we won't add any patterns, allowing all commands.
|
// If deny patterns are disabled, we won't add any patterns, allowing all commands.
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue