Repository navigation
fix(security): Fix 8 security issues in next, sharp - #795
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
✅ Security Analysis ResultsNo security issues found. 3 files reviewed.
|
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 in AVIF processing, SSRF via WebSocket requests, connection exhaustion DoS, and CPU exhaustion DoS in Server Components.
✅ Code not affected by breaking changes.
✅ No breaking changes from either package upgrade affect this codebase.
Next.js (15.4.8 => 15.5.24):
The codebase does not use any of the deprecated or changed features:
No
experimental.dynamicIOorexperimental.cacheComponentsconfiguration foundNo
useMDXComponentsusageNo
experimental.strictNextHeadconfigurationNo synchronous access to
cookies()orheaders()in server componentsNo
window.next.versionreferences (Turbopack change)No AMP configuration
No
unstable_rootParamsusageThe demo-nextjs package uses only basic Next.js features (pages router and app router with client components)
Sharp (0.34.5 => 0.35.5):
Sharp is installed as a transitive dependency through Next.js (visible in yarn.lock)
The codebase does not directly import or use sharp
Node.js version requirement is already
>=18in package.json, but sharp 0.35.0 requires>=20.9.0, which could cause issues if running on Node.js 18.xHowever, since sharp is only used internally by Next.js for image optimization and not directly by the application code, and there are no direct usages of deprecated sharp APIs (
failOnError,paletteBitDepth,sharpenproperties,format.jp2k), the upgrade should not break existing functionalityNote: While the sharp upgrade requires Node.js >= 20.9.0, this is a runtime environment requirement rather than a code-breaking change. The project's current
node: ">=18"engine specification should be updated to">=20.9.0"to align with sharp's requirements.All breaking changes by upgrading next from version 15.4.8 to 15.5.24 (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.✅ 8 CVEs resolved by this upgrade, including 1 critical 🚨 CVE
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 vulnerabilities in two packages:
next(seven advisories, ranging from medium to critical severity) andsharp(one high-severity advisory). The fix updates the exact-pinnednextversion in both the rootpackage.jsonand thepackages/demo-nextjsworkspace member manifest, which also causes the transitivesharpdependency to resolve to a patched version. Theyarn.locklockfile is refreshed accordingly, removing all stale resolution entries for both packages.next
nextwas pinned exactly at15.4.8in both the rootpackage.jsonand thepackages/demo-nextjsworkspacepackage.json. All seven advisories againstnextrequired a minimum of15.5.24to be fully resolved, so both manifests were updated to that version. Becausenextwas an exact pin (no caret or tilde), Yarn retained the oldnext@15.4.8lockfile entry until the workspace manifest was also updated; once both declarations pointed to15.5.24, the stale entry was removed and the lockfile converged to a single resolved instance at15.5.24.sharp
sharpis a transitive optional dependency pulled in bynext. Undernext@15.4.8, the declared range was^0.34.3, which resolved to0.34.5— a version vulnerable to GHSA-wq5f-xc86-pv6w. Bumpingnextto15.5.24widened its declared range forsharpto^0.34.3 || ^0.35.3, which allowed Yarn to resolvesharpto0.35.5(the patched version) without any direct manifest entry or override forsharpitself.Version changes
next15.4.8(rootpackage.json)15.5.24next15.4.8(packages/demo-nextjs/package.json)15.5.24sharp0.34.5(lockfile)0.35.5next)@next/env15.4.8(lockfile)15.5.24nextparent bump@next/swc-linux-x64-gnu15.4.8(lockfile)15.5.24nextparent bump@next/swc-linux-x64-musl15.4.8(lockfile)15.5.24nextparent bump@img/sharp-linux-x640.34.5(lockfile)0.35.5nextparent bump@img/sharp-linuxmusl-x640.34.5(lockfile)0.35.5nextparent bump@img/colour1.1.0sharp@0.35.5