Skip to content

Commit 880548b

Browse files
committed
Merge branch 'main' into tiferet/boost-xss-through-dom
2 parents 50a3c0d + 2976daa commit 880548b

File tree

159 files changed

+24097
-4473
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

159 files changed

+24097
-4473
lines changed

.github/actions/cache-query-compilation/action.yml

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,23 +14,42 @@ outputs:
1414
runs:
1515
using: composite
1616
steps:
17-
- name: Cache the query compilation caches
18-
uses: ./.github/actions/incremental-cache
17+
# calculate the merge-base with main, in a way that works both on PRs and pushes to main.
18+
- name: Calculate merge-base
19+
shell: bash
20+
if: ${{ github.event_name == 'pull_request' }}
21+
env:
22+
BASE_BRANCH: ${{ github.base_ref }}
23+
run: |
24+
MERGE_BASE=$(git cat-file commit $GITHUB_SHA | grep '^parent ' | head -1 | cut -f 2 -d " ")
25+
echo "merge_base=$MERGE_BASE" >> $GITHUB_ENV
26+
- name: Restore read-only cache (PR)
27+
if: ${{ github.event_name == 'pull_request' }}
28+
uses: erik-krogh/actions-cache@a88d0603fe5fb5606db9f002dfcadeb32b5f84c6
29+
with:
30+
path: '**/.cache'
31+
read-only: true
32+
key: codeql-compile-${{ inputs.key }}-pr-${{ github.sha }}
33+
restore-keys: |
34+
codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-${{ env.merge_base }}
35+
codeql-compile-${{ inputs.key }}-${{ github.base_ref }}-
36+
codeql-compile-${{ inputs.key }}-main-
37+
- name: Fill cache (push)
38+
if: ${{ github.event_name != 'pull_request' }}
39+
uses: erik-krogh/actions-cache@a88d0603fe5fb5606db9f002dfcadeb32b5f84c6
1940
with:
2041
path: '**/.cache'
21-
key: codeql-compile-${{ inputs.key }}
42+
key: codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-${{ github.sha }} # just fill on main
43+
restore-keys: | # restore the latest cache if the exact cache is unavailable, to speed up compilation.
44+
codeql-compile-${{ inputs.key }}-${{ github.ref_name }}-
45+
codeql-compile-${{ inputs.key }}-main-
2246
- name: Fill compilation cache directory
2347
id: fill-compilation-dir
2448
shell: bash
2549
run: |
2650
# Move all the existing cache into another folder, so we only preserve the cache for the current queries.
27-
mkdir -p ${COMBINED_CACHE_DIR}
28-
rm -f **/.cache/{lock,size} # -f to avoid errors if the cache is empty.
29-
# copy the contents of the .cache folders into the combined cache folder.
30-
cp -r **/.cache/* ${COMBINED_CACHE_DIR}/ || : # ignore missing files
31-
# clean up the .cache folders
32-
rm -rf **/.cache/*
51+
node $GITHUB_WORKSPACE/.github/actions/cache-query-compilation/move-caches.js ${COMBINED_CACHE_DIR}
3352
3453
echo "compdir=${COMBINED_CACHE_DIR}" >> $GITHUB_OUTPUT
3554
env:
36-
COMBINED_CACHE_DIR: ${{ github.workspace }}/compilation-dir
55+
COMBINED_CACHE_DIR: ${{ runner.temp }}/compilation-dir
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// # Move all the existing cache into another folder, so we only preserve the cache for the current queries.
2+
// mkdir -p ${COMBINED_CACHE_DIR}
3+
// rm -f **/.cache/{lock,size} # -f to avoid errors if the cache is empty.
4+
// # copy the contents of the .cache folders into the combined cache folder.
5+
// cp -r **/.cache/* ${COMBINED_CACHE_DIR}/ || : # ignore missing files
6+
// # clean up the .cache folders
7+
// rm -rf **/.cache/*
8+
9+
const fs = require("fs");
10+
const path = require("path");
11+
12+
// the first argv is the cache folder to create.
13+
const COMBINED_CACHE_DIR = process.argv[2];
14+
15+
function* walkCaches(dir) {
16+
const files = fs.readdirSync(dir, { withFileTypes: true });
17+
for (const file of files) {
18+
if (file.isDirectory()) {
19+
const filePath = path.join(dir, file.name);
20+
yield* walkCaches(filePath);
21+
if (file.name === ".cache") {
22+
yield filePath;
23+
}
24+
}
25+
}
26+
}
27+
28+
async function copyDir(src, dest) {
29+
for await (const file of await fs.promises.readdir(src, { withFileTypes: true })) {
30+
const srcPath = path.join(src, file.name);
31+
const destPath = path.join(dest, file.name);
32+
if (file.isDirectory()) {
33+
if (!fs.existsSync(destPath)) {
34+
fs.mkdirSync(destPath);
35+
}
36+
await copyDir(srcPath, destPath);
37+
} else {
38+
await fs.promises.copyFile(srcPath, destPath);
39+
}
40+
}
41+
}
42+
43+
async function main() {
44+
const cacheDirs = [...walkCaches(".")];
45+
46+
for (const dir of cacheDirs) {
47+
console.log(`Found .cache dir at ${dir}`);
48+
}
49+
50+
// mkdir -p ${COMBINED_CACHE_DIR}
51+
fs.mkdirSync(COMBINED_CACHE_DIR, { recursive: true });
52+
53+
// rm -f **/.cache/{lock,size} # -f to avoid errors if the cache is empty.
54+
await Promise.all(
55+
cacheDirs.map((cacheDir) =>
56+
(async function () {
57+
await fs.promises.rm(path.join(cacheDir, "lock"), { force: true });
58+
await fs.promises.rm(path.join(cacheDir, "size"), { force: true });
59+
})()
60+
)
61+
);
62+
63+
// # copy the contents of the .cache folders into the combined cache folder.
64+
// cp -r **/.cache/* ${COMBINED_CACHE_DIR}/ || : # ignore missing files
65+
await Promise.all(
66+
cacheDirs.map((cacheDir) => copyDir(cacheDir, COMBINED_CACHE_DIR))
67+
);
68+
69+
// # clean up the .cache folders
70+
// rm -rf **/.cache/*
71+
await Promise.all(
72+
cacheDirs.map((cacheDir) => fs.promises.rm(cacheDir, { recursive: true }))
73+
);
74+
}
75+
main();

