-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🦺 [open-formulieren/security-issues#36] Removing HTML from component …
…tooltips Added a simplistic sanitize function that sanitizes component data when saving the component. This function removes all HTML content from the component tooltip
- Loading branch information
1 parent
e7e8155
commit eb0dee1
Showing
5 changed files
with
29 additions
and
8 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
import {Formio} from 'formiojs'; | ||
|
||
import {removeAllHTMLContent} from 'utils/sanitizer'; | ||
|
||
const getComponentEmptyValue = component => { | ||
const componentInstance = Formio.Components.create(component); | ||
return componentInstance.emptyValue; | ||
}; | ||
|
||
export {getComponentEmptyValue}; | ||
const sanitizeComponentData = componentData => ({ | ||
...componentData, | ||
tooltip: removeAllHTMLContent(componentData.tooltip), | ||
}); | ||
|
||
export {getComponentEmptyValue, sanitizeComponentData}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import sanitizeHtml from 'sanitize-html'; | ||
|
||
export const removeAllHTMLContent = content => | ||
sanitizeHtml(content, { | ||
allowedTags: [], | ||
allowedAttributes: {}, | ||
}); |