Repository navigation
fix(security): Fix 10 security issues in next, sharp - #799
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 vulnerabilities in image optimization (AVIF/libheif), memory corruption, and high-severity DoS/SSRF issues. This update includes breaking changes that require manual migration.
Sharp 0.35.0 Node.js version requirement
Where your code is affected: The entire project, particularly
packages/demo-nextjs/package.jsonwhich depends on Next.js 15.4.8, and the rootpackage.jsonwhich specifies"engines": { "node": ">=18" }.Impact: Sharp 0.35.0 requires Node.js >= 20.9.0, but the project currently specifies Node.js >= 18. Sharp is an optional dependency of Next.js (as seen in
yarn.lock), used for image optimization. While it's optional, Next.js will attempt to use it if available, and the version mismatch will cause installation or runtime failures when Next.js tries to leverage sharp for image processing.Remediation: Update the
engines.nodefield inpackage.jsonandpackages/embed/package.jsonandpackages/embed-react/package.jsonto">=20.9.0"to match sharp's requirement. Ensure your CI/CD pipelines and development environments use Node.js 20.9.0 or higher.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.✅ 10 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/OPTIONSrequest usingTransfer-Encoding: chunkedcould trigger reque...🤖 Remediation details
Fix critical and high-severity vulnerabilities in
nextandsharpShort summary
This PR remediates multiple vulnerabilities in two packages —
nextandsharp— by updating their declared versions in both the rootpackage.jsonand thepackages/demo-nextjsworkspace manifest, withyarn.lockrefreshed accordingly. Thenextpackage was a direct dependency in both locations;sharpwas resolved transitively throughnextand required no separate manifest entry.next
nextwas pinned at15.4.8in two places: the rootpackage.json(devDependencies) and thepackages/demo-nextjs/package.jsonworkspace (dependencies). Both were updated to the exact version15.5.28, which is the minimum release satisfying every patched-version floor across all nine advisories targetingnextin this task. Because the pin was exact (no caret or tilde), Yarn could not resolve a newer version without a manifest edit; updating both manifests and runningyarn install --ignore-engines --ignore-scriptsfrom the repo root replaced the stalenext@15.4.8lockfile entry withnext@15.5.28.sharp
sharpwas not declared directly in any manifest; it was pulled in as an optionalDependency ofnext. Atnext@15.4.8, the declared range forsharpwas^0.34.3, which resolved to0.34.5— below the0.35.5patched floor. Bumpingnextto15.5.28updated its published optional dependency range forsharpto^0.34.3 || ^0.35.5, which Yarn resolved to0.35.5. No directsharpentry orresolutionsoverride was needed; the fix was entirely a consequence of thenextparent bump.Version changes
next15.4.815.5.28package.jsondevDependencies)next15.4.815.5.28packages/demo-nextjsworkspace dependencies)sharp0.34.50.35.5next