Skip to content

Have dompurify accept <use> with icons href

Miguel Rincon requested to merge 247207-missing-icons-dompurify into master

What does this MR do?

In order for icons to be rendered, they have a <use> tag that might be open to vulnerabilities, this change allows developer to enable <use> tags safely when needed.

This MR adds a hook so if use is allowed, it can be used safely.

Example usage:

// before

import { sanitize } from 'dompurify';

sanitize(contentWithIcons) // does not render icons!

// after

import { sanitize } from '~/lib/dompurify';

sanitize(contentWithIcons) // renders icons safely!

Screenshots

N/A

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Closes #247207 (closed)

Edited by Andrew Kelly

Merge request reports

Loading