Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/platform-shared/src/utils/sanitizerConfig.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const baseSanitizerConfig = {
allowVulnerableTags: true, // removes the warning for style tag please use with caution
allowedSchemesByTag: {
...sanitizeHtml.defaults.allowedSchemesByTag,
a: [...sanitizeHtml.defaults.allowedSchemes, 'otpauth'],

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As this is purely a TextOutputCallback use case, we might want to scope it, e.g., in sanitizerConfig.js, we can add

export const textOutputCallbackSanitizerConfig = {
  ...baseSanitizerConfig,
  allowedSchemesByTag: {
    ...baseSanitizerConfig.allowedSchemesByTag,
    a: [...sanitizeHtml.defaults.allowedSchemes, 'otpauth'],
  },
};

And then we can import textOutputCallbackSanitizerConfig and use it directly in the TextOutputCallback.

img: [...sanitizeHtml.defaults.allowedSchemes, 'data'],
},
transformTags: {
Expand Down