gsSQL
gsSQL copied to clipboard
Sonarcloud and REGEX use.
- Getting a warning about a regex used to extract ORDER BY
- Not currently causing any problems, other than a warning.
Make sure the regex used here, which is vulnerable to super-linear runtime due to backtracking, cannot lead to denial of service.
- Line of code that is at issue
const order_by = /^(.+?)(\s+ASC|DESC)?$/gi;
- Not entirely sure how it can be replaced.
- Maybe this? (have to check in code to see if it resolves)
^(.*?)(\s+ASC|DESC)?$