feat(tools): opt-in shell tool without interpreter: allowlist per chain element, no expansions/redirections, workspace-only, timeout, output limit, scrubbed env

This commit is contained in:
OpenClaw Dev 2026-10-25 04:44:04 +01:00
parent 1e32997504
commit 406a523d54
5 changed files with 464 additions and 0 deletions

View file

@ -37,7 +37,16 @@ type WebFetch struct {
AllowPrivate bool `yaml:"allow_private" json:"allow_private"`
}
// Shell configures the opt-in shell tool (default off).
type Shell struct {
Enabled bool `yaml:"enabled" json:"enabled"`
AllowedCommands []string `yaml:"allowed_commands" json:"allowed_commands"`
TimeoutSec int `yaml:"timeout_sec" json:"timeout_sec"`
MaxOutputBytes int `yaml:"max_output_bytes" json:"max_output_bytes"`
}
type Tools struct {
Shell Shell `yaml:"shell" json:"shell"`
WebFetch WebFetch `yaml:"web_fetch" json:"web_fetch"`
// FilesEnabled enables read/write/list tools confined to the workspace directory.
FilesEnabled bool `yaml:"files_enabled" json:"files_enabled"`
@ -75,6 +84,7 @@ func Default() Config {
Tools: Tools{
WebFetch: WebFetch{Enabled: true, MaxBytes: 512 * 1024, TimeoutSec: 15},
FilesEnabled: true,
Shell: Shell{Enabled: false, TimeoutSec: 30, MaxOutputBytes: 64 * 1024},
FileMaxBytes: 1 << 20,
},
}