Skip to content

Commit d14f84e

Browse files
committed
Fixes for actions workflow failures 3
Fixes to templates used to generate new queries languages such as: - cpp - csharp - go - java - ruby
1 parent dd0680d commit d14f84e

File tree

10 files changed

+77
-37
lines changed

10 files changed

+77
-37
lines changed

.github/workflows/internal-validate-cli-outputs.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,19 @@ jobs:
4545
# Copy configuration file
4646
cp example/qlt.conf.json "$TEST_DIR"
4747
48-
- name: Install `codeql` CLI via CodeQLToolkit
49-
run: dotnet run --project src/CodeQLToolkit.Core -- codeql run install --base "$TEST_DIR"
48+
## Using the 'latest' version of the `codeql` CLI may eventually
49+
## cause issues, where the `qlt.conf.json` file specifies an exact
50+
## version of the CLI. For now, we live with the risk, and the issues
51+
## surfaced might actually be useful to identify emerging problems
52+
## in the `codeql` CLI -- which is only required here for extra
53+
## debugging of any queries with test failures.
54+
- name: Install `codeql` CLI
55+
id: install-codeql
56+
uses: ./.github/actions/install-codeql
57+
with:
58+
add-to-path: 'true'
59+
codeql-cli-version: 'latest'
60+
codeql-stdlib-version: 'latest'
5061

5162
- name: Run end-to-end CLI validation
5263
run: ./scripts/validate-cli-e2e.sh

src/CodeQLToolkit.Features/Templates/Query/cpp/new-dataflow-query.liquid

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,23 @@
99
*/
1010

1111
import cpp
12-
import semmle.code.cpp.dataflow.TaintTracking
13-
import DataFlow::PathGraph
12+
import semmle.code.cpp.ir.dataflow.TaintTracking
13+
import Flow::PathGraph
1414

