Repository navigation
fix: upgrade mongoose 4.2.4 -> 5.13.23 (SNYK-JS-MONGOOSE-1086688, Schema.path prototype pollution) - #1124
Conversation
Schema.path() in mongoose < 5.12.2 lets '__proto__.x' paths write to Object.prototype. 5.13.23 rejects __proto__/constructor paths. Adds a node:test regression test. Refs: sfind-2c497ed0c7444d23b3be80bd9f9e4508
|
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.
|
|
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
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)
Summary
Fixes code-scan finding
sfind-2c497ed0c7444d23b3be80bd9f9e4508: SNYK-JS-MONGOOSE-1086688, prototype pollution throughSchema.path()(CWE-1321, high).mongoose4.2.4 -> 5.13.23 (exact pin), the latest 5.x release; the fix landed in 5.12.2. The lockfile now resolvesmongodb3.7.4 andmquery3.2.5. No app code changes:mongoose.connect(uri), the callback-stylefind/findById/save/removeinmongoose-db.jsandroutes/index.jsall still work on 5.x.tests/mongoose-schema-prototype-pollution.test.js(node --test, no new dependencies).Verification (Node 22.12, local mongod 7.0, MySQL 5.7 container for the TypeORM side)
node --test tests/mongoose-schema-prototype-pollution.test.jsnpm start, thenGET /mongoose-db.js:50users.lengthof undefined: the 4.2 driver can't talk to mongod 7)POST /createtodo, then it appears on/POST /login/[REDACTED SECRET]New startup warnings on 5.x: the driver's
useNewUrlParser/useUnifiedTopologydeprecation notices. They're harmless and I left them alone to keep this change small.Notes
sfind-5e2c6296). Only one should land. Other open mongoose bumps that overlap: bug: upgrade mongoose to 5.13.15 (SNYK-JS-MONGOOSE-2961688, CVE-2022-2564) #948, Fix SNYK-JS-MONGODB-473855: bump mongoose 4.2.4 -> 5.13.15 (mongodb DoS) #789, Fix SNYK-JS-MQUERY-1089718: bump mongoose 4.2.4 -> 5.13.15 (mquery 1.6.3 -> 3.2.5) #771, Fix SNYK-JS-MQUERY-1050858: upgrade mongoose 4.2.4 -> 5.13.15 (mquery 1.6.3 -> 3.2.5) #751 (5.13.15), and Fix SNYK-JS-MONGOOSE-8623536: upgrade mongoose 4.2.4 -> 6.13.6 #754, Fix SNYK-JS-MONGOOSE-16425765: upgrade mongoose 4.2.4 -> 6.13.9 #969 (6.x).npm testrunssnyk test, which needs a Snyk token, so I didn't run it.Devin-Org: engineering
Link to Devin session: https://devin-gtm.devinenterprise.com/sessions/2f9ad392521446b188e35f9fffc583dc
Open in Devin Desktop: https://devin-gtm.devinenterprise.com/desktop/session/2f9ad392521446b188e35f9fffc583dc?variant=devin
Devin Review