url-sanitizer 2.0.2 → 2.0.3
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/dist/url-sanitizer-wo-dompurify.min.js +1 -1
- package/dist/url-sanitizer-wo-dompurify.min.js.map +2 -2
- package/dist/url-sanitizer.min.js +1 -1
- package/dist/url-sanitizer.min.js.map +2 -2
- package/package.json +13 -11
- package/src/mjs/constant.js +2 -2
- package/src/mjs/sanitizer.js +2 -2
- package/src/mjs/uri-util.js +1 -1
package/package.json
CHANGED
|
@@ -25,29 +25,31 @@
|
|
|
25
25
|
"jsdom": "^25.0.1"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@babel/
|
|
29
|
-
"@babel/
|
|
28
|
+
"@babel/core": "^7.25.8",
|
|
29
|
+
"@babel/eslint-parser": "^7.25.8",
|
|
30
|
+
"@babel/plugin-syntax-import-attributes": "^7.25.7",
|
|
30
31
|
"@types/dompurify": "^3.0.5",
|
|
31
32
|
"@types/jsdom": "^21.1.7",
|
|
32
|
-
"@types/node": "^22.7.
|
|
33
|
+
"@types/node": "^22.7.5",
|
|
33
34
|
"c8": "^10.1.2",
|
|
34
35
|
"chai": "^5.1.1",
|
|
35
36
|
"commander": "^12.1.0",
|
|
36
37
|
"copyfiles": "^2.4.1",
|
|
37
38
|
"csvtojson": "^2.0.10",
|
|
38
39
|
"esbuild": "^0.24.0",
|
|
39
|
-
"eslint": "^
|
|
40
|
-
"eslint-
|
|
41
|
-
"eslint-plugin-
|
|
42
|
-
"eslint-plugin-jsdoc": "^50.3.0",
|
|
40
|
+
"eslint": "^9.12.0",
|
|
41
|
+
"eslint-plugin-import-x": "^4.3.1",
|
|
42
|
+
"eslint-plugin-jsdoc": "^50.3.2",
|
|
43
43
|
"eslint-plugin-regexp": "^2.6.0",
|
|
44
|
-
"eslint-plugin-unicorn": "^
|
|
44
|
+
"eslint-plugin-unicorn": "^56.0.0",
|
|
45
|
+
"globals": "^15.11.0",
|
|
45
46
|
"http-server": "^14.1.1",
|
|
46
47
|
"mocha": "^10.7.3",
|
|
48
|
+
"neostandard": "^0.11.6",
|
|
47
49
|
"npm-run-all": "^4.1.5",
|
|
48
50
|
"sinon": "^19.0.2",
|
|
49
|
-
"typescript": "^5.6.
|
|
50
|
-
"undici": "^6.
|
|
51
|
+
"typescript": "^5.6.3",
|
|
52
|
+
"undici": "^6.20.0"
|
|
51
53
|
},
|
|
52
54
|
"scripts": {
|
|
53
55
|
"build": "npm run include && npm run tsc && npm run lint && npm test && npm run copy && npm run bundle",
|
|
@@ -66,5 +68,5 @@
|
|
|
66
68
|
"test-bdd": "http-server ./ -c-1 -o test/bdd/url-sanitizer.test.html",
|
|
67
69
|
"tsc": "node modules/index clean --dir=types -i && npx tsc"
|
|
68
70
|
},
|
|
69
|
-
"version": "2.0.
|
|
71
|
+
"version": "2.0.3"
|
|
70
72
|
}
|
package/src/mjs/constant.js
CHANGED
|
@@ -12,7 +12,7 @@ export const REG_B64 = /^[\w+/=-]+$/;
|
|
|
12
12
|
export const REG_CHARSET = /^charset=([\w#&.;-]+)$/;
|
|
13
13
|
export const REG_DATA_URL = /data:[\w#&+./;=-]*,/;
|
|
14
14
|
export const REG_DATA_URL_B64 = /data:[\w#&+./;=^]*base64,[\w+/=-]+/i;
|
|
15
|
-
export const REG_DATA_URL_G = /data:[\w#&+./;=-]*,[
|
|
15
|
+
export const REG_DATA_URL_G = /data:[\w#&+./;=-]*,[^\x22]+/g;
|
|
16
16
|
export const REG_NUM_REF = /&#(x(?:00)?[\dA-F]{2}|0?\d{1,3});?/gi;
|
|
17
17
|
export const REG_MIME_DOM =
|
|
18
18
|
/^(?:application\/(?:[\w#&.;-]+\+)?x|image\/svg\+x|text\/(?:ht|x))ml;?/;
|
|
@@ -21,5 +21,5 @@ export const REG_SCHEME = /^[a-z][\da-z+.-]*$/;
|
|
|
21
21
|
export const REG_SCHEME_EXT = /^(?:ext|web)\+[a-z]+$/;
|
|
22
22
|
export const REG_SCRIPT = /(?:java|vb)script/;
|
|
23
23
|
export const REG_SCRIPT_BLOB = /(?:java|vb)script|blob/;
|
|
24
|
-
export const REG_TAG_QUOT = /%(?:
|
|
24
|
+
export const REG_TAG_QUOT = /%(?:22|27|3C|3E)|[\x22\x27<>]/;
|
|
25
25
|
export const REG_URL_ENC = /^%[\dA-F]{2}$/i;
|
package/src/mjs/sanitizer.js
CHANGED
|
@@ -107,7 +107,7 @@ export class URLSanitizer extends URISchemes {
|
|
|
107
107
|
purifiedDom = purifiedDom.replace(/(?:#|%23)$/, '')
|
|
108
108
|
.replace(/(?<!(?:#|%23).*)(?:\?|%3F)$/, '');
|
|
109
109
|
return encodeURI(purifiedDom);
|
|
110
|
-
}
|
|
110
|
+
}
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
113
|
* sanitize URL
|
|
@@ -363,7 +363,7 @@ export class URLSanitizer extends URISchemes {
|
|
|
363
363
|
this.#nest = 0;
|
|
364
364
|
this.#recurse.clear();
|
|
365
365
|
}
|
|
366
|
-
}
|
|
366
|
+
}
|
|
367
367
|
|
|
368
368
|
/* aliases and async wrappers */
|
|
369
369
|
/* instance */
|
package/src/mjs/uri-util.js
CHANGED