π‘οΈ Sentinel: [HIGH] Fix terminal injection via incomplete OSC terminator#161
π‘οΈ Sentinel: [HIGH] Fix terminal injection via incomplete OSC terminator#161hongymagic wants to merge 1 commit into
Conversation
β¦ (ST) in OSC regex Co-authored-by: hongymagic <302730+hongymagic@users.noreply.github.com>
|
π Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a π emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
There was a problem hiding this comment.
Pull request overview
This PR patches a terminal injection vulnerability in src/ansi.ts by extending ANSI_REGEX to recognize the String Terminator (\u001B\) as an OSC sequence terminator, in addition to BEL (\u0007). Previously, OSC sequences terminated by ST would bypass the ANSI stripper.
Changes:
- Update
ANSI_REGEXinsrc/ansi.tsto match either\u0007or\u001B\as the OSC terminator. - Add a corresponding entry to
.jules/sentinel.mddocumenting the vulnerability and prevention.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/ansi.ts | Extends the OSC terminator alternation to include ESC \ (ST) alongside BEL. |
| .jules/sentinel.md | Documents the vulnerability, learning, and prevention for the regex fix. |
π¨ Severity: HIGH
π‘ Vulnerability: The regular expression in
src/ansi.tsused to strip ANSI escape codes only accounted for the Bell character (\u0007) as an Operating System Command (OSC) sequence terminator. It did not support the String Terminator (ST) sequence\u001B\.π― Impact: A malicious model or prompt injection payload could inject an OSC escape sequence terminated by
\u001B\to bypass the ANSI stripper, potentially leading to terminal injection.π§ Fix: Updated
ANSI_REGEXto match either\u0007or\u001B\as the sequence terminator by modifying\u0007to(?:\\u0007|\\u001B\\\\).β Verification: Ran unit tests (specifically
tests/ansi_security.test.ts), lint checks, and the full test suite viabun run testto verify the fix works and does not introduce regressions.PR created automatically by Jules for task 12715310405102718263 started by @hongymagic