15-
class Config extends TaintTracking::Configuration {
16-
Config() { this = "{{query_name}}" }
17-
18-
override predicate isSource(DataFlow::Node source) {
15+
module Config implements DataFlow::ConfigSig {
16+
predicate isSource(DataFlow::Node source) {
1917
// Define your sources here
2018
none()
2119
}
2220

23-
override predicate isSink(DataFlow::Node sink) {
21+
predicate isSink(DataFlow::Node sink) {
2422
// Define your sinks here
2523
none()
2624
}
2725
}
2826

29-
from Config config, DataFlow::PathNode source, DataFlow::PathNode sink
30-
where config.hasFlowPath(source, sink)
27+
module Flow = TaintTracking::Global<Config>;
28+
29+
from Flow::PathNode source, Flow::PathNode sink
30+
where Flow::flowPath(source, sink)
3131
select sink.getNode(), source, sink, "Replace this with your dataflow query."

src/CodeQLToolkit.Features/Templates/Query/csharp/new-dataflow-query.liquid

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
* @tags {{query_pack_name}}
99
*/
1010

11-
import {{ql_language_import}}
12-
import semmle.code.{{ql_language_import}}.dataflow.TaintTracking
13-
import DataFlow::PathGraph
11+
import csharp
1412

1513
module Config implements DataFlow::ConfigSig {
1614
predicate isSource(DataFlow::Node source) {
@@ -24,7 +22,8 @@ module Config implements DataFlow::ConfigSig {
2422
}
2523
}
2624

27-
module Flow = TaintTracking::Global<Config>;
25+
module Flow = DataFlow::Global<Config>;
26+
import Flow::PathGraph
2827

2928
from Flow::PathNode source, Flow::PathNode sink
3029
where Flow::flowPath(source, sink)

src/CodeQLToolkit.Features/Templates/Query/csharp/new-query.liquid

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @tags {{query_pack_name}}
99
*/
1010

11-
import {{ql_language_import}}
11+
import csharp
1212

13-
from File f
14-
select f, "Replace this with your query."
13+
from Expr e
14+
select e, "Replace this with your query."

src/CodeQLToolkit.Features/Templates/Query/go/new-dataflow-query.liquid

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
* @tags {{query_pack_name}}
99
*/
1010

11-
import {{ql_language_import}}
12-
import semmle.code.{{ql_language_import}}.dataflow.TaintTracking
13-
import DataFlow::PathGraph
11+
import go
1412

1513
module Config implements DataFlow::ConfigSig {
1614
predicate isSource(DataFlow::Node source) {
@@ -24,7 +22,8 @@ module Config implements DataFlow::ConfigSig {
2422
}
2523
}
2624

27-
module Flow = TaintTracking::Global<Config>;
25+
module Flow = DataFlow::Global<Config>;
26+
import Flow::PathGraph
2827

2928
from Flow::PathNode source, Flow::PathNode sink
3029
where Flow::flowPath(source, sink)

src/CodeQLToolkit.Features/Templates/Query/go/new-query.liquid

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,22 @@
88
* @tags {{query_pack_name}}
99
*/
1010

11-
import {{ql_language_import}}
11+
import go
1212

13-
from File f
14-
select f, "Replace this with your query."
13+
module Config implements DataFlow::ConfigSig {
14+
predicate isSource(DataFlow::Node source) {
15+
// Define your sources here
16+
none()
17+
}
18+
19+
predicate isSink(DataFlow::Node sink) {
20+
// Define your sinks here
21+
none()
22+
}
23+
}
24+
25+
module Flow = DataFlow::Global<Config>;
26+
27+
from DataFlow::Node source, string msg
28+
where Flow::flow(source, _) and msg = "Replace this with your query."
29+
select source, msg

src/CodeQLToolkit.Features/Templates/Query/java/new-dataflow-query.liquid

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
* @tags {{query_pack_name}}
99
*/
1010

11-
import {{ql_language_import}}
12-
import semmle.code.{{ql_language_import}}.dataflow.TaintTracking
13-
import DataFlow::PathGraph
11+
import java
12+
import semmle.code.java.dataflow.DataFlow
1413

1514
module Config implements DataFlow::ConfigSig {
1615
predicate isSource(DataFlow::Node node) {
@@ -24,7 +23,8 @@ module Config implements DataFlow::ConfigSig {
2423
}
2524
}
2625

27-
module Flow = TaintTracking::Global<Config>;
26+
module Flow = DataFlow::Global<Config>;
27+
import Flow::PathGraph
2828

2929
from Flow::PathNode source, Flow::PathNode sink
3030
where Flow::flowPath(source, sink)

src/CodeQLToolkit.Features/Templates/Query/java/new-query.liquid

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,23 @@
88
* @tags {{query_pack_name}}
99
*/
1010

11-
import {{ql_language_import}}
11+
import java
12+
import semmle.code.java.dataflow.DataFlow
1213

13-
from Expr e
14-
select e, "Replace this with your query."
14+
module Config implements DataFlow::ConfigSig {
15+
predicate isSource(DataFlow::Node source) {
16+
// Define your sources here
17+
none()
18+
}
19+
20+
predicate isSink(DataFlow::Node sink) {
21+
// Define your sinks here
22+
none()
23+
}
24+
}
25+
26+
module Flow = DataFlow::Global<Config>;
27+
28+
from DataFlow::Node source, string msg
29+
where Flow::flow(source, _) and msg = "Replace this with your query."
30+
select source, msg

src/CodeQLToolkit.Features/Templates/Query/ruby/new-dataflow-query.liquid

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
* @tags {{query_pack_name}}
99
*/
1010

11-
import {{ql_language_import}}
12-
import codeql.ruby.TaintTracking
13-
import DataFlow::PathGraph
11+
import codeql.ruby.AST
12+
import codeql.ruby.DataFlow
1413

1514
module Config implements DataFlow::ConfigSig {
1615
predicate isSource(DataFlow::Node node) {
@@ -24,7 +23,8 @@ module Config implements DataFlow::ConfigSig {
2423
}
2524
}
2625

27-
module Flow = TaintTracking::Global<Config>;
26+
module Flow = DataFlow::Global<Config>;
27+
import Flow::PathGraph
2828

2929
from Flow::PathNode source, Flow::PathNode sink
3030
where Flow::flowPath(source, sink)

src/CodeQLToolkit.Features/Templates/Query/ruby/new-query.liquid

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @tags {{query_pack_name}}
99
*/
1010

11-
import {{ql_language_import}}
11+
import codeql.ruby.AST
1212

1313
from File f
1414
select f, "Replace this with your query."

0 commit comments

Comments
 (0)