-
Notifications
You must be signed in to change notification settings - Fork 2k
Expand file tree
/
Copy pathDependencyPath.ql
More file actions
48 lines (42 loc) · 1.69 KB
/
DependencyPath.ql
File metadata and controls
48 lines (42 loc) · 1.69 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* @name Dependency path
* @kind path-problem
* @description Reports known dependency paths between different predicates or classes.
* @precision medium
* @severity info
* @tags exploration
* @id ql/explore/dependency-path
*/
//
// This query is for exploration purposes can be edited by hand according to your use-case.
// Note that dependencies introduced by 'magic' are not recognized by this query.
//
import codeql_ql.ast.Ast
import codeql_ql.dependency.DependencyPath
module Config implements DependencyConfig {
/**
* Holds if we should explore the transitive dependencies of `source`.
*/
predicate isSource(PathNode source) {
// A top-level is considered to depend on everything in the file, which can be useful for generating
// quick overview of which files depend on a given sink.
source.asAstNode() instanceof TopLevel
}
/**
* Holds if a transitive dependency from a source to `sink` should be reported.
*/
predicate isSink(PathNode sink) { sink.asAstNode().(Predicate).getName() = "isLocalSourceNode" }
/**
* Holds if the `cached` members of a `cached` module or class should be unified.
*
* Whether to set this depends on your use-case:
* - If you wish to know why one predicate causes another predicate to be evaluated, this should be `any()`.
* - If you wish to investigate recursion patterns or understand why the value of one predicate
* is influenced by another predicate, it should be `none()`.
*/
predicate followCacheDependencies() { any() }
}
import PathGraph<Config>
from PathNode source, PathNode sink
where hasFlowPath(source, sink)
select source, source, sink, "$@ depends on $@.", source, source.toString(), sink, sink.toString()