fix(security): address security review findings - #10
Open
Chris-Moller wants to merge 13 commits into
Open
Conversation
Chris-Moller
commented
Mar 19, 2026
Contributor
- scrollback buffer uses unbounded memory — cap at configured limit. 2. getScrollbackLines() returns a mutable reference to the internal array.
1. Cap scrollbackLines to MAX_SCROLLBACK (10000) to prevent unbounded memory growth 2. Return shallow copies of cells and scrollback arrays from getState() to prevent external mutation of internal terminal state Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… leaks The previous fix used row.slice() which only shallow-copies the array, leaving cell objects as shared references. External code could still mutate internal terminal state through the returned cells. Now uses deep copy that clones both cell chars and attr objects. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… nested attr colors
- scrollbackLines is now a getter/setter that enforces MAX_SCROLLBACK cap,
preventing bypass via direct property assignment after construction
- All attr copies now use deepCopyAttr() which properly clones nested
fg/bg color objects ({type:'256',value} and {type:'rgb',r,g,b}),
closing the remaining mutable reference leak
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… resize - Add getScrollbackLines() method that returns a deep-copied scrollback array - Enforce scrollback cap in resize() to prevent unbounded growth - Trim scrollback in scrollbackLines setter when cap is reduced Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.