Repository navigation
Description
Problem and impact
The terminal limits its screen to 2,000 lines but does not bound bytes per line or total retained bytes. Repeated output without a newline is appended to the same line indefinitely. Container output can therefore consume increasing browser memory and rendering work, eventually freezing or exhausting the operator's tab.
Priority: P2, from the 2026-11-25 security audit. Affected change: #468, initially audited at 4115dce4ca381a6bd3aa375282461bca58aa0173; the terminal-view.ts implementation is unchanged at pre-publication head 54bca96e6224254fb57c599b8e63ddf7c168dd0b. Related feature: #232.
This affects an authorized user viewing a container's terminal output. No XSS, server-side memory exhaustion or permission bypass was demonstrated.
Evidence
appendOutput concatenates into the last line and then limits only the number of lines with slice(-MAX_TERMINAL_LINES).
A bounded local probe used the real function with 32 KiB output fragments and no newline:
| Fragments | Retained lines | Retained text bytes |
|---|---|---|
| 32 | 1 | 1,048,576 |
| 256 | 1 | 8,388,608 |
| 1,024 | 1 | 33,554,432 |
The probe stopped at 32 MiB; it did not intentionally exhaust a browser. ANSI/control-character stripping does not bound an ordinary printable line.
Proposed correction
Bound both per-line and total retained text, show a truncation indicator and bound rendering work per update. Preserve normal streaming behavior and handle multibyte text safely. Decide whether to retain the newest tail or another documented portion of a long line.
Acceptance criteria
- Continuous output without line breaks cannot grow the retained screen beyond the documented byte budget.
- Many short lines are also bounded by both count and total bytes.
- A regression test streams bounded chunks across several updates and verifies stable retention after reaching the limit.
- Normal output, ANSI/control stripping, multibyte characters and truncation indication remain correct.
- A disposable browser check confirms the UI stays responsive under sustained output.
Activity
fix(web): terminal output is bounded per line and in all (closes #477)
samuelmbabhazi commentedon Nov 25, 2026
Fixed in #468 (986a52d), before that PR merges:
appendOutputkeeps a line's first 4096 characters, marks it truncated (shown as…), never cuts a character in two, and drops the rest up to its newline. The screen keeps at most 2000 lines and 1 Mi characters, newest first. Tests reproduce the audit's probe, 32 KiB chunks without a newline: 64 of them (2 MiB) leave one 4096-character line. They also cover 1000 long lines, which stay within the character budget, and an emoji at the cut.