unjs / ipx

๐Ÿ–ผ๏ธ High performance, secure and easy-to-use image optimizer.
MIT License
1.2k stars 59 forks source link

fix(svgo): handle javascript uris in removexss plugin #186

Closed SethFalco closed 8 months ago

SethFalco commented 8 months ago

๐Ÿ”— Linked issue

N/A

โ“ Type of change

๐Ÿ“š Description

The removeXSS plugin for SVGO was missing one of the possible ways to execute scripts. SVGs href attributes, regardless of namespace, can contain JavaScript URIs, which the client will execute.

I recently updated the SVGO removeScriptElement plugin to handle this. When v3.0.3 is released, you'll no longer need to maintain the removeXSS plugin, and can instead opt for the removeScriptElement plugin. This plugin is due to be renamed to removeScripts.

Documentation: https://svgo.dev/docs/plugins/remove-scripts/

I'm not sure when v3.0.3 can be released, so it's probably worth updating the plugin already. Once v3.0.3 is released, I'd be happy to open another PR to help with migrating over to it and dropping removeXSS.

Reference: https://github.com/svg/svgo/pull/1664#issuecomment-1793440427

Chores

I also did the following chores:

๐Ÿ“ Checklist

codecov[bot] commented 8 months ago

Codecov Report

Merging #186 (dff8cd9) into main (5980f4e) will not change coverage. The diff coverage is n/a.

@@           Coverage Diff           @@
##             main     #186   +/-   ##
=======================================
  Coverage   54.01%   54.01%           
=======================================
  Files          11       11           
  Lines        1083     1083           
  Branches       45       45           
=======================================
  Hits          585      585           
  Misses        498      498           
pi0 commented 8 months ago

https://github.com/unjs/ipx/releases/tag/v2.0.1

Looking forward for svgo next release!