fix(storage-resize-images): bump sharp to ^0.35.3 - #2946
Conversation
sharp below 0.35.0 inherits four libvips CVEs (GHSA-f88m-g3jw-g9cj, rated high). The kit was created with the older range shortly after the extension had already moved to ^0.35.3.
There was a problem hiding this comment.
Code Review
This pull request renames the package to @firebase-function-kits/storage-resize-images, resets its version to 0.0.0, and upgrades the sharp dependency from ^0.34.5 to ^0.35.3. A critical issue was raised regarding the sharp upgrade, as version 0.35.x removes the default export in favor of named exports, which will cause compilation or runtime errors unless the imports in the codebase are updated.
… 0.35 sharp 0.35 removed the deprecated failOnError constructor property and ignores unknown keys, so the option became a no-op and failOn reverted to its default of failing on a libvips warning. Partially decodable images were resized best-effort before and would otherwise start failing.
|
A fresh-eyes review caught a regression this bump introduces, now fixed in
Reproduced with a truncated JPEG, passing the exact options the kit passes:
The fix is Worth noting separately: the extension carries the same dead |
What was broken: the
storage-resize-imageskit depends onsharp@^0.34.5. Everything below 0.35.0 inherits four libvips CVEs (CVE-2026-33327, -33328, -35590, -35591), reported by npm audit as GHSA-f88m-g3jw-g9cj and rated high. The extension already moved to^0.35.3; the kit was created a week later with the older range and has not been updated since.What changed: the dependency range and the lockfile. The lockfile diff is limited to
sharp, its@img/*platform packages and the bundled libvips binaries, plus two new optional wasm targets that ship with 0.35.x.Verification:
npm ciandnpm run buildare clean.resize()across four size formats andconvertType()across jpeg, png, webp, tiff, gif and avif, including theoutputOptionsandanimatedpaths, return identical dimensions and formats on 0.34.5 and 0.35.3; only the encoded byte counts for tiff and avif differ, as expected from a libvips bump. The full Storage upload path was not exercised.The one breaking change in the 0.35 line is the switch to named ESM exports. The kit already uses
import sharp from "sharp", so nothing needed changing.Follow-up, kept separate: the kit also carries
mkdirpanduuid, which the extension removed in favour of Node built-ins.