Repository navigation
fix: enforce NEW-ENVIRON variable limit across frames to prevent memory exhaustion - #2415
Conversation
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
gnodet-bot
left a comment
There was a problem hiding this comment.
The multi-frame bypass is real and the fix is correct — verified: multiFrameBypassIsBlocked fails without the persistent-map size check (200 entries vs the expected 100 cap), passes with the fix applied. The guard handles all three cases correctly.
One low-severity nit: the test mirrors NE_VAR_COUNT_MAX = 100 as a local constant (line 92) rather than referencing TelnetIO.NE_VAR_COUNT_MAX directly. Since the test is in the same package (org.jline.builtins.telnet), it can reference the protected static final production constant, eliminating the risk of silent divergence if the value is ever changed.
Backport needed: jline-3.x has the original CVE-2026-56740 per-frame guard but NOT this cross-frame bypass fix. This security fix should be cherry-picked to jline-3.x.
This review was generated by an AI agent, Hermès on behalf of @gnodet.
| buf.write(IAC); | ||
| buf.write(SE); | ||
| return buf.toByteArray(); | ||
| } |
There was a problem hiding this comment.
🔧 Nit: TelnetIO.NE_VAR_COUNT_MAX is protected static final in the same package — the test can reference it directly instead of duplicating the value. If the production constant is ever changed, this copy will silently diverge.
| } | |
| private static final int NE_VAR_COUNT_MAX = TelnetIO.NE_VAR_COUNT_MAX; |



Summary
Fixes GHSA-7qh2-r6cc-r47w — Uncontrolled Resource Consumption in
org.jline:jline-remote-telnet.CVE-2026-56740 introduced a per-frame
varCountcounter capped atNE_VAR_COUNT_MAX(100) inTelnetIO.readNEVariables(). However, the counter reset to 0 on every subnegotiation call, so an attacker could send N frames × 100 variables each and accumulate N×100 entries in the persistent environment map — a complete bypass of the original fix.Fix
Add a persistent-map size check in addition to the per-frame counter: reject new variable names when
env.size() >= NE_VAR_COUNT_MAXand the name is not already present in the map. Updates to existing variable names are still allowed (so a client can legitimately correct a previously-sent value).Tests
Four regression tests in
TelnetIONewEnvLimitTest:NE_VAR_COUNT_MAXentriesSummary by CodeRabbit