Skip to content

Prevent overriding DOMPurify's default config with custom configuration

Dheeraj Joshi requested to merge djadmin-fix-dompurify-configuration into master

What does this MR do?

This MR updates the logic for handling DOMPurify configurations in a way that it always include the default configuration.

Why

With the current implementation, if a configuration is passed to DOMPurify's sanitize fn, it overrides the default config. The default config exists to add defense-in-depth by default, and the existing behavior could lead to cross-site scripting bugs.

Similar implementation can be found for v-safe-html

Screenshots or Screencasts (strongly suggested).

No visual changes for user

Follow-up Improvements

https://gitlab.com/gitlab-org/gitlab/-/issues/339708

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • 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 https://gitlab.com/gitlab-org/gitlab/-/issues/339700

Edited by Dheeraj Joshi

Merge request reports