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 { }
2525abstract class Sanitizer extends DataFlow:: ExprNode { }
2626
2727/**
28+ * DEPRECATED: Use `ReDoS` instead.
29+ *
2830 * A taint-tracking configuration for untrusted user input used in dangerous regular expression operations.
2931 */
30- class TaintTrackingConfiguration extends TaintTracking:: Configuration {
32+ deprecated class TaintTrackingConfiguration extends TaintTracking:: Configuration {
3133 TaintTrackingConfiguration ( ) { this = "ReDoS" }
3234
3335 override predicate isSource ( DataFlow:: Node source ) { source instanceof Source }
@@ -37,6 +39,22 @@ class TaintTrackingConfiguration extends TaintTracking::Configuration {
3739 override predicate isSanitizer ( DataFlow:: Node node ) { node instanceof Sanitizer }
3840}
3941
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+
4058/** A source of remote user input. */
4159class RemoteSource extends Source instanceof RemoteFlowSource { }
4260
Original file line number Diff line number Diff line change 1616import csharp
1717import semmle.code.csharp.security.dataflow.ReDoSQuery
1818import semmle.code.csharp.frameworks.system.text.RegularExpressions
19- import semmle.code.csharp.dataflow.DataFlow :: DataFlow :: PathGraph
19+ import ReDoS :: PathGraph
2020
21- from TaintTrackingConfiguration c , DataFlow :: PathNode source , DataFlow :: PathNode sink
21+ from ReDoS :: PathNode source , ReDoS :: PathNode sink
2222where
23- c . hasFlowPath ( source , sink ) and
23+ ReDoS :: flowPath ( source , sink ) and
2424 // No global timeout set
2525 not exists ( RegexGlobalTimeout r ) and
2626 (
You can’t perform that action at this time.
0 commit comments