fix(deps): bump sails-postgresql, sails-hook-sockets and lodash to clear CVEs - #1374
Open
itsalaidbacklife wants to merge 2 commits into
Open
fix(deps): bump sails-postgresql, sails-hook-sockets and lodash to clear CVEs#1374itsalaidbacklife wants to merge 2 commits into
itsalaidbacklife wants to merge 2 commits into
Conversation
…ear CVEs Replaces PRs #1367 (minimist / CVE-2021-44906) and #1368 (lodash / CVE-2019-10744), both of which added `overrides` entries instead of moving the top-level dependency that pulls the old package in. #1367's override downgraded five of six minimist consumers from 1.2.8 to 1.2.6, and #1368's landed on lodash 3.10.1 — still inside the CVE's `<4.17.12` range, and the first version to actually ship the `defaultsDeep` sink that 2.4.2 lacked. - sails-postgresql 4.0.0 -> 5.0.1 Resolves machinepack-postgresql 4.0.2 -> waterline-sql-builder 3.0.1 -> knex 2.4.2, which has no minimist dependency at all (it uses getopts), so the vulnerable minimist 1.1.3 leaves the tree rather than being pinned around. Also clears knex SQL injection, waterline-sql-builder, machinepack-postgresql, pg (8.3.0 -> 8.11.0) and debug advisories, and drops the babel-runtime -> core-js@2.6.12 install-script chain. - sails-hook-sockets 1.5.5 -> 2.0.4 Pulls machinepack-urls 6.0.2-0, which drops plain lodash for @sailshq/lodash, removing the lodash 2.4.2 copy #1368 targeted. Also clears async, semver, machinepack-redis, redis, socket.io (2.0.3 -> 2.5.0) and engine.io advisories. Deliberately not 3.0.2: that moves socket.io to 4.8.1, a breaking wire-protocol change, and neither sails.io.js (no commit since 2018) nor sails-hook-sockets 3.x test against a v4 client. - lodash 4.17.21 -> 4.18.1 Clears the three advisories still matching 4.17.21, including the _.unset/_.omit prototype pollution relevant to _.omit use in api/helpers/game-states/ai/get-legal-moves.js. Net: 6 plain-lodash copies -> 3, vulnerable minimist gone, 100 packages removed from the tree. Co-Authored-By: Claude Opus 5 (1M context) <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.
Summary
Replaces #1367 (minimist / CVE-2021-44906) and #1368 (lodash / CVE-2019-10744) by bumping the top-level dependencies that pull the vulnerable packages in, instead of adding
overridesentries.Three version bumps in
package.json;package-lock.jsonregenerated withnpm install. Net effect: 100 packages removed from the tree, vulnerableminimistgone entirely, plain-lodashcopies down from 6 to 3.Why not #1367 / #1368
Both PRs added a root
overridesentry rather than moving the dependency that owns the old package.#1367 — only one of six
minimistconsumers was vulnerable (knex@0.12.7→minimist@1.1.3); the other five were already on 1.2.8."overrides": { "minimist": "1.2.6" }upgraded one and downgraded five, includingcypress, which explicitly declares^1.2.8. Its lockfile also wasn't npm-generated — it deleted the hoistedminimist@1.2.8and added five nested 1.2.6 duplicates, where an exact pin would hoist a single copy.#1368 — despite the title, it never touched lodash; it overrode
machinepack-urlsto 6.0.1, moving that package's nested lodash 2.4.2 → 3.10.1. CVE-2019-10744 covers<4.17.12, so 3.10.1 is still vulnerable. Worse,_.defaultsDeep— the CVE's actual sink — does not exist in lodash 2.4.2 (added in 3.10.0), so the change introduced the vulnerable function, and moved the copy into an advisory range it had been below (Prototype Pollution in lodash,>=3.7.0 <4.17.19).Changes
sails-postgresql4.0.0 → 5.0.1Resolves
machinepack-postgresql@4.0.2→waterline-sql-builder@3.0.1→knex@2.4.2. knex 2.4.2 has nominimistdependency at all (it usesgetopts), so the vulnerable copy leaves the tree rather than being pinned around.minimistcritical (prototype pollution, <1.2.6)knexcritical (SQLi <0.19.5; limited SQLi <2.4.0)waterline-sql-buildercritical (≤2.0.0)machinepack-postgresqlcritical (≤4.0.1)pghigh (4.0.0-beta2 - 8.3.3)debughigh (ReDoS <2.6.9)sails-postgresqlhigh (viaasync)Also drops the
babel-runtime→core-js@2.6.12install-script chain that only knex 0.12.7 pulled in.The
semVerMajorflag overstates the adapter risk: releases 5.0.0 and 5.0.1 each touch onlypackage.jsonand.travis.yml— zero adapter source changes across 4.0.0 → 5.0.1. The substantive change iswaterline-sql-builder2.0.0 → 3.0.1, i.e. knex 0.12.7 → 2.4.2, so generated SQL is what needs exercising.sails-hook-sockets1.5.5 → 2.0.4machinepack-urls@3.1.1(the source of #1368's lodash 2.4.2) came from here. 2.0.0's release notes are explicit: "Upgraded machinepack-urls to resolve vulnerability/deprecation warnings." 2.0.4 pullsmachinepack-urls@6.0.2-0, which drops plainlodashfor@sailshq/lodash.lodash2.4.2 copy (4 matching advisories)asynchigh (prototype pollution)semverhigh (ReDoS <5.7.2)machinepack-redishigh (≤2.0.6)redishigh (monitor-mode regex)socket.io(CORS <2.4.0; unhandlederror<2.5.0)engine.io(→ dropped from high to low)machine/rttc/include-all/switchback/machinepack-urlsDeliberately 2.0.4, not 3.0.2.
npm auditrecommends 3.0.2 because it defaults to latest, but 3.x movessocket.io2.5.0 → 4.8.1 — a breaking wire-protocol change (EIO 3 → EIO 4, with EIO3 compat off by default). Our client issrc/plugins/sails.js:14,sails(socketIoClient)oversails.io.js@1.2.1+socket.io-client@2.3.0, and upstream validates neither:sails.io.jshas had no commit since April 2018 and pinssocket.io-client: 2.0.3in devDeps, andsails-hook-sockets@3.0.2also still pinssocket.io-client: 2.0.3despite shipping socket.io 4. That migration is a separate spike. 2.0.4 keeps socket.io on 2.x, wire-compatible with our pinned client.lodash4.17.21 → 4.18.1Our direct pin was behind. Clears the three advisories still matching 4.17.21:
_.templatecode injection via imports key names — high,>=4.0.0 <=4.17.23_.unset/_.omitprototype pollution via array path bypass — moderate,<=4.17.23_.unset/_.omitprototype pollution — moderate,>=4.0.0 <=4.17.22The
_.omitones are directly relevant:api/helpers/game-states/ai/get-legal-moves.js:28calls_.omit(MoveType, disallowedMoveTypes)via theconfig/globals.js:20global.Since lodash resumed publishing after a five-year gap, provenance was checked: 4.17.23 (2026-01-21), 4.18.0 (2026-03-31), 4.18.1 (2026-04-01), all published by
jdalton, maintainersjdalton/mathias/bnjmnt4n, repogithub.com/lodash/lodash, registry signature present.Verification
npm install— clean; 16 added, 100 removed, 51 changednpm ls minimist— knex subtree gone; lowest version now 1.2.6 (sails' own exact pin)npm ls lodash— root at 4.18.1; the 2.4.2 copy gonenpm audit—minimist,knex,waterline-sql-builder,machinepack-postgresql,pg,machinepack-urls,include-all,switchback,machinepack-redis,redis,sails-postgresqlall cleared;engine.ioandsails-hook-socketsdropped high → lownpm run lint— cleannpm run test:unit:client— 3/3 passingnpm run test:unit:sails— not run locally (port 1337 was occupied on my machine;tests/unit/util/server.util.js:10hardcodes it). Needs CI to confirm the 83 sails tests.What still needs a manual pass before merge
Dev and unit tests use
sails-disk, so the Postgres adapter isn't covered at all. Suggest runningnpm run docker:start(postgres:17,NODE_ENV=staging) +npm run e2e:serverand checking:migrate: 'safe'+schema: truestill match the existing schema.reconnectSockets,io.sails.transports = ['websocket']) and each server-pushed event the client subscribes to —game,gameCreated,gameStarted,gameFinished,join,leftGame,setIsRanked. Also verifyonlyAllowOriginsstill rejects a disallowed origin under 2.5.0's stricter CORS handling.Known residual (not addressed here)
Two plain
lodash@3.10.1copies remain, viamachinepack-passwords@2.3.0→machine@10.4.0(and itsrttc@7.4.0).npm auditreportsfixAvailable: false— 2.3.0 is the latest stable, and itsmachine: ^10.3.1pin holds it there. The only escape is themachinepack-passwords@3.0.0-0prerelease, which swapsbcrypt-nodejsforbcryptjs; changing the password-hashing library is well out of scope for a dependency-security PR and would need its own hash-compatibility review.Remaining
npm auditfindings otherwise sit in dev-only trees (storybook 7.6.0, handlebars, cypress) and thesailscore tree (@sailshq/nedb,underscore,path-to-regexp).🤖 Generated with Claude Code