Skip to content

fix(security): bump sharp to 0.35.4 and require Node >=22 - #426

Open
SavioBS629 wants to merge 1 commit into
browserstack:mainfrom
SavioBS629:security/sharp-bump-node22
Open

SavioBS629 wants to merge 1 commit into
browserstack:mainfrom
SavioBS629:security/sharp-bump-node22

Conversation

@SavioBS629

Copy link
Copy Markdown
Collaborator

What

Bump sharp ^0.34.5^0.35.4 to clear the inherited libvips/libheif advisories, and raise the supported Node floor to match.

Change From To
sharp 0.34.5 0.35.4 (refreshes bundled libvips/libheif)
engines.node >=18 >=22
README Node note >= 18.0 >= 22.0

Advisories fixed

npm audit confirms the sharp advisory is cleared.

Why Node >=22

sharp 0.35.4 requires Node ≥20.9.0. CI (22.x), the Docker image (NODE_VERSION=22), .nvmrc, and the recommended setup already run Node 22, so this only corrects the stale declared floor. Set to >=22 to match what we run/recommend (could be >=20.9.0 if we want to keep Node 20/21 consumers).

No application code changes

The only sharp call site — src/lib/utils.ts:

await sharp(buffer).png({ quality }).toBuffer();

is unchanged across 0.34 → 0.35.

Testing (Node 22)

  • npm audit → sharp advisory cleared
  • npm run lint, tsc --noEmit, vitest run → all pass (651/651)
  • Image smoke test: a >1 MB PNG run through maybeCompressBase64 compressed 7.7 MB → 2.6 MB via the new libvips — the native path works end-to-end.

⚠️ Behavior change / sign-off

BREAKING for external consumers: drops Node 18/19 support. Everything we run is already on 22, but this needs PM/security sign-off before merge since it narrows the published engines range.

🤖 Generated with Claude Code

sharp <=0.35.4-rc.0 inherits high-severity libvips/libheif advisories
(CVE-2026-33327/33328/35590/35591 and GHSA-g89c-p67h-r497 /
GHSA-2jg2-4ch7-h545). The fix ships in sharp 0.35.4, which is a semver
major and requires Node >=20.9.0.

- Bump sharp ^0.34.5 -> ^0.35.4 (refreshes the bundled libvips/libheif).
- Raise engines.node >=18 -> >=22 to match what CI, the Docker image, and
  the recommended setup already run, and to satisfy sharp's floor.
- README: update the "Node version >= 18.0" notes to >= 22.0.

No application code changes: the only sharp call site
(src/lib/utils.ts `sharp(buffer).png({ quality }).toBuffer()`) is
unchanged across 0.34 -> 0.35.

Verified on Node 22: npm audit clears the sharp advisory; lint,
typecheck, and the full test suite pass; and an end-to-end image smoke
test (a >1MB PNG through maybeCompressBase64) compresses correctly with
the new libvips.

BREAKING: drops support for Node 18/19 for consumers of the npm package.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Central YAML (base), Organization UI (inherited), Workspace UI (inherited)

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: b7d59681-7cc6-46a7-b5e4-55bbd113cf1a

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Comment @coderabbitai help to get the list of available commands.

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