Commit dee8b33
committed
fix: add possessive quantifier to regex match for formatted strings
(Fixes https://github.com/faker-ruby/faker/security/code-scanning/14)
Adds a possessive quantifier (an extra `+`) to the regex to prevent backtracking.
This is to prevent the issue 'Polynomial regular expression used on
uncontrolled data code'. It seems a bit overkill, given how these
formatted strings are used, but I don't think it hurts either.
See reference:
https://ruby-doc.org/3.4.1/Regexp.html#class-Regexp-label-Greedy-2C+Lazy-2C+or+Possessive+Matching1 parent 2258715 commit dee8b33
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
| 136 | + | |
| 137 | + | |
137 | 138 | | |
138 | 139 | | |
139 | 140 | | |
| |||
0 commit comments