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.
Files changed (76) hide show
  1. package/dist/codeql-development-mcp-server.js +48111 -49526
  2. package/dist/codeql-development-mcp-server.js.map +4 -4
  3. package/package.json +9 -9
  4. package/ql/actions/tools/src/PrintCFG/PrintCFG.ql +1 -3
  5. package/ql/actions/tools/src/codeql-pack.lock.yml +14 -14
  6. package/ql/actions/tools/src/codeql-pack.yml +2 -2
  7. package/ql/cpp/tools/src/CallGraphFrom/CallGraphFrom.ql +6 -20
  8. package/ql/cpp/tools/src/CallGraphFromTo/CallGraphFromTo.md +47 -0
  9. package/ql/cpp/tools/src/CallGraphFromTo/CallGraphFromTo.ql +77 -0
  10. package/ql/cpp/tools/src/CallGraphTo/CallGraphTo.ql +6 -20
  11. package/ql/cpp/tools/src/ExternalPredicates.qll +14 -0
  12. package/ql/cpp/tools/src/PrintAST/PrintAST.ql +9 -20
  13. package/ql/cpp/tools/src/PrintCFG/PrintCFG.ql +1 -3
  14. package/ql/cpp/tools/src/codeql-pack.lock.yml +12 -12
  15. package/ql/cpp/tools/src/codeql-pack.yml +2 -2
  16. package/ql/csharp/tools/src/CallGraphFrom/CallGraphFrom.ql +4 -19
  17. package/ql/csharp/tools/src/CallGraphFromTo/CallGraphFromTo.md +49 -0
  18. package/ql/csharp/tools/src/CallGraphFromTo/CallGraphFromTo.ql +64 -0
  19. package/ql/csharp/tools/src/CallGraphTo/CallGraphTo.ql +4 -19
  20. package/ql/csharp/tools/src/ExternalPredicates.qll +14 -0
  21. package/ql/csharp/tools/src/PrintAST/PrintAST.ql +9 -17
  22. package/ql/csharp/tools/src/codeql-pack.lock.yml +10 -10
  23. package/ql/csharp/tools/src/codeql-pack.yml +2 -2
  24. package/ql/go/tools/src/CallGraphFrom/CallGraphFrom.ql +4 -19
  25. package/ql/go/tools/src/CallGraphFromTo/CallGraphFromTo.md +47 -0
  26. package/ql/go/tools/src/CallGraphFromTo/CallGraphFromTo.ql +53 -0
  27. package/ql/go/tools/src/CallGraphTo/CallGraphTo.ql +4 -20
  28. package/ql/go/tools/src/ExternalPredicates.qll +14 -0
  29. package/ql/go/tools/src/PrintAST/PrintAST.ql +132 -22
  30. package/ql/go/tools/src/codeql-pack.lock.yml +10 -10
  31. package/ql/go/tools/src/codeql-pack.yml +2 -2
  32. package/ql/java/tools/src/CallGraphFrom/CallGraphFrom.ql +4 -19
  33. package/ql/java/tools/src/CallGraphFromTo/CallGraphFromTo.md +49 -0
  34. package/ql/java/tools/src/CallGraphFromTo/CallGraphFromTo.ql +64 -0
  35. package/ql/java/tools/src/CallGraphTo/CallGraphTo.ql +4 -19
  36. package/ql/java/tools/src/ExternalPredicates.qll +14 -0
  37. package/ql/java/tools/src/PrintAST/PrintAST.ql +9 -17
  38. package/ql/java/tools/src/PrintCFG/PrintCFG.ql +11 -10
  39. package/ql/java/tools/src/codeql-pack.lock.yml +14 -14
  40. package/ql/java/tools/src/codeql-pack.yml +2 -2
  41. package/ql/javascript/tools/src/CallGraphFrom/CallGraphFrom.ql +4 -19
  42. package/ql/javascript/tools/src/CallGraphFromTo/CallGraphFromTo.md +47 -0
  43. package/ql/javascript/tools/src/CallGraphFromTo/CallGraphFromTo.ql +69 -0
  44. package/ql/javascript/tools/src/CallGraphTo/CallGraphTo.ql +4 -20
  45. package/ql/javascript/tools/src/ExternalPredicates.qll +14 -0
  46. package/ql/javascript/tools/src/PrintAST/PrintAST.ql +9 -20
  47. package/ql/javascript/tools/src/PrintCFG/PrintCFG.ql +1 -3
  48. package/ql/javascript/tools/src/codeql-pack.lock.yml +13 -13
  49. package/ql/javascript/tools/src/codeql-pack.yml +2 -2
  50. package/ql/python/tools/src/CallGraphFrom/CallGraphFrom.ql +3 -17
  51. package/ql/python/tools/src/CallGraphFromTo/CallGraphFromTo.md +46 -0
  52. package/ql/python/tools/src/CallGraphFromTo/CallGraphFromTo.ql +71 -0
  53. package/ql/python/tools/src/CallGraphTo/CallGraphTo.ql +6 -22
  54. package/ql/python/tools/src/ExternalPredicates.qll +14 -0
  55. package/ql/python/tools/src/PrintAST/PrintAST.ql +9 -20
  56. package/ql/python/tools/src/PrintCFG/PrintCFG.ql +1 -3
  57. package/ql/python/tools/src/codeql-pack.lock.yml +13 -13
  58. package/ql/python/tools/src/codeql-pack.yml +2 -2
  59. package/ql/ruby/tools/src/CallGraphFrom/CallGraphFrom.ql +4 -19
  60. package/ql/ruby/tools/src/CallGraphFromTo/CallGraphFromTo.md +48 -0
  61. package/ql/ruby/tools/src/CallGraphFromTo/CallGraphFromTo.ql +50 -0
  62. package/ql/ruby/tools/src/CallGraphTo/CallGraphTo.ql +4 -20
  63. package/ql/ruby/tools/src/ExternalPredicates.qll +14 -0
  64. package/ql/ruby/tools/src/PrintAST/PrintAST.ql +9 -17
  65. package/ql/ruby/tools/src/PrintCFG/PrintCFG.ql +1 -3
  66. package/ql/ruby/tools/src/codeql-pack.lock.yml +10 -10
  67. package/ql/ruby/tools/src/codeql-pack.yml +2 -2
  68. package/ql/swift/tools/src/CallGraphFrom/CallGraphFrom.ql +7 -16
  69. package/ql/swift/tools/src/CallGraphFromTo/CallGraphFromTo.md +47 -0
  70. package/ql/swift/tools/src/CallGraphFromTo/CallGraphFromTo.ql +80 -0
  71. package/ql/swift/tools/src/CallGraphTo/CallGraphTo.ql +8 -14
  72. package/ql/swift/tools/src/ExternalPredicates.qll +14 -0
  73. package/ql/swift/tools/src/PrintAST/PrintAST.ql +5 -15
  74. package/ql/swift/tools/src/PrintCFG/PrintCFG.ql +5 -15
  75. package/ql/swift/tools/src/codeql-pack.lock.yml +10 -10
  76. 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() { result = targetFunction().splitAt(",").trim() }
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
- // Use external predicate if available
44
- call.getStaticTarget().getName() = getTargetFunctionName()
45
- or
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() { result = selectedSourceFiles().splitAt(",").trim() }
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() { result = selectedSourceFiles().splitAt(",").trim() }
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.15
5
+ version: 0.0.18
6
6
  codeql/controlflow:
7
- version: 2.0.25
7
+ version: 2.0.28
8
8
  codeql/dataflow:
9
- version: 2.0.25
9
+ version: 2.1.0
10
10
  codeql/mad:
11
- version: 1.0.41
11
+ version: 1.0.44
12
12
  codeql/regex:
13
- version: 1.0.41
13
+ version: 1.0.44
14
14
  codeql/ssa:
15
- version: 2.0.17
15
+ version: 2.0.20
16
16
  codeql/swift-all:
17
- version: 6.2.1
17
+ version: 6.3.0
18
18
  codeql/tutorial:
19
- version: 1.0.41
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
@@ -1,6 +1,6 @@
1
1
  name: advanced-security/ql-mcp-swift-tools-src
2
- version: 2.24.3
2
+ version: 2.25.0
3
3
  description: 'Queries for codeql-development-mcp-server tools for swift language'
4
4
  library: false
5
5
  dependencies:
6
- codeql/swift-all: 6.2.1
6
+ codeql/swift-all: 6.3.0