Skip to content

Commit 11a866b

Browse files
committed
ci: test custom query for util sanitizer
1 parent 0aed238 commit 11a866b

2 files changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import javascript
2+
3+
// https://codeql.github.com/docs/codeql-language-guides/analyzing-data-flow-in-javascript-and-typescript/#sanitizers
4+
// https://codeql.github.com/codeql-standard-libraries/actions/codeql/dataflow/DataFlow.qll/module.DataFlow$Configs$ConfigSig.html
5+
module UtilSanitizerConfig implements DataFlow::ConfigSig {
6+
/**
7+
* Treat calls to Util.sanitizeShellArg(...) as a barrier/sanitizer for dataflow
8+
*/
9+
predicate isBarrier(DataFlow::Node nd) {
10+
nd.(DataFlow::CallNode).getCalleeName() = "Util.sanitizeShellArg"
11+
}
12+
/** Minimal stubs required by ConfigSig (false should be no extra action). */
13+
predicate isSource(DataFlow::Node n) { false }
14+
predicate isSink(DataFlow::Node n) { false }
15+
}
16+
17+
module UtilSanitizerConfigFlow = TaintTracking::Global<UtilSanitizerConfig>;
18+
19+
from DataFlow::Node source, DataFlow::Node sink
20+
where UtilSanitizerConfigFlow::flow(source, sink)
21+
select source, sink

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
# By default, queries listed here will override any specified in a config file.
5050
# Prefix the list here with "+" to use these queries and those in the config file.
5151
# queries: ./path/to/local/query, your-org/your-repo/queries@main
52+
queries: ./.github/codeql/custom-queries-javascript/ShellSanitizer.ql
5253

5354
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5455
# If this step fails, then you should remove it and run the build manually (see below)

0 commit comments

Comments
 (0)