fix(deps): Drop unused image-size transitive dependency - #123886
Draft
oioki wants to merge 1 commit into
Draft
Conversation
image-size is pulled in only as an optional dependency of less, which requires it lazily to back the image-size(), image-width() and image-height() LESS functions. No .less file in the repo uses those functions, so the package is dead weight that only generates recurring Dependabot noise. Removing it via a pnpm override drops the resolution entirely on a clean install. Verified that static/less/sentry.less, the entrypoint used by rspack, still compiles to byte-identical CSS without it. Claude-Session: https://claude.ai/code/session_01CeiwiHwrev5Vap9j6csjxV
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.
Removes
image-sizefrom the dependency graph via a pnpm override, closing Dependabot alerts 682 (GHSA-5p2g-fcmc-qvqq) and 683 (GHSA-w3rx-r6r6-pgpr). Neither has an upstream fix — the advisories cap at<= 2.0.2with no patched version published.Why removal rather than an upgrade
image-sizereaches us only as an optional dependency ofless@4.3.0(pnpm whyshowslessas the sole path, directly and vialess-loader).lessrequires it lazily, from one call site, purely to implement theimage-size(),image-width()andimage-height()LESS functions:Nothing in the repo uses those functions — grepping all 38
.lessfiles understatic/less/returns zero hits. So there is no functionality to preserve and nothing to replace it with;lesssimply stops registering three functions we never call.Worth knowing: both alerts are false positives against the version we ship
We resolve
image-size@0.5.5, not 2.x. The advisories describe infinite loops in the ICNS, JXL and HEIF parsers, and 0.5.5 contains none of them. Itslib/types.jsenumerates the complete supported set —bmp, gif, jpg, png, psd, svg, tiff, webp, dds— andlib/types/holds exactly those nine files. ICNS support landed in 1.x, JXL/HEIF in 2.x. The onlywhileloops in 0.5.5 live injpg.jsandtiff.js, neither matching what the GHSAs describe. The alerts fire solely because the advisory range sweeps up every ancient version.Reachability was already nil on top of that: the code reads image files from disk at build time, never attacker-supplied buffers. Dependabot labels the scope
runtimeonly becauselesssits independenciesrather thandevDependencies; it is a build-time CSS compiler.Dismissing both as not-applicable would have been defensible. Removing the package is cheap and permanently forecloses this and any future
image-sizeadvisory, so it seemed the better trade.Verification
less+less-loaderwith the override present produces noimage-sizeanywhere innode_modules— this is what CI's--frozen-lockfileinstall does.static/less/sentry.less, the entrypoint referenced atrspack.config.ts:288, compiles to byte-identical CSS with and without the package (112,728 bytes both ways).less@4.3.0'soptionalDependencies. No other package in the graph moved.Note for reviewers
The tradeoff of
"image-size": "-"is that if someone later writesimage-size()in a.lessfile, the build fails with a module-not-found rather than working. Given we are on emotion/CSS-in-JS for anything new and these 38 files are legacy bootstrap, that felt acceptable — and CI would surface it immediately rather than silently.Moving
less/less-loadertodevDependencieswas considered and rejected: it would reclassify the alert scope but not clear the alerts.https://claude.ai/code/session_01CeiwiHwrev5Vap9j6csjxV