codeql-development-mcp-server 2.24.3 → 2.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/codeql-development-mcp-server.js +48111 -49526
- package/dist/codeql-development-mcp-server.js.map +4 -4
- package/package.json +9 -9
- package/ql/actions/tools/src/PrintCFG/PrintCFG.ql +1 -3
- package/ql/actions/tools/src/codeql-pack.lock.yml +14 -14
- package/ql/actions/tools/src/codeql-pack.yml +2 -2
- package/ql/cpp/tools/src/CallGraphFrom/CallGraphFrom.ql +6 -20
- package/ql/cpp/tools/src/CallGraphFromTo/CallGraphFromTo.md +47 -0
- package/ql/cpp/tools/src/CallGraphFromTo/CallGraphFromTo.ql +77 -0
- package/ql/cpp/tools/src/CallGraphTo/CallGraphTo.ql +6 -20
- package/ql/cpp/tools/src/ExternalPredicates.qll +14 -0
- package/ql/cpp/tools/src/PrintAST/PrintAST.ql +9 -20
- package/ql/cpp/tools/src/PrintCFG/PrintCFG.ql +1 -3
- package/ql/cpp/tools/src/codeql-pack.lock.yml +12 -12
- package/ql/cpp/tools/src/codeql-pack.yml +2 -2
- package/ql/csharp/tools/src/CallGraphFrom/CallGraphFrom.ql +4 -19
- package/ql/csharp/tools/src/CallGraphFromTo/CallGraphFromTo.md +49 -0
- package/ql/csharp/tools/src/CallGraphFromTo/CallGraphFromTo.ql +64 -0
- package/ql/csharp/tools/src/CallGraphTo/CallGraphTo.ql +4 -19
- package/ql/csharp/tools/src/ExternalPredicates.qll +14 -0
- package/ql/csharp/tools/src/PrintAST/PrintAST.ql +9 -17
- package/ql/csharp/tools/src/codeql-pack.lock.yml +10 -10
- package/ql/csharp/tools/src/codeql-pack.yml +2 -2
- package/ql/go/tools/src/CallGraphFrom/CallGraphFrom.ql +4 -19
- package/ql/go/tools/src/CallGraphFromTo/CallGraphFromTo.md +47 -0
- package/ql/go/tools/src/CallGraphFromTo/CallGraphFromTo.ql +53 -0
- package/ql/go/tools/src/CallGraphTo/CallGraphTo.ql +4 -20
- package/ql/go/tools/src/ExternalPredicates.qll +14 -0
- package/ql/go/tools/src/PrintAST/PrintAST.ql +132 -22
- package/ql/go/tools/src/codeql-pack.lock.yml +10 -10
- package/ql/go/tools/src/codeql-pack.yml +2 -2
- package/ql/java/tools/src/CallGraphFrom/CallGraphFrom.ql +4 -19
- package/ql/java/tools/src/CallGraphFromTo/CallGraphFromTo.md +49 -0
- package/ql/java/tools/src/CallGraphFromTo/CallGraphFromTo.ql +64 -0
- package/ql/java/tools/src/CallGraphTo/CallGraphTo.ql +4 -19
- package/ql/java/tools/src/ExternalPredicates.qll +14 -0
- package/ql/java/tools/src/PrintAST/PrintAST.ql +9 -17
- package/ql/java/tools/src/PrintCFG/PrintCFG.ql +11 -10
- package/ql/java/tools/src/codeql-pack.lock.yml +14 -14
- package/ql/java/tools/src/codeql-pack.yml +2 -2
- package/ql/javascript/tools/src/CallGraphFrom/CallGraphFrom.ql +4 -19
- package/ql/javascript/tools/src/CallGraphFromTo/CallGraphFromTo.md +47 -0
- package/ql/javascript/tools/src/CallGraphFromTo/CallGraphFromTo.ql +69 -0
- package/ql/javascript/tools/src/CallGraphTo/CallGraphTo.ql +4 -20
- package/ql/javascript/tools/src/ExternalPredicates.qll +14 -0
- package/ql/javascript/tools/src/PrintAST/PrintAST.ql +9 -20
- package/ql/javascript/tools/src/PrintCFG/PrintCFG.ql +1 -3
- package/ql/javascript/tools/src/codeql-pack.lock.yml +13 -13
- package/ql/javascript/tools/src/codeql-pack.yml +2 -2
- package/ql/python/tools/src/CallGraphFrom/CallGraphFrom.ql +3 -17
- package/ql/python/tools/src/CallGraphFromTo/CallGraphFromTo.md +46 -0
- package/ql/python/tools/src/CallGraphFromTo/CallGraphFromTo.ql +71 -0
- package/ql/python/tools/src/CallGraphTo/CallGraphTo.ql +6 -22
- package/ql/python/tools/src/ExternalPredicates.qll +14 -0
- package/ql/python/tools/src/PrintAST/PrintAST.ql +9 -20
- package/ql/python/tools/src/PrintCFG/PrintCFG.ql +1 -3
- package/ql/python/tools/src/codeql-pack.lock.yml +13 -13
- package/ql/python/tools/src/codeql-pack.yml +2 -2
- package/ql/ruby/tools/src/CallGraphFrom/CallGraphFrom.ql +4 -19
- package/ql/ruby/tools/src/CallGraphFromTo/CallGraphFromTo.md +48 -0
- package/ql/ruby/tools/src/CallGraphFromTo/CallGraphFromTo.ql +50 -0
- package/ql/ruby/tools/src/CallGraphTo/CallGraphTo.ql +4 -20
- package/ql/ruby/tools/src/ExternalPredicates.qll +14 -0
- package/ql/ruby/tools/src/PrintAST/PrintAST.ql +9 -17
- package/ql/ruby/tools/src/PrintCFG/PrintCFG.ql +1 -3
- package/ql/ruby/tools/src/codeql-pack.lock.yml +10 -10
- package/ql/ruby/tools/src/codeql-pack.yml +2 -2
- package/ql/swift/tools/src/CallGraphFrom/CallGraphFrom.ql +7 -16
- package/ql/swift/tools/src/CallGraphFromTo/CallGraphFromTo.md +47 -0
- package/ql/swift/tools/src/CallGraphFromTo/CallGraphFromTo.ql +80 -0
- package/ql/swift/tools/src/CallGraphTo/CallGraphTo.ql +8 -14
- package/ql/swift/tools/src/ExternalPredicates.qll +14 -0
- package/ql/swift/tools/src/PrintAST/PrintAST.ql +5 -15
- package/ql/swift/tools/src/PrintCFG/PrintCFG.ql +5 -15
- package/ql/swift/tools/src/codeql-pack.lock.yml +10 -10
- package/ql/swift/tools/src/codeql-pack.yml +2 -2
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name Call Graph From To for swift
|
|
3
|
+
* @description Displays calls on reachable paths from a source function to a target function, showing transitive call graph connectivity.
|
|
4
|
+
* @id swift/tools/call-graph-from-to
|
|
5
|
+
* @kind problem
|
|
6
|
+
* @problem.severity recommendation
|
|
7
|
+
* @tags call-graph
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import swift
|
|
11
|
+
import ExternalPredicates
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Gets a single source function name from the comma-separated list.
|
|
15
|
+
*/
|
|
16
|
+
string getSourceFunctionName() {
|
|
17
|
+
exists(string s | sourceFunction(s) | result = s.splitAt(",").trim())
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Gets a single target function name from the comma-separated list.
|
|
22
|
+
*/
|
|
23
|
+
string getTargetFunctionName() {
|
|
24
|
+
exists(string s | targetFunction(s) | result = s.splitAt(",").trim())
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Gets a function by matching against the selected source function names.
|
|
29
|
+
* Supports both base names (e.g. "source") and full Swift signatures (e.g. "source()").
|
|
30
|
+
*/
|
|
31
|
+
Function getSourceFunction() {
|
|
32
|
+
exists(string selectedFunc |
|
|
33
|
+
selectedFunc = getSourceFunctionName() and
|
|
34
|
+
(result.getName() = selectedFunc or result.getName().matches(selectedFunc + "(%"))
|
|
35
|
+
)
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Gets a function by matching against the selected target function names.
|
|
40
|
+
* Supports both base names (e.g. "target") and full Swift signatures (e.g. "target()").
|
|
41
|
+
*/
|
|
42
|
+
Function getTargetFunction() {
|
|
43
|
+
exists(string selectedFunc |
|
|
44
|
+
selectedFunc = getTargetFunctionName() and
|
|
45
|
+
(result.getName() = selectedFunc or result.getName().matches(selectedFunc + "(%"))
|
|
46
|
+
)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Holds if function `caller` directly calls function `callee`.
|
|
51
|
+
*/
|
|
52
|
+
predicate calls(Function caller_, Function callee_) {
|
|
53
|
+
exists(CallExpr c |
|
|
54
|
+
c.getEnclosingFunction() = caller_ and
|
|
55
|
+
c.getStaticTarget() = callee_
|
|
56
|
+
)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Gets the name of the called function.
|
|
61
|
+
*/
|
|
62
|
+
string getCalleeName(CallExpr call) {
|
|
63
|
+
if exists(call.getStaticTarget())
|
|
64
|
+
then result = call.getStaticTarget().getName()
|
|
65
|
+
else result = call.toString()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
from CallExpr call, Function caller
|
|
69
|
+
where
|
|
70
|
+
call.getEnclosingFunction() = caller and
|
|
71
|
+
exists(Function source, Function target |
|
|
72
|
+
source = getSourceFunction() and
|
|
73
|
+
target = getTargetFunction() and
|
|
74
|
+
calls*(source, caller) and
|
|
75
|
+
exists(Function callee |
|
|
76
|
+
call.getStaticTarget() = callee and
|
|
77
|
+
calls*(callee, target)
|
|
78
|
+
)
|
|
79
|
+
)
|
|
80
|
+
select call, "Reachable call from `" + caller.getName() + "` to `" + getCalleeName(call) + "`"
|
|
@@ -8,17 +8,14 @@
|
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
import swift
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Gets the target function name for which to generate the call graph.
|
|
14
|
-
* Can be a single function name or comma-separated list of function names.
|
|
15
|
-
*/
|
|
16
|
-
external string targetFunction();
|
|
11
|
+
import ExternalPredicates
|
|
17
12
|
|
|
18
13
|
/**
|
|
19
14
|
* Gets a single target function name from the comma-separated list.
|
|
20
15
|
*/
|
|
21
|
-
string getTargetFunctionName() {
|
|
16
|
+
string getTargetFunctionName() {
|
|
17
|
+
exists(string s | targetFunction(s) | result = s.splitAt(",").trim())
|
|
18
|
+
}
|
|
22
19
|
|
|
23
20
|
/**
|
|
24
21
|
* Gets the caller name for a call expression.
|
|
@@ -38,12 +35,9 @@ string getCalleeName(CallExpr call) {
|
|
|
38
35
|
else result = call.toString()
|
|
39
36
|
}
|
|
40
37
|
|
|
41
|
-
from CallExpr call
|
|
38
|
+
from CallExpr call, string targetName
|
|
42
39
|
where
|
|
43
|
-
|
|
44
|
-
call.getStaticTarget().getName() =
|
|
45
|
-
|
|
46
|
-
// Fallback for unit tests: include specific test files
|
|
47
|
-
not exists(getTargetFunctionName()) and
|
|
48
|
-
call.getLocation().getFile().getBaseName() = "Example1.swift"
|
|
40
|
+
targetName = getTargetFunctionName() and
|
|
41
|
+
(call.getStaticTarget().getName() = targetName or
|
|
42
|
+
call.getStaticTarget().getName().matches(targetName + "(%"))
|
|
49
43
|
select call, "Call to `" + getCalleeName(call) + "` from `" + getCallerName(call) + "`"
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared extensible predicate declarations for MCP server tools queries.
|
|
3
|
+
* Values are provided via dataExtensions YAML files during testing,
|
|
4
|
+
* or via a temporary data extension pack at runtime from the MCP server.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** Holds for each source function name for call graph analysis. */
|
|
8
|
+
extensible predicate sourceFunction(string name);
|
|
9
|
+
|
|
10
|
+
/** Holds for each target function name for call graph analysis. */
|
|
11
|
+
extensible predicate targetFunction(string name);
|
|
12
|
+
|
|
13
|
+
/** Holds for each selected source file path for AST/CFG printing. */
|
|
14
|
+
extensible predicate selectedSourceFiles(string path);
|
|
@@ -7,17 +7,14 @@
|
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
import codeql.swift.printast.PrintAst
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Gets the source files to generate AST from.
|
|
13
|
-
* Can be a single file path or comma-separated list of file paths.
|
|
14
|
-
*/
|
|
15
|
-
external string selectedSourceFiles();
|
|
10
|
+
import ExternalPredicates
|
|
16
11
|
|
|
17
12
|
/**
|
|
18
13
|
* Gets a single source file from the comma-separated list.
|
|
19
14
|
*/
|
|
20
|
-
string getSelectedSourceFile() {
|
|
15
|
+
string getSelectedSourceFile() {
|
|
16
|
+
exists(string s | selectedSourceFiles(s) | result = s.splitAt(",").trim())
|
|
17
|
+
}
|
|
21
18
|
|
|
22
19
|
/**
|
|
23
20
|
* Gets a file by matching against the selected source file paths.
|
|
@@ -46,13 +43,6 @@ File getSelectedFile() {
|
|
|
46
43
|
class Cfg extends PrintAstConfiguration {
|
|
47
44
|
override predicate shouldPrint(Locatable e) {
|
|
48
45
|
super.shouldPrint(e) and
|
|
49
|
-
(
|
|
50
|
-
// Use external predicate if available
|
|
51
|
-
e.getLocation().getFile() = getSelectedFile()
|
|
52
|
-
or
|
|
53
|
-
// Fallback for unit tests: include specific test files
|
|
54
|
-
not exists(getSelectedFile()) and
|
|
55
|
-
e.getLocation().getFile().getBaseName() = "Example1.swift"
|
|
56
|
-
)
|
|
46
|
+
e.getLocation().getFile() = getSelectedFile()
|
|
57
47
|
}
|
|
58
48
|
}
|
|
@@ -8,17 +8,14 @@
|
|
|
8
8
|
|
|
9
9
|
import swift
|
|
10
10
|
import codeql.swift.controlflow.ControlFlowGraph
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Gets the source files to generate CFG from.
|
|
14
|
-
* Can be a single file path or comma-separated list of file paths.
|
|
15
|
-
*/
|
|
16
|
-
external string selectedSourceFiles();
|
|
11
|
+
import ExternalPredicates
|
|
17
12
|
|
|
18
13
|
/**
|
|
19
14
|
* Gets a single source file from the comma-separated list.
|
|
20
15
|
*/
|
|
21
|
-
string getSelectedSourceFile() {
|
|
16
|
+
string getSelectedSourceFile() {
|
|
17
|
+
exists(string s | selectedSourceFiles(s) | result = s.splitAt(",").trim())
|
|
18
|
+
}
|
|
22
19
|
|
|
23
20
|
/**
|
|
24
21
|
* Gets a file by matching against the selected source file paths.
|
|
@@ -43,14 +40,7 @@ File getSelectedFile() {
|
|
|
43
40
|
/**
|
|
44
41
|
* Holds if this CFG node should be included in output.
|
|
45
42
|
*/
|
|
46
|
-
predicate shouldPrintNode(ControlFlowNode node) {
|
|
47
|
-
// Use external predicate if available
|
|
48
|
-
node.getLocation().getFile() = getSelectedFile()
|
|
49
|
-
or
|
|
50
|
-
// Fallback for unit tests: include specific test files
|
|
51
|
-
not exists(getSelectedFile()) and
|
|
52
|
-
node.getLocation().getFile().getBaseName() = "Example1.swift"
|
|
53
|
-
}
|
|
43
|
+
predicate shouldPrintNode(ControlFlowNode node) { node.getLocation().getFile() = getSelectedFile() }
|
|
54
44
|
|
|
55
45
|
/**
|
|
56
46
|
* Configuration for PrintCFG that outputs filtered CFG nodes and edges.
|
|
@@ -2,23 +2,23 @@
|
|
|
2
2
|
lockVersion: 1.0.0
|
|
3
3
|
dependencies:
|
|
4
4
|
codeql/concepts:
|
|
5
|
-
version: 0.0.
|
|
5
|
+
version: 0.0.18
|
|
6
6
|
codeql/controlflow:
|
|
7
|
-
version: 2.0.
|
|
7
|
+
version: 2.0.28
|
|
8
8
|
codeql/dataflow:
|
|
9
|
-
version: 2.0
|
|
9
|
+
version: 2.1.0
|
|
10
10
|
codeql/mad:
|
|
11
|
-
version: 1.0.
|
|
11
|
+
version: 1.0.44
|
|
12
12
|
codeql/regex:
|
|
13
|
-
version: 1.0.
|
|
13
|
+
version: 1.0.44
|
|
14
14
|
codeql/ssa:
|
|
15
|
-
version: 2.0.
|
|
15
|
+
version: 2.0.20
|
|
16
16
|
codeql/swift-all:
|
|
17
|
-
version: 6.
|
|
17
|
+
version: 6.3.0
|
|
18
18
|
codeql/tutorial:
|
|
19
|
-
version: 1.0.
|
|
19
|
+
version: 1.0.44
|
|
20
20
|
codeql/typetracking:
|
|
21
|
-
version: 2.0.25
|
|
22
|
-
codeql/util:
|
|
23
21
|
version: 2.0.28
|
|
22
|
+
codeql/util:
|
|
23
|
+
version: 2.0.31
|
|
24
24
|
compiled: false
|