Skip to content

Commit c2f6a64

Browse files
Fixed multiple cases of vulnerable regexes (#2584)
1 parent 6913204 commit c2f6a64

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+70
-70
lines changed

components/prism-asciidoc.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
(function (Prism) {
22

33
var attributes = {
4-
pattern: /(^[ \t]*)\[(?!\[)(?:(["'$`])(?:(?!\2)[^\\]|\\.)*\2|\[(?:[^\]\\]|\\.)*\]|[^\]\\]|\\.)*\]/m,
4+
pattern: /(^[ \t]*)\[(?!\[)(?:(["'$`])(?:(?!\2)[^\\]|\\.)*\2|\[(?:[^\[\]\\]|\\.)*\]|[^\[\]\\"'$`]|\\.)*\]/m,
55
lookbehind: true,
66
inside: {
77
'quoted': {
@@ -32,7 +32,7 @@
3232
alias: 'comment'
3333
},
3434
'table': {
35-
pattern: /^\|={3,}(?:(?:\r?\n|\r).*)*?(?:\r?\n|\r)\|={3,}$/m,
35+
pattern: /^\|={3,}(?:(?:\r?\n|\r(?!\n)).*)*?(?:\r?\n|\r)\|={3,}$/m,
3636
inside: {
3737
'specifiers': {
3838
pattern: /(?!\|)(?:(?:(?:\d+(?:\.\d+)?|\.\d+)[+*])?(?:[<^>](?:\.[<^>])?|\.[<^>])?[a-z]*)(?=\|)/,
@@ -124,7 +124,7 @@
124124
}
125125
],
126126
'macro': {
127-
pattern: /\b[a-z\d][a-z\d-]*::?(?:(?:\S+)??\[(?:[^\]\\"]|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/,
127+
pattern: /\b[a-z\d][a-z\d-]*::?(?:(?:\S+)??\[(?:[^\]\\"']|(["'])(?:(?!\1)[^\\]|\\.)*\1|\\.)*\])/,
128128
inside: {
129129
'function': /^[a-z\d-]+(?=:)/,
130130
'punctuation': /^::?/,

components/prism-asciidoc.min.js

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

components/prism-bash.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@
133133
},
134134
// “Normal” string
135135
{
136-
pattern: /(^|[^\\](?:\\\\)*)(["'])(?:\\[\s\S]|\$\([^)]+\)|`[^`]+`|(?!\2)[^\\])*\2/,
136+
pattern: /(^|[^\\](?:\\\\)*)(["'])(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|(?!\2)[^\\`$])*\2/,
137137
lookbehind: true,
138138
greedy: true,
139139
inside: insideString

0 commit comments

Comments
 (0)