Repository navigation
fix(security): Fix 12 security issues in next, sharp - #797
Open
aikido-autofix[bot] wants to merge 1 commit into
Open
aikido-autofix[bot] wants to merge 1 commit into
aikido-autofix[bot] wants to merge 1 commit into
Conversation
Collaborator
|
[BOT] Preview available with hash |
This branch has not been deployed
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.
Upgrade Next.js and Sharp to fix critical RCE vulnerabilities in image optimization (AVIF/libheif), memory corruption, and high-severity SSRF, DoS, and connection exhaustion issues.
✅ Code not affected by breaking changes.
✅ No breaking changes from either package upgrade affect this codebase.
Next.js (15.4.8 => 15.5.28):
No
next.config.jsfile exists in the demo-nextjs package, so configuration-related changes (experimental.dynamicIO,experimental.strictNextHead) don't applyNo usage of
useMDXComponents,unstable_rootParams, or AMP features foundNo synchronous usage of
cookies()orheaders()in server components (all components using Next.js APIs are client components marked with'use client')No usage of
window.next.versionorwindow.next.turbopackNo middleware files that would be affected by the node middleware stabilization
Sharp (0.34.5 => 0.35.5):
Sharp is only present as a transitive dependency of Next.js (in yarn.lock)
No direct imports or usage of sharp found in any source files
The Node.js version requirement change (>=18 to >=20.9.0) is not an issue since the codebase already requires Node.js >=18, and the upgrade to sharp 0.35.x is handled internally by Next.js
All components in the Next.js demo are either client components or use standard Next.js patterns that remain compatible with version 15.5.28.
All breaking changes by upgrading next from version 15.4.8 to 15.5.28 (CHANGELOG)
experimental.strictNextHead: #81882window.next.turbopackinstead: #82580All breaking changes by upgrading sharp from version 0.34.5 to 0.35.5 (CHANGELOG)
installscript frompackage.jsonfile. Compiling from source is now opt-in via thebuildscript.iqquality metrics.limitInputChannelswith a default value of 5.failOnErrorconstructor property.paletteBitDepthfrommetadataresponse.sharpenoperation.format.jp2kasformat.jp2for API consistency.✅ 12 CVEs resolved by this upgrade, including 2 critical 🚨 CVEs
This PR will resolve the following CVEs:
libheiflibrary used bysharpwhich Next.js uses for image optimization can lead to remote code execution when AVIF files are optimized.Until a fix has propagated, optimization of AVIF files is disabled.
DELETE/OPTIONSrequests allows attackers to bypass route restrictions and access unintended backend endpoints. An attacker could smuggle malicious requests to internal or admin routes through request boundary disagreement between proxy and backend.🤖 Remediation details
Fix critical and high-severity vulnerabilities in
nextandsharpShort summary
This PR remediates multiple critical, high, and medium-severity vulnerabilities in two packages:
next(the direct dependency) andsharp(a transitive optional dependency pulled in bynext). The fix updates the exact-pinnednextversion in both the rootpackage.jsonand thepackages/demo-nextjsworkspace member manifest, which in turn causesyarn.lockto resolvesharpto a patched version as well.next
nextwas pinned exactly at15.4.8in two places: the rootpackage.json(as adevDependency) andpackages/demo-nextjs/package.json(as adependency). Both declarations were bumped to15.5.28, the minimum version that satisfies every advisory's patched-version floor across all listed CVEs. Because both manifests used the same exact pin, both were updated together as a related package alignment in a single edit batch, followed by ayarn install --ignore-engines --ignore-scriptsto refreshyarn.lockand remove the stalenext@15.4.8lockfile entry.sharp
sharpis not declared directly in any manifest; it is an optional transitive dependency ofnext. Undernext@15.4.8, the lockfile resolvedsharpto0.34.5via the selectorsharp@^0.34.3. After bumpingnextto15.5.28, that release widens its optional dependency declaration to^0.34.3 || ^0.35.5, which allows Yarn to resolvesharpto0.35.5—the patched minimum. Noresolutionsoverride was required; the lockfile refresh after thenextbump was sufficient to pull in the fixedsharpversion and remove the stalesharp@^0.34.3@0.34.5entry.Version changes
next15.4.815.5.28package.jsondevDependency)next15.4.815.5.28packages/demo-nextjs)sharp0.34.50.35.5next)@next/env15.4.815.5.28next@next/swc-linux-x64-gnu15.4.815.5.28next@next/swc-linux-x64-musl15.4.815.5.28next@img/sharp-linux-x640.34.50.35.5sharp@img/sharp-linuxmusl-x640.34.50.35.5sharp@img/colour1.0.x1.1.0sharp@0.35.5