@@ -17,7 +17,7 @@ import Shared::ModelOutput as ModelOutput
17
17
private import semmle.python.dataflow.new.RemoteFlowSources
18
18
private import semmle.python.dataflow.new.DataFlow
19
19
private import semmle.python.ApiGraphs
20
- private import semmle.python.dataflow.new.TaintTracking
20
+ private import semmle.python.dataflow.new.FlowSummary
21
21
22
22
/**
23
23
* A remote flow source originating from a CSV source row.
@@ -28,20 +28,31 @@ private class RemoteFlowSourceFromCsv extends RemoteFlowSource {
28
28
override string getSourceType ( ) { result = "Remote flow (from model)" }
29
29
}
30
30
31
- /**
32
- * Like `ModelOutput::summaryStep` but with API nodes mapped to data-flow nodes.
33
- */
34
- private predicate summaryStepNodes ( DataFlow:: Node pred , DataFlow:: Node succ , string kind ) {
35
- exists ( API:: Node predNode , API:: Node succNode |
36
- Specific:: summaryStep ( predNode , succNode , kind ) and
37
- pred = predNode .asSink ( ) and
38
- succ = succNode .asSource ( )
39
- )
40
- }
31
+ private class SummarizedCallableFromModel extends SummarizedCallable {
32
+ string type ;
33
+ string path ;
34
+
35
+ SummarizedCallableFromModel ( ) {
36
+ ModelOutput:: relevantSummaryModel ( type , path , _, _, _) and
37
+ this = type + ";" + path
38
+ }
39
+
40
+ override DataFlow:: CallCfgNode getACall ( ) { ModelOutput:: resolvedSummaryBase ( type , path , result ) }
41
+
42
+ override DataFlow:: ArgumentNode getACallback ( ) {
43
+ exists ( API:: Node base |
44
+ ModelOutput:: resolvedSummaryRefBase ( type , path , base ) and
45
+ result = base .getAValueReachableFromSource ( )
46
+ )
47
+ }
41
48
42
- /** Taint steps induced by summary models of kind `taint`. */
43
- private class TaintStepFromSummary extends TaintTracking:: AdditionalTaintStep {
44
- override predicate step ( DataFlow:: Node pred , DataFlow:: Node succ ) {
45
- summaryStepNodes ( pred , succ , "taint" )
49
+ override predicate propagatesFlow ( string input , string output , boolean preservesValue ) {
50
+ exists ( string kind | ModelOutput:: relevantSummaryModel ( type , path , input , output , kind ) |
51
+ kind = "value" and
52
+ preservesValue = true
53
+ or
54
+ kind = "taint" and
55
+ preservesValue = false
56
+ )
46
57
}
47
58
}
0 commit comments