Repository navigation
bug: upgrade ejs 1.0.0 -> 3.1.10 and drop ejs-locals (SNYK-JS-EJS-1049328) - #1125
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
…9328)
ejs-locals 1.0.2 rendered every view with its own nested ejs 0.8.8, so
bumping the top-level ejs alone would leave the vulnerable engine in use.
Replace it with a small layout('name') engine on ejs 3.1.10 that passes
compile options separately so render data can never set them.
Refs: sfind-0ff88c9aee6242a8adb9ef4b29266cd3
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Author
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
Author
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
Fixes finding
sfind-0ff88c9a/ SNYK-JS-EJS-1049328 (high, CWE-94):ejs@1.0.0inpackage.json:24.Bumping
ejsby itself would not fix this. The EJS views are rendered throughejs-locals@1.0.2(app.js:14), and that package brings its own nestedejs@0.8.8(node_modules/ejs-locals/node_modules/ejs), so the top-level version was never the one doing the rendering. This PR:package.json/ lock:ejs1.0.0 → 3.1.10, and removesejs-locals(and so the nested 0.8.8). The lockfile was regenerated by npm against the registry.ejs-engine.js(new): a small Express engine that supports the one ejs-locals feature the views use,<% layout('layout') %>. It renders the view, then renderslayout.ejswithbodyset to the view's output.app.jsnow usesrequire('./ejs-engine').clientand other options from the data, and it copiessettings['view options']into the compile options as-is.tests/ejs-engine.test.js(node --test tests/ejs-engine.test.js, 3/3 pass). It covers: layout wrapping with the realviews/index.ejs,<%= %>escaping withviews/edit.ejs, and that render data withclient/escape/escapeFunction/outputFunctionName/settings['view options']cannot run code.Verification
Engine probe: render
views/index.ejsthrough the app's configured engine, with attacker-shaped render data:main(ejs-locals → ejs 0.8.8){client: true, escape: "<js>"}escapeFunction/outputFunctionNamesettings: {'view options': {client, escape}}renderFileform, which is why the 4-arg form is used)Real
app.js(with an in-memory Mongo stand-in, because the VM's mongod 7 doesn't work with mongoose 4.2):GET /,/loginand/edit/:idreturn 200 on both branches. Each page has the same<title>, a single layout wrapper, no rawlayout(text, markdown rendered on/, and the todo HTML-escaped in the/editinput value.Not run:
npm test(Snyk CLI, needs auth) and the full stack with real MongoDB/MySQL.Devin-Org: engineering
Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/032754aeb3744161bd96ccbed63ce6bf
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/032754aeb3744161bd96ccbed63ce6bf?variant=devin
Devin Review