Commit graph

5 commits

Author SHA1 Message Date
continue[bot]
96cbab156f style: run prettier on terminal security code
Fix code formatting to pass prettier checks in CI.

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

Co-Authored-By: Continue <nate@continue.dev>
Co-authored-by: Username <nate@continue.dev>
2025-10-30 00:56:55 +00:00
continue[bot]
3e66f6ebb1 fix(terminal-security): add explicit type annotation for TypeScript
Add explicit ToolPolicy type annotation to mostRestrictivePolicy variable
to fix TypeScript compilation error in CI. TypeScript was inferring a
narrower type that didn't include 'disabled', causing type mismatch errors.

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

Co-Authored-By: Continue <nate@continue.dev>
Co-authored-by: Username <nate@continue.dev>
2025-10-30 00:51:52 +00:00
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
45f3f5a6a6 fix: prettier 2025-09-03 12:48:57 -07:00
Tomasz Stefaniak
c00bbd78b1 improv: move terminal security to separate package 2025-09-03 12:47:08 -07:00