Track and triage CodeQL dependency vulnerabilities (2) - #126
Merged
Conversation
…atch Closes the two remaining high-severity image-size DoS advisories (GHSA-w3rx-r6r6-pgpr, GHSA-5p2g-fcmc-qvqq) by removing the dependency's usage entirely rather than working around it - no upstream fix exists for 2.0.2. - Replaced the 5 imageSize(buffer) call sites (postUploadImage v2 controller, and the grayscale/flip/negate/remove-background job handlers) with sharp(buffer).metadata(), which is already a direct dependency and already used by 3 of these same files for the actual pixel transform. This also moves dimension reading off the synchronous main-thread parse path onto sharp's libuv thread pool, and incidentally fixes a latent unhandled-promise-rejection in postUploadImage.ts where the dimensions call ran before the try/catch and before the file-existence check. - Removed image-size from code/package.json. - Bumped the exact-pinned @mastra/memory 1.19.0 -> 1.28.2: this project's live conversation-memory backend (wired up in connectors.ts) turned out to carry its own transitive image-size dependency with the same synchronous imageSize(buffer) call on AI chat image attachments - a reachable path the 5 direct call sites above didn't cover. 1.28.2 drops image-size in favour of the already timeout-guarded probe-image-size. - Bumped the exact-pinned @mastra/core 1.36.0 -> 1.64.0: required by the @mastra/memory bump above, which imports MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH from @mastra/core/storage - an export that only exists from @mastra/core@1.63.1 onwards. The old 1.36.0 pin satisfied @mastra/memory's peer range (>=1.4.1-0 <2.0.0-0) semver-wise but not its actual runtime API surface, which surfaced as a hard crash on `npm run start` (SyntaxError: the requested module does not provide an export named 'MAX_KNOWLEDGE_NODE_DESCRIPTION_LENGTH'). Verified all ~40 named imports @mastra/memory@1.28.2 pulls from every @mastra/core/* subpath it uses are present at 1.64.0, not just the one that happened to surface first. Bonus: this also resolves a pre-existing peer conflict (mastra@1.27.3 requires @mastra/core >=1.50.0, which 1.36.0 already violated) and pulls a fixed @ai-sdk/provider-utils chain, closing the one remaining tracked-as-accepted-risk alert. - Verified image-size has zero occurrences left in the lockfile by exact package name, and npm audit now reports 0 vulnerabilities. Also added limits.fileSize (100mb) to both multer() instances (v1 and v2 routers), which previously accepted uploads of unbounded size. Scoped to size only, not mimetype, since both instances are shared by image *and* video upload routes. Verified via a full clean `npm run verify` (matching the CI/Dockerfile install path), lint, build, and an actual `npm run start` reaching "Server started" with /v1/liveness and /v1/readiness both returning 200 OK. Signed-off-by: Jesus Manuel Piñeiro Cid <jesusmpc@inditex.com>
jesusmpc
marked this pull request as ready for review
September 7, 2026 12:26
|
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.



Closes #125