-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathUtils.qll
More file actions
28 lines (28 loc) · 828 Bytes
/
Utils.qll
File metadata and controls
28 lines (28 loc) · 828 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import python
private import semmle.python.ApiGraphs
private import experimental.cryptography.utils.CallCfgNodeWithTarget
/**
* Gets an ultimate local source (not a source in a library)
*/
DataFlow::Node getUltimateSrcFromApiNode(API::Node n){
result = n.getAValueReachingSink()
and
(
// the result is a call to a library only
(
result instanceof CallCfgNodeWithTarget and
not result.(CallCfgNodeWithTarget).getTarget().asExpr().getEnclosingModule().inSource()
)
// the result is not a call, and not a function signataure or parameter
or
(
not result instanceof CallCfgNodeWithTarget
and
not result instanceof DataFlow::ParameterNode
and
not result.asExpr() instanceof FunctionExpr
and
result.asExpr().getEnclosingModule().inSource()
)
)
}