Skip to content

Commit 0ba5a74

Browse files
authored
Merge pull request #17074 from jcogs33/jcogs33/java/fix-regex-use-comments
Java: fix comments about use of sink kind `regex-use`
2 parents 8eb3b31 + eea3e82 commit 0ba5a74

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

java/ql/lib/ext/org.apache.commons.lang3.model.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ extensions:
33
pack: codeql/java-all
44
extensible: sinkModel
55
data:
6-
# Note these sinks do not use the sink kind `regex-use[0]` because they should be considered as sinks for regex injection but not polynomial ReDoS.
6+
# Note these sinks do not use the sink kind `regex-use[0]` because the regex injection query needs to select them separately from
7+
# other `regex-use[0]` sinks in order to avoid FPs. As a result, these sinks are currently not used in the polynomial ReDoS query.
8+
# TODO: refactor the `regex-use%` sink kind so that the polynomial ReDoS query can also use these sinks.
79
- ["org.apache.commons.lang3", "RegExUtils", False, "removeAll", "(String,String)", "", "Argument[1]", "regex-use", "manual"]
810
- ["org.apache.commons.lang3", "RegExUtils", False, "removeFirst", "(String,String)", "", "Argument[1]", "regex-use", "manual"]
911
- ["org.apache.commons.lang3", "RegExUtils", False, "removePattern", "(String,String)", "", "Argument[1]", "regex-use", "manual"]

java/ql/lib/semmle/code/java/regex/RegexFlowConfigs.qll

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,10 @@ private class ExploitableStringLiteral extends StringLiteral {
2020
* if no such argument exists.
2121
*
2222
* Note that `regex-use` is deliberately not a possible value for `kind` here,
23-
* as it is used for regular expression injection sinks that should not be used
24-
* as polynomial ReDoS sinks.
23+
* as it is used for regular expression injection sinks that need to be selected
24+
* separately from existing `regex-use[0]` sinks.
25+
* TODO: refactor the `regex-use%` sink kind so that the polynomial ReDoS query
26+
* can also use the `regex-use` sinks.
2527
*/
2628
private predicate regexSinkKindInfo(string kind, boolean full, int strArg) {
2729
sinkModel(_, _, _, _, _, _, _, kind, _, _) and

0 commit comments

Comments
 (0)