test: guard against ejs regressing below ^6.0.1 (DII-2600) - #316
Open
manisha1997 wants to merge 1 commit into
Open
test: guard against ejs regressing below ^6.0.1 (DII-2600)#316manisha1997 wants to merge 1 commit into
manisha1997 wants to merge 1 commit into
Conversation
ejs is not a direct dependency: it arrives through @oclif/core, whose 1.x and 2.x lines still declare `ejs: ^3.x`. The 6.0.1 floor is held only by the `overrides` block in package.json, which a dependency bump, lockfile regeneration or merge can drop silently — reintroducing CVE-2023-29827. Add .github/scripts/verify-ejs-override.js, which asserts the floor from three independent angles: the overrides declaration in package.json, every resolved ejs entry in package-lock.json, and every ejs copy actually installed under node_modules (which catches a nested 3.x copy that a lockfile check alone would miss). Wire it into unit tests, the audit check, and the release workflow. The package.json and lockfile checks need no install, so it runs as a fail-fast step in the lockfile-hygiene job before anything else. Co-Authored-By: Claude Opus 5 <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.
DII-2600
Regression guard for the
ejs@^6.0.1override added in #315. Split out of that PR so the CVEfix and the new CI check can be reviewed separately.
Why
ejsis not a direct dependency. It arrives through@oclif/core, whose 1.x and 2.x lines stilldeclare
ejs: ^3.x. The 6.0.1 floor is held only by theoverridesblock inpackage.json,which a dependency bump, a lockfile regeneration, or a merge can drop silently — quietly
reintroducing CVE-2023-29827.
Nothing upstream of the repo catches that:
npm pack ejs@3.1.10still succeeds through ourinternal registry, so curation would not block a regression either. (That also answers the open
question in the
Curation probe (ejs)step added in #315:ejs@6.0.1is fetchable, and3.1.10still is too — so that informational probe can be retired in favour of this guard.)
What
.github/scripts/verify-ejs-override.jsasserts the floor from three independent angles:package.json— theoverrides.ejsdeclaration exists and holds the floorpackage-lock.json— every resolvedejsentry satisfies the floornode_modules— everyejscopy actually installed satisfies the floorChecks 1 and 2 need no install, so the guard runs before
npm cias a fail-fast step in thelockfile-hygienejob. Check 3 catches a nested 3.x copy that a lockfile check alone would miss.Zero dependencies, so it cannot itself be broken by a dependency change.
Wired into unit tests (pre- and post-install), the audit check, and the release workflow.
Test report
Verified it passes on a healthy tree and actually fails on four seeded regressions:
overrides.ejsdeleted + lockfile back to 3.1.10^3.1.10@oclif/core/node_modules/ejs@3.1.10on diskFailure output names the advisory, gives remediation steps, and emits a GitHub Actions
::errorannotation.
Also confirmed on this branch:
npm ls ejs→ single dedupedejs@6.0.1, 205 tests passing,lint clean,
npm audit --audit-level=moderate --production→ 0 vulnerabilities.Checklist
🤖 Generated with Claude Code