.github/actions/incremental-cache/action.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

.github/workflows/compile-queries.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,5 +35,3 @@ jobs:
3535
if : ${{ github.event_name != 'pull_request' }}
3636
shell: bash
3737
run: codeql query compile -j0 */ql/{src,examples} --keep-going --warnings=error --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
38-
env:
39-
COMBINED_CACHE_DIR: ${{ github.workspace }}/compilation-dir

CODEOWNERS

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,6 @@
1212
# ML-powered queries
1313
/javascript/ql/experimental/adaptivethreatmodeling/ @github/codeql-ml-powered-queries-reviewers
1414

15-
# Notify members of codeql-go about PRs to the shared data-flow library files
16-
/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll @github/codeql-java @github/codeql-go
17-
/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl2.qll @github/codeql-java @github/codeql-go
18-
/java/ql/src/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll @github/codeql-java @github/codeql-go
19-
/java/ql/src/semmle/code/java/dataflow/internal/tainttracking1/TaintTrackingImpl.qll @github/codeql-java @github/codeql-go
20-
/java/ql/src/semmle/code/java/dataflow/internal/tainttracking2/TaintTrackingImpl.qll @github/codeql-java @github/codeql-go
21-
2215
# CodeQL tools and associated docs
2316
/docs/codeql/codeql-cli/ @github/codeql-cli-reviewers
2417
/docs/codeql/codeql-for-visual-studio-code/ @github/codeql-vscode-reviewers

