Skip to content

Commit 1f43a1a

Browse files
committed
Merge branch 'replace-ast-with-ir-use-usedataflow' into merge-some-indirect-and-instruction-nodes
2 parents 0c7f57e + a270f31 commit 1f43a1a

File tree

582 files changed

+66237
-60286
lines changed

Some content is hidden

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

582 files changed

+66237
-60286
lines changed

.github/workflows/compile-queries.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,25 @@ 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)
23+
MERGE_BASE=$(git cat-file commit $GITHUB_SHA | grep '^parent ' | head -1 | cut -f 2 -d " ")
2624
echo "merge-base=$MERGE_BASE" >> $GITHUB_ENV
2725
- name: Read CodeQL query compilation - PR
2826
if: ${{ github.event_name == 'pull_request' }}
@@ -31,20 +29,24 @@ jobs:
3129
path: '*/ql/src/.cache'
3230
key: codeql-compile-pr-${{ github.sha }} # deliberately not using the `compile-compile-main` keys here.
3331
restore-keys: |
34-
codeql-compile-main-${{ env.merge-base }}
32+
codeql-compile-${{ github.base_ref }}-${{ env.merge-base }}
33+
codeql-compile-${{ github.base_ref }}-
3534
codeql-compile-main-
3635
- name: Fill CodeQL query compilation cache - main
3736
if: ${{ github.event_name != 'pull_request' }}
3837
uses: actions/cache@v3
3938
with:
4039
path: '*/ql/src/.cache'
41-
key: codeql-compile-main-${{ github.sha }} # just fill on main
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: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,4 @@ jobs:
111111
- uses: actions/upload-artifact@v3
112112
with:
113113
name: swift-generated-cpp-files
114-
path: swift/generated-cpp-files/**
115-
qlformat:
116-
runs-on: ubuntu-latest
117-
needs: changes
118-
if: ${{ needs.changes.outputs.ql == 'true' }}
119-
steps:
120-
- uses: actions/checkout@v3
121-
- uses: ./.github/actions/fetch-codeql
122-
- name: Check QL formatting
123-
run: find swift/ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 codeql query format --check-only
114+
path: swift/generated-cpp-files/**

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/old/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)