Skip to content

πŸ›‘οΈ Sentinel: [HIGH] Fix terminal injection via incomplete OSC terminator#161

Open
hongymagic wants to merge 1 commit into
mainfrom
sentinel-st-osc-fix-12715310405102718263
Open

πŸ›‘οΈ Sentinel: [HIGH] Fix terminal injection via incomplete OSC terminator#161
hongymagic wants to merge 1 commit into
mainfrom
sentinel-st-osc-fix-12715310405102718263

Conversation

@hongymagic

Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
πŸ’‘ Vulnerability: The regular expression in src/ansi.ts used 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_REGEX to match either \u0007 or \u001B\ as the sequence terminator by modifying \u0007 to (?:\\u0007|\\u001B\\\\).
βœ… Verification: Ran unit tests (specifically tests/ansi_security.test.ts), lint checks, and the full test suite via bun run test to verify the fix works and does not introduce regressions.


PR created automatically by Jules for task 12715310405102718263 started by @hongymagic

… (ST) in OSC regex

Co-authored-by: hongymagic <302730+hongymagic@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 31, 2026 13:13
@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ 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 @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_REGEX in src/ansi.ts to match either \u0007 or \u001B\ as the OSC terminator.
  • Add a corresponding entry to .jules/sentinel.md documenting 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants