Skip to content

Commit d18ffcb

Browse files
committed
fix: Changed the template literal regex to avoid a config-dependent bypass
1 parent 0d64d2b commit d18ffcb

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

dist/purify.cjs.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/purify.es.mjs

+2-2
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:x
196196
// eslint-disable-next-line unicorn/better-regex
197197
const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
198198
const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
199-
const TMPLIT_EXPR = seal(/\$\{[\w\W]*}/gm); // eslint-disable-line unicorn/better-regex
199+
const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
200200
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
201201
const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
202202
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
@@ -298,7 +298,7 @@ function createDOMPurify() {
298298
const DOMPurify = root => createDOMPurify(root);
299299
DOMPurify.version = '3.2.3';
300300
DOMPurify.removed = [];
301-
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document) {
301+
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
302302
// Not running in a browser, provide a factory function
303303
// so that you can pass your own Window
304304
DOMPurify.isSupported = false;

dist/purify.js

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)