config/identical-files.json

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"DataFlow Java/C++/C#/Python": [
2+
"DataFlow Java/C++/C#/Go/Python/Ruby/Swift": [
33
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl.qll",
44
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl2.qll",
55
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl3.qll",
@@ -27,6 +27,8 @@
2727
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl4.qll",
2828
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl5.qll",
2929
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplForContentDataFlow.qll",
30+
"go/ql/lib/semmle/go/dataflow/internal/DataFlowImpl.qll",
31+
"go/ql/lib/semmle/go/dataflow/internal/DataFlowImpl2.qll",
3032
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl.qll",
3133
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl2.qll",
3234
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl3.qll",
@@ -38,17 +40,18 @@
3840
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplForPathname.qll",
3941
"swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImpl.qll"
4042
],
41-
"DataFlow Java/C++/C#/Python Common": [
43+
"DataFlow Java/C++/C#/Go/Python/Ruby/Swift Common": [
4244
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll",
4345
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll",
4446
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll",
4547
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll",
4648
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplCommon.qll",
49+
"go/ql/lib/semmle/go/dataflow/internal/DataFlowImplCommon.qll",
4750
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplCommon.qll",
4851
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplCommon.qll",
4952
"swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplCommon.qll"
5053
],
51-
"TaintTracking::Configuration Java/C++/C#/Python": [
54+
"TaintTracking::Configuration Java/C++/C#/Go/Python/Ruby/Swift": [
5255
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
5356
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
5457
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
@@ -62,6 +65,8 @@
6265
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
6366
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/tainttracking4/TaintTrackingImpl.qll",
6467
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/tainttracking5/TaintTrackingImpl.qll",
68+
"go/ql/lib/semmle/go/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
69+
"go/ql/lib/semmle/go/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
6570
"java/ql/lib/semmle/code/java/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
6671
"java/ql/lib/semmle/code/java/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
6772
"java/ql/lib/semmle/code/java/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
@@ -72,7 +77,7 @@
7277
"ruby/ql/lib/codeql/ruby/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
7378
"swift/ql/lib/codeql/swift/dataflow/internal/tainttracking1/TaintTrackingImpl.qll"
7479
],
75-
"DataFlow Java/C++/C#/Python Consistency checks": [
80+
"DataFlow Java/C++/C#/Python/Ruby/Swift Consistency checks": [
7681
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll",
7782
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll",
7883
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll",
@@ -82,9 +87,10 @@
8287
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll",
8388
"swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplConsistency.qll"
8489
],
85-
"DataFlow Java/C#/Ruby/Python/Swift Flow Summaries": [
90+
"DataFlow Java/C#/Go/Ruby/Python/Swift Flow Summaries": [
8691
"java/ql/lib/semmle/code/java/dataflow/internal/FlowSummaryImpl.qll",
8792
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/FlowSummaryImpl.qll",
93+
"go/ql/lib/semmle/go/dataflow/internal/FlowSummaryImpl.qll",
8894
"ruby/ql/lib/codeql/ruby/dataflow/internal/FlowSummaryImpl.qll",
8995
"python/ql/lib/semmle/python/dataflow/new/internal/FlowSummaryImpl.qll",
9096
"swift/ql/lib/codeql/swift/dataflow/internal/FlowSummaryImpl.qll"
@@ -505,6 +511,7 @@
505511
],
506512
"AccessPathSyntax": [
507513
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/AccessPathSyntax.qll",
514+
"go/ql/lib/semmle/go/dataflow/internal/AccessPathSyntax.qll",
508515
"java/ql/lib/semmle/code/java/dataflow/internal/AccessPathSyntax.qll",
509516
"javascript/ql/lib/semmle/javascript/frameworks/data/internal/AccessPathSyntax.qll",
510517
"ruby/ql/lib/codeql/ruby/dataflow/internal/AccessPathSyntax.qll",

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ abstract class Configuration extends string {
7070
/**
7171
* Holds if `sink` is a relevant data flow sink accepting `state`.
7272
*/
73-
predicate isSink(Node source, FlowState state) { none() }
73+
predicate isSink(Node sink, FlowState state) { none() }
7474

7575
/**
7676
* Holds if data flow through `node` is prohibited. This completely removes

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ abstract class Configuration extends string {
7070
/**
7171
* Holds if `sink` is a relevant data flow sink accepting `state`.
7272
*/
73-
predicate isSink(Node source, FlowState state) { none() }
73+
predicate isSink(Node sink, FlowState state) { none() }
7474

7575
/**
7676
* Holds if data flow through `node` is prohibited. This completely removes

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ abstract class Configuration extends string {
7070
/**
7171
* Holds if `sink` is a relevant data flow sink accepting `state`.
7272
*/
73-
predicate isSink(Node source, FlowState state) { none() }
73+
predicate isSink(Node sink, FlowState state) { none() }
7474

7575
/**
7676
* Holds if data flow through `node` is prohibited. This completely removes

cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ abstract class Configuration extends string {
7070
/**
7171
* Holds if `sink` is a relevant data flow sink accepting `state`.
7272
*/
73-
predicate isSink(Node source, FlowState state) { none() }
73+
predicate isSink(Node sink, FlowState state) { none() }
7474

7575
/**
7676
* Holds if data flow through `node` is prohibited. This completely removes

0 commit comments

Comments
 (0)