roosterjs-content-model-api 9.50.0 → 9.51.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/publicApi/utils/checkXss.d.ts +2 -3
- package/lib/publicApi/utils/checkXss.js +3 -7
- package/lib/publicApi/utils/checkXss.js.map +1 -1
- package/lib-amd/publicApi/utils/checkXss.d.ts +2 -3
- package/lib-amd/publicApi/utils/checkXss.js +4 -7
- package/lib-amd/publicApi/utils/checkXss.js.map +1 -1
- package/lib-mjs/publicApi/utils/checkXss.d.ts +2 -3
- package/lib-mjs/publicApi/utils/checkXss.js +3 -7
- package/lib-mjs/publicApi/utils/checkXss.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @internal Check if there is XSS attack in the link
|
|
3
3
|
* @param link The link to be checked
|
|
4
|
-
* @returns The safe link
|
|
5
|
-
* @remarks This function
|
|
6
|
-
* and checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
4
|
+
* @returns The safe link, or empty string if there is XSS attack
|
|
5
|
+
* @remarks This function checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
7
6
|
* but it is necessary for security reasons. We treat the word "script" as safe if there are "/" before it.
|
|
8
7
|
*/
|
|
9
8
|
export declare function checkXss(link: string): string;
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.checkXss = void 0;
|
|
4
|
-
var roosterjs_content_model_dom_1 = require("roosterjs-content-model-dom");
|
|
5
4
|
/**
|
|
6
5
|
* @internal Check if there is XSS attack in the link
|
|
7
6
|
* @param link The link to be checked
|
|
8
|
-
* @returns The safe link
|
|
9
|
-
* @remarks This function
|
|
10
|
-
* and checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
7
|
+
* @returns The safe link, or empty string if there is XSS attack
|
|
8
|
+
* @remarks This function checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
11
9
|
* but it is necessary for security reasons. We treat the word "script" as safe if there are "/" before it.
|
|
12
10
|
*/
|
|
13
11
|
function checkXss(link) {
|
|
14
|
-
|
|
15
|
-
var sanitized = (0, roosterjs_content_model_dom_1.stripInvisibleUnicode)(link);
|
|
16
|
-
return sanitized.match(/^[^\/]*s\n*c\n*r\n*i\n*p\n*t\n*:/i) ? '' : sanitized;
|
|
12
|
+
return link.match(/^[^\/]*s\n*c\n*r\n*i\n*p\n*t\n*:/i) ? '' : link;
|
|
17
13
|
}
|
|
18
14
|
exports.checkXss = checkXss;
|
|
19
15
|
//# sourceMappingURL=checkXss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkXss.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/utils/checkXss.ts"],"names":[],"mappings":";;;AAAA
|
|
1
|
+
{"version":3,"file":"checkXss.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/utils/checkXss.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,SAAgB,QAAQ,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACvE,CAAC;AAFD,4BAEC","sourcesContent":["/**\n * @internal Check if there is XSS attack in the link\n * @param link The link to be checked\n * @returns The safe link, or empty string if there is XSS attack\n * @remarks This function checks for patterns like s\\nc\\nr\\ni\\np\\nt: to prevent XSS attacks. This may block some valid links,\n * but it is necessary for security reasons. We treat the word \"script\" as safe if there are \"/\" before it.\n */\nexport function checkXss(link: string): string {\n return link.match(/^[^\\/]*s\\n*c\\n*r\\n*i\\n*p\\n*t\\n*:/i) ? '' : link;\n}\n"]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @internal Check if there is XSS attack in the link
|
|
3
3
|
* @param link The link to be checked
|
|
4
|
-
* @returns The safe link
|
|
5
|
-
* @remarks This function
|
|
6
|
-
* and checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
4
|
+
* @returns The safe link, or empty string if there is XSS attack
|
|
5
|
+
* @remarks This function checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
7
6
|
* but it is necessary for security reasons. We treat the word "script" as safe if there are "/" before it.
|
|
8
7
|
*/
|
|
9
8
|
export declare function checkXss(link: string): string;
|
|
@@ -1,19 +1,16 @@
|
|
|
1
|
-
define(["require", "exports"
|
|
1
|
+
define(["require", "exports"], function (require, exports) {
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.checkXss = void 0;
|
|
5
5
|
/**
|
|
6
6
|
* @internal Check if there is XSS attack in the link
|
|
7
7
|
* @param link The link to be checked
|
|
8
|
-
* @returns The safe link
|
|
9
|
-
* @remarks This function
|
|
10
|
-
* and checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
8
|
+
* @returns The safe link, or empty string if there is XSS attack
|
|
9
|
+
* @remarks This function checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
11
10
|
* but it is necessary for security reasons. We treat the word "script" as safe if there are "/" before it.
|
|
12
11
|
*/
|
|
13
12
|
function checkXss(link) {
|
|
14
|
-
|
|
15
|
-
var sanitized = (0, roosterjs_content_model_dom_1.stripInvisibleUnicode)(link);
|
|
16
|
-
return sanitized.match(/^[^\/]*s\n*c\n*r\n*i\n*p\n*t\n*:/i) ? '' : sanitized;
|
|
13
|
+
return link.match(/^[^\/]*s\n*c\n*r\n*i\n*p\n*t\n*:/i) ? '' : link;
|
|
17
14
|
}
|
|
18
15
|
exports.checkXss = checkXss;
|
|
19
16
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkXss.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/utils/checkXss.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"checkXss.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/utils/checkXss.ts"],"names":[],"mappings":";;;;IAAA;;;;;;OAMG;IACH,SAAgB,QAAQ,CAAC,IAAY;QACjC,OAAO,IAAI,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACvE,CAAC;IAFD,4BAEC","sourcesContent":["/**\n * @internal Check if there is XSS attack in the link\n * @param link The link to be checked\n * @returns The safe link, or empty string if there is XSS attack\n * @remarks This function checks for patterns like s\\nc\\nr\\ni\\np\\nt: to prevent XSS attacks. This may block some valid links,\n * but it is necessary for security reasons. We treat the word \"script\" as safe if there are \"/\" before it.\n */\nexport function checkXss(link: string): string {\n return link.match(/^[^\\/]*s\\n*c\\n*r\\n*i\\n*p\\n*t\\n*:/i) ? '' : link;\n}\n"]}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @internal Check if there is XSS attack in the link
|
|
3
3
|
* @param link The link to be checked
|
|
4
|
-
* @returns The safe link
|
|
5
|
-
* @remarks This function
|
|
6
|
-
* and checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
4
|
+
* @returns The safe link, or empty string if there is XSS attack
|
|
5
|
+
* @remarks This function checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
7
6
|
* but it is necessary for security reasons. We treat the word "script" as safe if there are "/" before it.
|
|
8
7
|
*/
|
|
9
8
|
export declare function checkXss(link: string): string;
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { stripInvisibleUnicode } from 'roosterjs-content-model-dom';
|
|
2
1
|
/**
|
|
3
2
|
* @internal Check if there is XSS attack in the link
|
|
4
3
|
* @param link The link to be checked
|
|
5
|
-
* @returns The safe link
|
|
6
|
-
* @remarks This function
|
|
7
|
-
* and checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
4
|
+
* @returns The safe link, or empty string if there is XSS attack
|
|
5
|
+
* @remarks This function checks for patterns like s\nc\nr\ni\np\nt: to prevent XSS attacks. This may block some valid links,
|
|
8
6
|
* but it is necessary for security reasons. We treat the word "script" as safe if there are "/" before it.
|
|
9
7
|
*/
|
|
10
8
|
export function checkXss(link) {
|
|
11
|
-
|
|
12
|
-
var sanitized = stripInvisibleUnicode(link);
|
|
13
|
-
return sanitized.match(/^[^\/]*s\n*c\n*r\n*i\n*p\n*t\n*:/i) ? '' : sanitized;
|
|
9
|
+
return link.match(/^[^\/]*s\n*c\n*r\n*i\n*p\n*t\n*:/i) ? '' : link;
|
|
14
10
|
}
|
|
15
11
|
//# sourceMappingURL=checkXss.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkXss.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/utils/checkXss.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"checkXss.js","sourceRoot":"","sources":["../../../../../packages/roosterjs-content-model-api/lib/publicApi/utils/checkXss.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACvE,CAAC","sourcesContent":["/**\n * @internal Check if there is XSS attack in the link\n * @param link The link to be checked\n * @returns The safe link, or empty string if there is XSS attack\n * @remarks This function checks for patterns like s\\nc\\nr\\ni\\np\\nt: to prevent XSS attacks. This may block some valid links,\n * but it is necessary for security reasons. We treat the word \"script\" as safe if there are \"/\" before it.\n */\nexport function checkXss(link: string): string {\n return link.match(/^[^\\/]*s\\n*c\\n*r\\n*i\\n*p\\n*t\\n*:/i) ? '' : link;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
"description": "Format API for roosterjs",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"tslib": "^2.3.1",
|
|
6
|
-
"roosterjs-content-model-dom": "^9.
|
|
7
|
-
"roosterjs-content-model-types": "^9.
|
|
6
|
+
"roosterjs-content-model-dom": "^9.51.0",
|
|
7
|
+
"roosterjs-content-model-types": "^9.51.0"
|
|
8
8
|
},
|
|
9
|
-
"version": "9.
|
|
9
|
+
"version": "9.51.0",
|
|
10
10
|
"main": "./lib/index.js",
|
|
11
11
|
"typings": "./lib/index.d.ts",
|
|
12
12
|
"module": "./lib-mjs/index.js",
|