image icon indicating copy to clipboard operation
image copied to clipboard

fix!: remove `nonce` prop

Open GalacticHypernova opened this issue 2 months ago โ€ข 2 comments

๐Ÿ”— Linked issue

#1654

โ“ Type of change

  • [x] ๐Ÿ“– Documentation (updates to the documentation or readme)
  • [x] ๐Ÿž Bug fix (a non-breaking change that fixes an issue)
  • [ ] ๐Ÿ‘Œ Enhancement (improving an existing functionality)
  • [ ] โœจ New feature (a non-breaking change that adds functionality)
  • [ ] ๐Ÿงน Chore (updates to the build process or auxiliary tools and libraries)
  • [x] โš ๏ธ Breaking change (fix or feature that would cause existing functionality to change)

๐Ÿ“š Description

As continuation of #1654 , and with the approach of Nuxt Image v2, I think it is time to drop the nonce attribute. As stated in the original issue, allowing users to inject their own nonce is very dangerous, as it doesn't enforce the nonce is cryptographically secure, generated according to the spec, or unique across the app. It is much better to let dedicated security modules like Nuxt Security handle the nonce generation.

This PR is marked as breaking as it changes behavior, even though it won't actually break any projects (except maybe failing to load images in certain projects that relied on the nonce prop) because it simply voids the property.

GalacticHypernova avatar Oct 29 '25 19:10 GalacticHypernova

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/image@1995

commit: dc98a9f

pkg-pr-new[bot] avatar Oct 29 '25 19:10 pkg-pr-new[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 7.04%. Comparing base (6022fa8) to head (dc98a9f).

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1995   +/-   ##
=====================================
  Coverage   7.03%   7.04%           
=====================================
  Files         77      77           
  Lines       3567    3565    -2     
  Branches     138     138           
=====================================
  Hits         251     251           
+ Misses      3268    3266    -2     
  Partials      48      48           

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov-commenter avatar Oct 29 '25 19:10 codecov-commenter