1
1
private import actions
2
2
private import codeql.actions.TaintTracking
3
3
private import codeql.actions.dataflow.ExternalFlow
4
+ private import codeql.actions.security.ControlChecks
4
5
import codeql.actions.dataflow.FlowSources
5
6
import codeql.actions.DataFlow
6
7
@@ -65,6 +66,16 @@ class ArgumentInjectionFromMaDSink extends ArgumentInjectionSink {
65
66
override string getCommand ( ) { result = "unknown" }
66
67
}
67
68
69
+ /**
70
+ * Gets the event that is relevant for the given node in the context of argument injection.
71
+ *
72
+ * This is used to highlight the event in the query results when an alert is raised.
73
+ */
74
+ Event getRelevantEventInPrivilegedContext ( DataFlow:: Node node ) {
75
+ inPrivilegedContext ( node .asExpr ( ) , result ) and
76
+ not exists ( ControlCheck check | check .protects ( node .asExpr ( ) , result , "argument-injection" ) )
77
+ }
78
+
68
79
/**
69
80
* A taint-tracking configuration for unsafe user input
70
81
* that is used to construct and evaluate a code script.
@@ -88,6 +99,16 @@ private module ArgumentInjectionConfig implements DataFlow::ConfigSig {
88
99
run .getScript ( ) .getAnEnvReachingArgumentInjectionSink ( var , _, _)
89
100
)
90
101
}
102
+
103
+ predicate observeDiffInformedIncrementalMode ( ) { any ( ) }
104
+
105
+ Location getASelectedSourceLocation ( DataFlow:: Node source ) { none ( ) }
106
+
107
+ Location getASelectedSinkLocation ( DataFlow:: Node sink ) {
108
+ result = sink .getLocation ( )
109
+ or
110
+ result = getRelevantEventInPrivilegedContext ( sink ) .getLocation ( )
111
+ }
91
112
}
92
113
93
114
/** Tracks flow of unsafe user input that is used to construct and evaluate a code script. */
0 commit comments