@knime/utils
Advanced tools
+6
-0
| # @knime/utils | ||
| ## 1.9.2 | ||
| ### Patch Changes | ||
| - 6d57731: Add option to allow hyperlinks to the sanitization util. | ||
| ## 1.9.1 | ||
@@ -4,0 +10,0 @@ |
+1
-1
| { | ||
| "name": "@knime/utils", | ||
| "version": "1.9.1", | ||
| "version": "1.9.2", | ||
| "description": "Internal utility functions and constants shared across @knime packages.", | ||
@@ -5,0 +5,0 @@ "repository": { |
+16
-4
@@ -38,2 +38,4 @@ import DomPurify from "dompurify"; | ||
| * @param rawHTML | ||
| * @param options.allowStyleAttribute - Allow the style attribute on elements | ||
| * @param options.allowHyperlinks - Allow anchor tags with href attribute | ||
| * @returns sanitized html | ||
@@ -43,8 +45,18 @@ */ | ||
| rawHTML: string, | ||
| options: { allowStyleAttribute: boolean } = { allowStyleAttribute: false }, | ||
| options: { allowStyleAttribute?: boolean; allowHyperlinks?: boolean } = { | ||
| allowStyleAttribute: false, | ||
| allowHyperlinks: false, | ||
| }, | ||
| ) => { | ||
| const { allowStyleAttribute } = options; | ||
| const ALLOWED_ATTR = allowStyleAttribute ? ["style"] : []; | ||
| const { allowStyleAttribute, allowHyperlinks } = options; | ||
| const ALLOWED_ATTR = [ | ||
| ...(allowStyleAttribute ? ["style"] : []), | ||
| ...(allowHyperlinks ? ["href"] : []), | ||
| ]; | ||
| const allowedTags = allowHyperlinks ? [...ALLOWED_TAGS, "a"] : ALLOWED_TAGS; | ||
| return DomPurify.sanitize(rawHTML, { ALLOWED_TAGS, ALLOWED_ATTR }); | ||
| return DomPurify.sanitize(rawHTML, { | ||
| ALLOWED_TAGS: allowedTags, | ||
| ALLOWED_ATTR, | ||
| }); | ||
| }; | ||
@@ -51,0 +63,0 @@ |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
Found 1 instance in 1 package
97939
0.5%1604
0.75%