File tree Expand file tree Collapse file tree 2 files changed +22
-4
lines changed
lib/semmle/code/csharp/security/dataflow
src/Security Features/CWE-730 Expand file tree Collapse file tree 2 files changed +22
-4
lines changed Original file line number Diff line number Diff line change @@ -25,9 +25,11 @@ abstract class Sink extends DataFlow::ExprNode { }
25
25
abstract class Sanitizer extends DataFlow:: ExprNode { }
26
26
27
27
/**
28
+ * DEPRECATED: Use `ReDoS` instead.
29
+ *
28
30
* A taint-tracking configuration for untrusted user input used in dangerous regular expression operations.
29
31
*/
30
- class TaintTrackingConfiguration extends TaintTracking:: Configuration {
32
+ deprecated class TaintTrackingConfiguration extends TaintTracking:: Configuration {
31
33
TaintTrackingConfiguration ( ) { this = "ReDoS" }
32
34
33
35
override predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
@@ -37,6 +39,22 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration {
37
39
override predicate isSanitizer ( DataFlow:: Node node ) { node instanceof Sanitizer }
38
40
}
39
41
42
+ /**
43
+ * A taint-tracking configuration for untrusted user input used in dangerous regular expression operations.
44
+ */
45
+ private module ReDoSConfig implements DataFlow:: ConfigSig {
46
+ predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
47
+
48
+ predicate isSink ( DataFlow:: Node sink ) { sink instanceof Sink }
49
+
50
+ predicate isBarrier ( DataFlow:: Node node ) { node instanceof Sanitizer }
51
+ }
52
+
53
+ /**
54
+ * A taint-tracking module for untrusted user input used in dangerous regular expression operations.
55
+ */
56
+ module ReDoS = TaintTracking:: Global< ReDoSConfig > ;
57
+
40
58
/** A source of remote user input. */
41
59
class RemoteSource extends Source instanceof RemoteFlowSource { }
42
60
Original file line number Diff line number Diff line change 16
16
import csharp
17
17
import semmle.code.csharp.security.dataflow.ReDoSQuery
18
18
import semmle.code.csharp.frameworks.system.text.RegularExpressions
19
- import semmle.code.csharp.dataflow.DataFlow :: DataFlow :: PathGraph
19
+ import ReDoS :: PathGraph
20
20
21
- from TaintTrackingConfiguration c , DataFlow :: PathNode source , DataFlow :: PathNode sink
21
+ from ReDoS :: PathNode source , ReDoS :: PathNode sink
22
22
where
23
- c . hasFlowPath ( source , sink ) and
23
+ ReDoS :: flowPath ( source , sink ) and
24
24
// No global timeout set
25
25
not exists ( RegexGlobalTimeout r ) and
26
26
(
You can’t perform that action at this time.
0 commit comments