formio.js icon indicating copy to clipboard operation
formio.js copied to clipboard

Safe handling of SVG <use> href

Open Rolf-MP opened this issue 2 years ago • 1 comments

See: https://github.com/formio/formio.js/issues/4224 And (merged to master): https://github.com/formio/formio.js/pull/5394

Thus DOMPurify has a SVG profile.

However, this profile filters out the <use> tag as it is potentially unsafe when referencing external content. Straightforward, but potentially unsafe, approach is to simply add use to the allowed tags in options (once above merge is released).

In sandbox:

{
  "sanitizeConfig": {
    "useProfiles": {
      "svg": true
    },
     "addTags": [
      "use"
    ]
  }
}

This issue has a proposed workaround. https://github.com/cure53/DOMPurify/issues/574

With some minor enhancements to that hook it should be possible to provide a list of safe href "string starts" through formio options such that we can set which )exteral) references are allowed.

Rolf-MP avatar Nov 07 '23 17:11 Rolf-MP

Is there a particular ask here? Trying to discern if there is anything potentially actionable.

lane-formio avatar Sep 12 '24 15:09 lane-formio