Skip to content

Update ws, mysql2 and minimatch past their new advisories - #248

Merged
Kkkermit merged 1 commit into
developfrom
testify/chore-47
Dec 1, 2026
Merged

Kkkermit merged 1 commit into
developfrom
testify/chore-47

Conversation

@Kkkermit

@Kkkermit Kkkermit commented Dec 1, 2026

Copy link
Copy Markdown
Owner

What this changes

Moves three production dependencies past advisories published on 1 December, which failed the nightly's Snyk scan and dependency audit on main:

Package Comes in through Advisory Change
mysql2 @shardlens/collector critical: SQL injection (SNYK-JS-MYSQL2-23188839) 3.24.6 → 3.25.0
ws discord.js (@discordjs/ws) and @discordjs/voice high: memory exhaustion through unbounded automatic pongs (GHSA-37g9-w4hg-h9qr) 8.21.1 → 8.23.1
minimatch (under glob) glob high: quadratic compile time (GHSA-cf2h-pxjq-68xw), and two Snyk findings fixed in 11.0.7 and 11.0.8 11.0.5 → 11.0.9

Two more lockfile entries change with them:

  • sql-escaper 1.9.1 → 1.10.0. mysql2 3.25.0 asks for ^1.10.0, and it is the only package that uses it.
  • named-placeholders is removed. mysql2 3.25.0 no longer uses it, and nothing else does.

Every package that brings these in already accepts the new versions, so no overrides pin was needed:

  • @shardlens/collector asks for mysql2 ^3.24.6.
  • @discordjs/ws and @discordjs/voice ask for ws ^8.17.0 and ^8.19.0.
  • glob asks for minimatch ^11.0.5.

The change is package-lock.json only.

Why

  • The nightly on main failed on Snyk (one critical and three high findings) and on the dependency audit (two high), all from these packages.
  • The exposure was low, though all three ship in the Docker image:
    • mysql2 only runs when the collector uses MySQL storage, and this bot's collector uses MongoDB.
    • ws is only ever a client to Discord, never a server.
    • minimatch only ever sees file patterns from the bot's own code.

How the new versions were checked

Each fix was published within the last three weeks, mysql2's two days ago, so each was read before it was taken:

  • Publisher: the same maintainer as the version it replaces.
    • mysql2, minimatch and sql-escaper carry npm build provenance from their own repositories: sidorares/node-mysql2, isaacs/minimatch at v11.0.9, and mysqljs/sql-escaper.
    • ws lists only lpinca as a maintainer now, where it used to list four people. He also published 8.21.1, and its whole diff was read for that reason.
  • No install-time script in any of them, and no new dependencies, except that mysql2 drops one.
  • Code diffs: none adds a network, file, process or eval call.
    • ws: the maxPendingAutoPongs limit (default 60), and Node's own http.websocketMask where Node has it.
    • minimatch: a bounded pattern cache, and caps on brace expansion and ** recursion.
    • mysql2 and sql-escaper: placeholder expansion moved inside them, plus a statement cache and TLS session handling.
  • The smallest step carrying the fix was preferred over the newest release. sql-escaper 1.10.2, published today, changes about ten times as many lines as 1.10.0.
  • Every tarball reviewed matches the registry's sha512, which is what the lockfile records.

The lockfile was edited directly rather than with npm update, because the local npm is older than the one that wrote it and would remove its libc fields. Parsing and re-serialising the lockfile reproduces it byte for byte, so the edit was made structurally.

How to verify

  • A clean npm ci installs the new versions, leaves the lockfile unchanged and no longer installs named-placeholders. npm ls --all reports no invalid, missing or extraneous packages.
  • npm run audit passes.
  • npm run check passes with 4,142 tests.
  • npm run build passes, dist/ has no unrewritten aliases, and the loader smoke test registers everything (53 buttons, 107 aliases, 4 menus), with ws and @shardlens/collector/mongodb loading.
  • The nightly workflow, run by hand on this branch, passes every job: Snyk, the dependency audit, and the tests on Windows, Linux and macOS. CI on the push is green.
  • Not verified: ws using Node's native masking. Local Node 22 lacks http.websocketMask, so it keeps its JavaScript masking here. The image's Node 24 takes the native path only if that release has it.
  • Still reported: the moderate minimatch advisory on the root copy (10.2.6, development-only, through eslint-plugin-import-x and Jest's coverage). Its only fix is minimatch 11, which those packages don't accept yet.

Checklist

  • The branch is cut from develop, and this pull request targets develop
  • npm run check passes
  • Tests cover the new logic (no code changed)
  • No read-modify-save() on numeric fields
  • Embeds come from the embed() factory
  • No raw console.*
  • Every promise is awaited
  • Timers are registered with the timer registry
  • New custom IDs use the codec and a unique namespace
  • New environment variables are in src/config/env.ts and scripts/setupEnv.ts
  • npm run docs:commands re-run if a command changed
  • Documentation updated if behaviour changed

Generated by Claude Code

@Kkkermit
Kkkermit merged commit 49b4ea3 into develop Dec 1, 2026
17 checks passed
@Kkkermit
Kkkermit deleted the testify/chore-47 branch December 1, 2026 22:22
This was referenced Dec 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant