Commit graph

2 commits

Author SHA1 Message Date
continue[bot]
bbb72d13b8 fix(terminal-security): prevent newline bypass in command validation
Fixes a security vulnerability where an attacker could bypass the terminal
command allow-list by using newline characters (\n, \r\n, \r) as command
separators.

The issue occurred because shell-quote treats literal newlines as whitespace,
causing multiple newline-separated commands to be evaluated as a single
command. This allowed dangerous commands to be hidden after safe commands.

Changes:
- Split input on line breaks before parsing with shell-quote
- Evaluate each line independently and return the most restrictive policy
- Added comprehensive tests for newline bypass scenarios
- Tests cover Unix (\n), Windows (\r\n), and old Mac (\r) line endings

Security Impact:
- Prevents bypass of allow-list using 'ls\nopen -a Calculator'
- Prevents bypass of allow-list using 'echo hello\nnpm install malicious'
- Critical commands (sudo, rm -rf /) are still properly blocked
- High-risk commands now correctly require permission

Generated with [Continue](https://continue.dev)

Co-Authored-By: Continue <nate@continue.dev>
Co-authored-by: Username <nate@continue.dev>
2025-10-30 00:49:31 +00:00
Tomasz Stefaniak
c00bbd78b1 improv: move terminal security to separate package 2025-09-03 12:47:08 -07:00