|
|
@@ -4,25 +4,6 @@ import DESCRIPTION from "./bash.txt"
|
|
|
import { App } from "../app/app"
|
|
|
|
|
|
const MAX_OUTPUT_LENGTH = 30000
|
|
|
-const BANNED_COMMANDS = [
|
|
|
- "alias",
|
|
|
- "curl",
|
|
|
- "curlie",
|
|
|
- "wget",
|
|
|
- "axel",
|
|
|
- "aria2c",
|
|
|
- "nc",
|
|
|
- "telnet",
|
|
|
- "lynx",
|
|
|
- "w3m",
|
|
|
- "links",
|
|
|
- "httpie",
|
|
|
- "xh",
|
|
|
- "http-prompt",
|
|
|
- "chrome",
|
|
|
- "firefox",
|
|
|
- "safari",
|
|
|
-]
|
|
|
const DEFAULT_TIMEOUT = 1 * 60 * 1000
|
|
|
const MAX_TIMEOUT = 10 * 60 * 1000
|
|
|
|
|
|
@@ -45,8 +26,6 @@ export const BashTool = Tool.define({
|
|
|
}),
|
|
|
async execute(params, ctx) {
|
|
|
const timeout = Math.min(params.timeout ?? DEFAULT_TIMEOUT, MAX_TIMEOUT)
|
|
|
- if (BANNED_COMMANDS.some((item) => params.command.startsWith(item)))
|
|
|
- throw new Error(`Command '${params.command}' is not allowed`)
|
|
|
|
|
|
const process = Bun.spawn({
|
|
|
cmd: ["bash", "-c", params.command],
|