mirror of
https://github.com/RuoJi6/ARTEX.git
synced 2026-11-15 06:33:50 +08:00
tool_input rules were only matched against the raw JSON of the tool call. JSON escapes newlines and tabs, so a multi-line command reaches the rules as `cd /tmp\nrm -rf /var/www`. There is no word boundary between the `n` of `\n` and `rm`, so the built-in `\brm\b` / `\bmkfs\b` / `\bDROP ...` rules never fire on a dangerous command that starts a new line (heredocs, small scripts). Quotes (`\"`) and, for Go-encoded input, & < > (`&` etc.) have the same problem. Decode the input once per Match and also try each string value. The raw JSON is still checked first, so existing rules written against the JSON form keep matching; the change can only add matches.