@@ -17,7 +17,7 @@ import Shared::ModelOutput as ModelOutput
1717private import semmle.python.dataflow.new.RemoteFlowSources
1818private import semmle.python.dataflow.new.DataFlow
1919private import semmle.python.ApiGraphs
20- private import semmle.python.dataflow.new.TaintTracking
20+ private import semmle.python.dataflow.new.FlowSummary
2121
2222/**
2323 * A remote flow source originating from a CSV source row.
@@ -28,20 +28,31 @@ private class RemoteFlowSourceFromCsv extends RemoteFlowSource {
2828 override string getSourceType ( ) { result = "Remote flow (from model)" }
2929}
3030
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+ }
4148
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+ )
4657 }
4758}
0 commit comments