Skip to content

Commit 10fff4e

Browse files
committed
Merge branch 'main' into rb-redosMod
2 parents 7a8e715 + d285700 commit 10fff4e

File tree

793 files changed

+85501
-67067
lines changed

Some content is hidden

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

793 files changed

+85501
-67067
lines changed

.github/workflows/compile-queries.yml

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,49 +2,51 @@ name: "Compile all queries using the latest stable CodeQL CLI"
22

33
on:
44
push:
5-
branches: [main] # makes sure the cache gets populated
6-
pull_request:
7-
branches:
5+
branches: # makes sure the cache gets populated - running on the branches people tend to merge into.
86
- main
97
- "rc/*"
8+
- "codeql-cli-*"
9+
pull_request:
1010

1111
jobs:
1212
compile-queries:
1313
runs-on: ubuntu-latest-xl
1414

1515
steps:
1616
- uses: actions/checkout@v3
17-
with:
18-
fetch-depth: 0
1917
# calculate the merge-base with main, in a way that works both on PRs and pushes to main.
2018
- name: Calculate merge-base
2119
if: ${{ github.event_name == 'pull_request' }}
2220
env:
2321
BASE_BRANCH: ${{ github.base_ref }}
2422
run: |
25-
MERGE_BASE=$(git merge-base --fork-point origin/$BASE_BRANCH)
26-
echo "merge-base=$MERGE_BASE" >> $GITHUB_ENV
27-
- name: Calculate merge-base - branch
28-
if: ${{ github.event_name != 'pull_request' }}
29-
# using github.sha instead, since we're directly on a branch, and not in a PR
30-
run: |
31-
MERGE_BASE=${{ github.sha }}
23+
MERGE_BASE=$(git cat-file commit $GITHUB_SHA | grep '^parent ' | head -1 | cut -f 2 -d " ")
3224
echo "merge-base=$MERGE_BASE" >> $GITHUB_ENV
33-
- name: Cache CodeQL query compilation
25+
- name: Read CodeQL query compilation - PR
26+
if: ${{ github.event_name == 'pull_request' }}
3427
uses: actions/cache@v3
3528
with:
3629
path: '*/ql/src/.cache'
37-
# current GH HEAD first, merge-base second, generic third
38-
key: codeql-stable-compile-${{ github.sha }}
30+
key: codeql-compile-pr-${{ github.sha }} # deliberately not using the `compile-compile-main` keys here.
3931
restore-keys: |
40-
codeql-stable-compile-${{ env.merge-base }}
41-
codeql-stable-compile-
32+
codeql-compile-${{ github.base_ref }}-${{ env.merge-base }}
33+
codeql-compile-${{ github.base_ref }}-
34+
codeql-compile-main-
35+
- name: Fill CodeQL query compilation cache - main
36+
if: ${{ github.event_name != 'pull_request' }}
37+
uses: actions/cache@v3
38+
with:
39+
path: '*/ql/src/.cache'
40+
key: codeql-compile-${{ github.ref_name }}-${{ github.sha }} # just fill on main
41+
restore-keys: | # restore from another random commit, to speed up compilation.
42+
codeql-compile-${{ github.ref_name }}-
43+
codeql-compile-main-
4244
- name: Setup CodeQL
4345
uses: ./.github/actions/fetch-codeql
4446
with:
4547
channel: 'release'
4648
- name: check formatting
47-
run: codeql query format */ql/{src,lib,test}/**/*.{qll,ql} --check-only
49+
run: find */ql -type f \( -name "*.qll" -o -name "*.ql" \) -print0 | xargs -0 codeql query format --check-only
4850
- name: compile queries - check-only
4951
# run with --check-only if running in a PR (github.sha != main)
5052
if : ${{ github.event_name == 'pull_request' }}

.github/workflows/js-ml-tests.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,6 @@ defaults:
2323
working-directory: javascript/ql/experimental/adaptivethreatmodeling
2424

2525
jobs:
26-
qlformat:
27-
name: Check QL formatting
28-
runs-on: ubuntu-latest
29-
steps:
30-
- uses: actions/checkout@v3
31-
32-
- uses: ./.github/actions/fetch-codeql
33-
34-
- name: Check QL formatting
35-
run: |
36-
find . "(" -name "*.ql" -or -name "*.qll" ")" -print0 | \
37-
xargs -0 codeql query format --check-only
38-
3926
qlcompile:
4027
name: Check QL compilation
4128
runs-on: ubuntu-latest

.github/workflows/ql-for-ql-build.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,13 @@ jobs:
2424
- uses: actions/checkout@v3
2525
- name: Find codeql
2626
id: find-codeql
27-
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
27+
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
2828
with:
2929
languages: javascript # does not matter
3030
- name: Get CodeQL version
3131
id: get-codeql-version
3232
run: |
33-
echo "::set-output name=version::$("${CODEQL}" --version | head -n 1 | rev | cut -d " " -f 1 | rev)"
33+
echo "version=$("${CODEQL}" --version | head -n 1 | rev | cut -d " " -f 1 | rev)" >> $GITHUB_OUTPUT
3434
shell: bash
3535
env:
3636
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
@@ -133,7 +133,7 @@ jobs:
133133
env:
134134
CONF: ./ql-for-ql-config.yml
135135
- name: Initialize CodeQL
136-
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
136+
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
137137
with:
138138
languages: ql
139139
db-location: ${{ runner.temp }}/db
@@ -145,7 +145,7 @@ jobs:
145145
PACK: ${{ runner.temp }}/pack
146146

