Fix ejs and cipher-base CVEs; remove unused browserify/babelify - #759
Merged
Conversation
… deps Bot PRs #755 and #754 each added ejs/cipher-base as new direct dependencies to force a version bump, but #755's approach didn't even work: it only bumped the hoisted top-level ejs copy, leaving the actually-flagged nested copy at @codedungeon/utils/node_modules/ejs stuck on 2.6.1. Neither package is required anywhere in our own code; both are transitive deps of dev tooling (ejs via @codedungeon/gunner's CLI helpers, cipher-base via browserify's crypto-browserify polyfill chain) - not the vendored EJS engine np.Templating actually uses. Using "overrides" forces every copy in the tree to the patched version without adding unused top-level dependencies. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Jul 30, 2026
browserify was leftover from a 2023 React-webview experiment (dwertheimer.React) and is no longer invoked anywhere - the project now bundles via scripts/rollup.js. babelify is a browserify-only Babel transform, so it's dead weight without browserify too. Removing them drops the crypto-browserify -> create-hash/create-hmac -> cipher-base chain from the tree entirely, so the cipher-base override from #754 is no longer needed - the package isn't installed at all now, not just pinned to a patched version. Verified: np.Templating test suite (65 suites, 1270 tests), npc CLI, and scripts/rollup.js all still work with these removed. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
7 tasks
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.
Summary
Replaces bot PRs #755 and #754, which added
ejsandcipher-baseas new direct dependencies to force a version bump. Neither package is actually used anywhere in our own source — both are transitive dependencies of dev tooling:ejs— pulled in by@codedungeon/gunner→@codedungeon/utils(ournpcCLI tooling)cipher-base— pulled in bybrowserify→crypto-browserify→create-hash/create-hmacWorse, #755's fix didn't even work: adding
ejs: ^3.1.7as a direct dependency only bumped the top-level hoisted copy. The actually-flagged nested copy at@codedungeon/utils/node_modules/ejs@2.6.1was left untouched because npm couldn't dedupe across that package's pinned range.What ejs is actually used for
Our real EJS template engine, used by np.Templating, is a hand-vendored/browserified bundle at
np.Templating/lib/support/ejs.js(embeds version 3.1.6) — completely separate fromnode_modules/ejs, and untouched by either bot PR. Nothing in our own code ever doesrequire('ejs').The npm
ejspackage only enters the tree via@codedungeon/gunner's dependency@codedungeon/utils, which exposes a genericutils.render(template, data)helper wrappingejs.render(). Gunner's own template scaffolding (template.js,template-eta.js) actually usesMustacheandeta, not ejs — and neither gunner nor any of our own CLI code ever callsutils.render(). So theejscode path is fully dead in our dependency tree; it just can't be deleted outright because@codedungeon/utils's module does an unconditionalrequire('ejs')at load time; removing the package would breakrequire('@codedungeon/gunner')itself. Anoverridesentry patches the version everywhere without needing to touch that.CVE-2022-29078 also requires
outputFunctionNameto be set from user input when callingejs.render()— we never set that option anywhere, so it wasn't reachable through our actual usage regardless of version.Do we need gunner?
Yes — it's not a peripheral dependency, it's the framework running the whole
npc/noteplan-clitool.index.jsbuilds the CLI off gunner'sCLIclass, and every command module (PluginCreate,PluginDevelop,PluginTest,PluginRelease,PluginPullRequest, plus theirsupport/helpers — 18 files total) pullscolors,helpers,print,path,filesystem,system,strings, and interactive prompts straight from gunner's toolbox. Dropping it would mean rewriting the dev CLI's arg parsing, prompts, and colored output from scratch.browserify/babelify — actually removed
Unlike
ejs,browserifyhad no reason to still be here at all: it's not required by any other package in the tree (an orphaned root dependency), not invoked by any of our scripts (scripts/rollup.jshandles all bundling now), and not referenced anywhere in our own code.git log -S'"browserify"' package.jsontraces it back to a 2023 React-in-webview experiment (dwertheimer.React) that predates the project's move to Rollup.babelifyis a browserify-only Babel transform, so it was dead weight withoutbrowserifytoo.Removed both outright. This drops the
crypto-browserify→create-hash/create-hmac→cipher-basechain from the tree entirely — so thecipher-baseoverride is no longer needed either; the package isn't installed at all now, not just pinned to a patched version.Fix
overridesblock topackage.json:ejsin the tree to a patched version (resolves to 3.1.10) without adding an unused package to our direct dependency list.browserifyandbabelifyfromdependenciesentirely, which also removescipher-basefrom the tree (no override needed for it anymore).Verification
npm install --legacy-peer-depsresolves cleanly (matches CI's install flags)ejspost-install (3.1.10), no leftover nested vulnerable copiesbrowserify,babelify,crypto-browserify, andcipher-baseare fully absent frompackage-lock.jsonafter removalnp.Templatingtest suite passes (65 suites, 1270 tests)npcCLI (the actual consumer of theejs/@codedungeonchain) still runsscripts/rollup.js(the project's actual bundler) still runs🤖 Generated with Claude Code