github-code-scanning[bot] commented on code in PR #14712:
URL: https://github.com/apache/druid/pull/14712#discussion_r1280951117
##########
web-console/src/utils/general.tsx:
##########
@@ -302,8 +302,21 @@
}
}
+function pluralize(word: string): string {
+ // Ignoring irregular plurals.
+ if (/.*(s|x|z|ch|sh)$/.test(word)) {
+ return word + 'es';
+ } else if (/.*([^aeiou])y$/.test(word)) {
Review Comment:
## Polynomial regular expression used on uncontrolled data
This [regular expression](1) that depends on [library input](2) may run slow
on strings with many repetitions of 'a'.
This [regular expression](1) that depends on [library input](3) may run slow
on strings with many repetitions of 'a'.
[Show more
details](https://github.com/apache/druid/security/code-scanning/5323)
##########
web-console/src/utils/general.tsx:
##########
@@ -302,8 +302,21 @@
}
}
+function pluralize(word: string): string {
+ // Ignoring irregular plurals.
+ if (/.*(s|x|z|ch|sh)$/.test(word)) {
+ return word + 'es';
+ } else if (/.*([^aeiou])y$/.test(word)) {
+ return word.slice(0, -1) + 'ies';
+ } else if (/.*(f|fe)$/.test(word)) {
Review Comment:
## Polynomial regular expression used on uncontrolled data
This [regular expression](1) that depends on [library input](2) may run slow
on strings with many repetitions of 'a'.
This [regular expression](1) that depends on [library input](3) may run slow
on strings with many repetitions of 'a'.
[Show more
details](https://github.com/apache/druid/security/code-scanning/5324)
##########
web-console/src/utils/general.tsx:
##########
@@ -302,8 +302,21 @@
}
}
+function pluralize(word: string): string {
+ // Ignoring irregular plurals.
+ if (/.*(s|x|z|ch|sh)$/.test(word)) {
Review Comment:
## Polynomial regular expression used on uncontrolled data
This [regular expression](1) that depends on [library input](2) may run slow
on strings with many repetitions of 'a'.
This [regular expression](1) that depends on [library input](3) may run slow
on strings with many repetitions of 'a'.
[Show more
details](https://github.com/apache/druid/security/code-scanning/5322)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]