147147
- name: Perform CodeQL Analysis
148-
uses: github/codeql-action/analyze@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
148+
uses: github/codeql-action/analyze@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
149149
with:
150150
category: "ql-for-ql"
151151
- name: Copy sarif file to CWD

.github/workflows/ql-for-ql-dataset_measure.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
- name: Find codeql
2727
id: find-codeql
28-
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
28+
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
2929
with:
3030
languages: javascript # does not matter
3131
- uses: actions/cache@v3

.github/workflows/ql-for-ql-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- uses: actions/checkout@v3
2323
- name: Find codeql
2424
id: find-codeql
25-
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
25+
uses: github/codeql-action/init@77a8d2d10c0b403a8b4aadbd223dc489ecd22683
2626
with:
2727
languages: javascript # does not matter
2828
- uses: actions/cache@v3

.github/workflows/ruby-qltest.yml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,6 @@ defaults:
2828
working-directory: ruby
2929

3030
jobs:
31-
qlformat:
32-
runs-on: ubuntu-latest
33-
steps:
34-
- uses: actions/checkout@v3
35-
- uses: ./.github/actions/fetch-codeql
36-
- name: Check QL formatting
37-
run: find ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 codeql query format --check-only
3831
qlcompile:
3932
runs-on: ubuntu-latest
4033
steps:

.github/workflows/swift.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,14 @@ jobs:
5151
- uses: actions/checkout@v3
5252
- uses: ./swift/actions/create-extractor-pack
5353
- uses: ./swift/actions/run-quick-tests
54+
- uses: ./swift/actions/print-unextracted
5455
build-and-test-linux:
5556
runs-on: ubuntu-20.04
5657
steps:
5758
- uses: actions/checkout@v3
5859
- uses: ./swift/actions/create-extractor-pack
5960
- uses: ./swift/actions/run-quick-tests
61+
- uses: ./swift/actions/print-unextracted
6062
qltests-linux:
6163
needs: build-and-test-linux
6264
runs-on: ubuntu-latest
@@ -110,12 +112,9 @@ jobs:
110112
with:
111113
name: swift-generated-cpp-files
112114
path: swift/generated-cpp-files/**
113-
qlformat:
115+
database-upgrade-scripts:
114116
runs-on: ubuntu-latest
115-
needs: changes
116-
if: ${{ needs.changes.outputs.ql == 'true' }}
117117
steps:
118118
- uses: actions/checkout@v3
119119
- uses: ./.github/actions/fetch-codeql
120-
- name: Check QL formatting
121-
run: find swift/ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 codeql query format --check-only
120+
- uses: ./swift/actions/database-upgrade-scripts

config/identical-files.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,8 @@
9494
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/rangeanalysis/SsaReadPositionCommon.qll"
9595
],
9696
"Model as Data Generation Java/C# - CaptureModels": [
97-
"java/ql/src/utils/model-generator/internal/CaptureModels.qll",
98-
"csharp/ql/src/utils/model-generator/internal/CaptureModels.qll"
97+
"java/ql/src/utils/modelgenerator/internal/CaptureModels.qll",
98+
"csharp/ql/src/utils/modelgenerator/internal/CaptureModels.qll"
9999
],
100100
"Sign Java/C#": [
101101
"java/ql/lib/semmle/code/java/dataflow/internal/rangeanalysis/Sign.qll",

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ module Consistency {
136136
msg = "Local flow step does not preserve enclosing callable."
137137
}
138138

139+
query predicate readStepIsLocal(Node n1, Node n2, string msg) {
140+
readStep(n1, _, n2) and
141+
nodeGetEnclosingCallable(n1) != nodeGetEnclosingCallable(n2) and
142+
msg = "Read step does not preserve enclosing callable."
143+
}
144+
145+
query predicate storeStepIsLocal(Node n1, Node n2, string msg) {
146+
storeStep(n1, _, n2) and
147+
nodeGetEnclosingCallable(n1) != nodeGetEnclosingCallable(n2) and
148+
msg = "Store step does not preserve enclosing callable."
149+
}
150+
139151
private DataFlowType typeRepr() { result = getNodeType(_) }
140152

141153
query predicate compatibleTypesReflexive(DataFlowType t, string msg) {

cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,18 @@ module Consistency {
136136
msg = "Local flow step does not preserve enclosing callable."
137137
}
138138

139+
query predicate readStepIsLocal(Node n1, Node n2, string msg) {
140+
readStep(n1, _, n2) and
141+
nodeGetEnclosingCallable(n1) != nodeGetEnclosingCallable(n2) and
142+
msg = "Read step does not preserve enclosing callable."
143+
}
144+
145+
query predicate storeStepIsLocal(Node n1, Node n2, string msg) {
146+
storeStep(n1, _, n2) and
147+
nodeGetEnclosingCallable(n1) != nodeGetEnclosingCallable(n2) and
148+
msg = "Store step does not preserve enclosing callable."
149+
}
150+
139151
private DataFlowType typeRepr() { result = getNodeType(_) }
140152

141153
query predicate compatibleTypesReflexive(DataFlowType t, string msg) {

0 commit comments

Comments
 (0)