Skip to content

Commit 1244043

Browse files
committed
feat: fix potential xss injection
1 parent f2ddaf2 commit 1244043

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

packages/react-query-next-experimental/src/htmlescape.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
// License: https://github.com/zertosh/htmlescape/blob/0527ca7156a524d256101bb310a9f970f63078ad/LICENSE
1111

1212
const ESCAPE_LOOKUP: { [match: string]: string } = {
13-
"&": "\\u0026",
14-
">": "\\u003e",
15-
"<": "\\u003c",
16-
"\u2028": "\\u2028",
17-
"\u2029": "\\u2029",
18-
};
13+
'&': '\\u0026',
14+
'>': '\\u003e',
15+
'<': '\\u003c',
16+
'\u2028': '\\u2028',
17+
'\u2029': '\\u2029',
18+
}
1919

20-
export const ESCAPE_REGEX = /[&><\u2028\u2029]/g;
20+
export const ESCAPE_REGEX = /[&><\u2028\u2029]/g
2121

2222
export function htmlEscapeJsonString(str: string): string {
23-
return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]);
23+
return str.replace(ESCAPE_REGEX, (match) => ESCAPE_LOOKUP[match]!)
2424
}

0 commit comments

Comments
 (0)