We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4b42c44 commit 13459c8Copy full SHA for 13459c8
1 file changed
ruby/ql/lib/codeql/ruby/security/performance/RegExpInjectionCustomizations.qll
@@ -48,12 +48,16 @@ module RegExpInjection {
48
}
49
50
/**
51
- * The first argument of a call to `Regexp.new`, considered as a flow sink.
+ * The first argument of a call to `Regexp.new` or `Regexp.compile`,
52
+ * considered as a flow sink.
53
*/
54
class ConstructedRegExpAsSink extends Sink {
55
ConstructedRegExpAsSink() {
- this =
56
- API::getTopLevelMember("Regexp").getAnInstantiation().(DataFlow::CallNode).getArgument(0)
+ exists(API::Node regexp, DataFlow::CallNode callNode |
57
+ regexp = API::getTopLevelMember("Regexp") and
58
+ (callNode = regexp.getAnInstantiation() or callNode = regexp.getAMethodCall("compile")) and
59
+ this = callNode.getArgument(0)
60
+ )
61
62
63
0 commit comments