File tree Expand file tree Collapse file tree 3 files changed +6
-19
lines changed
src/queries/Security/CWE-079 Expand file tree Collapse file tree 3 files changed +6
-19
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,8 @@ class ApplyExprCfgNode extends ExprCfgNode {
125125 }
126126
127127 AbstractFunctionDecl getStaticTarget ( ) { result = e .getStaticTarget ( ) }
128+
129+ Expr getFunction ( ) { result = e .getFunction ( ) }
128130}
129131
130132class CallExprCfgNode extends ApplyExprCfgNode {
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ private import FlowSummaryImpl::Private
1111private import FlowSummaryImpl:: Public
1212private import codeql.swift.dataflow.ExternalFlow
1313private import codeql.swift.dataflow.FlowSummary as FlowSummary
14+ private import codeql.swift.controlflow.CfgNodes
1415
1516class SummarizedCallableBase = AbstractFunctionDecl ;
1617
@@ -153,7 +154,9 @@ class InterpretNode extends TInterpretNode {
153154 DataFlowCallable asCallable ( ) { result .getUnderlyingCallable ( ) = this .asElement ( ) }
154155
155156 /** Gets the target of this call, if any. */
156- AbstractFunctionDecl getCallTarget ( ) { result = this .asCall ( ) .asCall ( ) .getStaticTarget ( ) }
157+ AbstractFunctionDecl getCallTarget ( ) {
158+ result = this .asCall ( ) .asCall ( ) .getFunction ( ) .( ApplyExpr ) .getStaticTarget ( )
159+ }
157160
158161 /** Gets a textual representation of this node. */
159162 string toString ( ) {
Original file line number Diff line number Diff line change @@ -17,24 +17,6 @@ import codeql.swift.dataflow.DataFlow
1717import codeql.swift.dataflow.TaintTracking
1818import codeql.swift.dataflow.FlowSources
1919import DataFlow:: PathGraph
20- import codeql.swift.frameworks.StandardLibrary.String
21-
22- /**
23- * A taint source that is `String(contentsOf:)`.
24- * TODO: this shouldn't be needed when `StringSource` in `String.qll` is working.
25- */
26- class StringContentsOfUrlSource extends RemoteFlowSource {
27- StringContentsOfUrlSource ( ) {
28- exists ( CallExpr call , AbstractFunctionDecl f |
29- call .getFunction ( ) .( ApplyExpr ) .getStaticTarget ( ) = f and
30- f .getName ( ) = "init(contentsOf:)" and
31- f .getParam ( 0 ) .getType ( ) .getName ( ) = "URL" and
32- this .asExpr ( ) = call
33- )
34- }
35-
36- override string getSourceType ( ) { result = "" }
37- }
3820
3921/**
4022 * A sink that is a candidate result for this query, such as certain arguments
You can’t perform that action at this time.
0 commit comments