Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sanetize 'target' attr fix #1466

Merged
merged 2 commits into from
Dec 4, 2024

Conversation

bartbutenaers
Copy link
Contributor

@bartbutenaers bartbutenaers commented Nov 13, 2024

Description

The sanetization of injected html into the ui-text node (see other PR) seems to remove a bit too much attributes, because the target attribute of hyperlinks is also removed.

The DOMPurify library offers two ways to customize which attributes should be allowed:

  • ALLOWED_ATTR can be used to replace the entire list of default allowed attributes. Which imho seems to be a bit too invasive.
  • ADD_ATTR can be used to retain the default list of allowed attributes and to add a few more.

I have used the latter option to add allow the link attribute. Of course extra attributes can be added in the future if necessary.

The result:

image

Related Issue(s)

Closes #1464

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production

Labels

  • Includes a DB migration? -> add the area:migration label

@joepavitt
Copy link
Collaborator

This conflict should get resolved once #1463 is merged, so will wait for Steve's eyes on it before moving forward with this one.

# Conflicts:
#	ui/src/widgets/ui-text/UIText.vue
@joepavitt joepavitt merged commit 1d1a397 into FlowFuse:main Dec 4, 2024
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Text: target="_blank" gets stripped from injected HTML values
2 participants