Skip to content

fix(#338): upgrade bundled underscore to 1.13.8 - #339

Merged
cesutherland merged 1 commit into
mainfrom
cesutherland/338-fix-underscore-vuln
Oct 12, 2026
Merged

cesutherland merged 1 commit into
mainfrom
cesutherland/338-fix-underscore-vuln

Conversation

@cesutherland

Copy link
Copy Markdown
Member

Closes #338.

Upgrades the bundled Underscore from 1.1.7 to 1.13.8, which fixes CVE-2026-27601 (stack overflow from unbounded recursion in _.flatten / _.isEqual).

Risk to Flotr2 itself: Flotr2 never calls flatten or isEqual. The exposure is to host pages that use the global _ the full build sets. Every Underscore function Flotr2 uses (22 of them, including the include/any aliases) still exists in 1.13.8.

Changes

  • lib/underscore.js: the 1.13.8 UMD build (dangling sourceMappingURL removed).
  • lib/underscore-min.js: generated by our smoosh build, not taken from upstream. Upstream's min file has an unquoted default: key, which is a syntax error in IE8. Smoosh keeps it quoted.
  • Makefile: wraps the bundled Underscore in (function (define) {…})();. The 1.13 UMD header calls define('underscore', …) and skips the global when define.amd exists. 1.1.7 ignored AMD and always set window._, so without the wrapper this would change behaviour and add a named module that could collide with the host's own underscore.

Not included

Testing

  • make test: 52/52 Playwright tests pass, no snapshot diffs.
  • In a Node VM with define.amd stubbed, the built flotr2.js and flotr2.min.js set window._.VERSION === '1.13.8' and don't register an underscore module.
  • Not tested in IE8. There's no ES6 syntax, and the only reserved-word key is quoted.

🤖 Generated with Claude Code

Fixes CVE-2026-27601 (unbounded recursion in _.flatten / _.isEqual).

1.13's UMD header registers a named AMD module and skips the global
when define.amd is present. The bundled builds now wrap underscore in
(function (define) {...})() so it always sets window._ like 1.1.7 did.

lib/underscore-min.js is built by smoosh rather than taken from
upstream, whose min file uses an unquoted `default:` key (IE8 syntax
error).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@cesutherland
cesutherland force-pushed the cesutherland/338-fix-underscore-vuln branch from 01a21ac to ac94f8e Compare October 12, 2026 14:59
@cesutherland
cesutherland merged commit 44a780e into main Oct 12, 2026
1 check passed
@cesutherland
cesutherland deleted the cesutherland/338-fix-underscore-vuln branch October 12, 2026 15:08
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.

Bundled Underscore.js 1.1.7 is vulnerable to CVE-2026-27601 (DoS via unbounded recursion)

1 participant