New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@knime/utils

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@knime/utils - npm Package Compare versions

Comparing version
1.9.1
to
1.9.2
+6
-0
CHANGELOG.md
# @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": {

@@ -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 @@