Skip to content

Commit 2121ed7

Browse files
authored
Merge branch 'main' into python/rewrite-InsecureContextConfiguration
2 parents 3c407ea + 6b26510 commit 2121ed7

File tree

2,921 files changed

+113372
-53181
lines changed

Some content is hidden

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

2,921 files changed

+113372
-53181
lines changed

.git-blame-ignore-revs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# .git-blame-ignore-revs
2+
# Auto-formatted Java
3+
730eae952139209fe9fdf598541d608f4c0c0c84
4+
# Auto-formatted C#
5+
5ad7ed49dd3de03ec6dcfcb6848758a6a987e11c
6+
# Auto-formatted C/C++
7+
ef97e539ec1971494d4bba5cafe82e00bc8217ac
8+
# Auto-formatted Python
9+
21d5fa836b3a7d020ba45e8b8168b145a9772131
10+
# Auto-formatted JavaScript
11+
8d97fe9ed327a9546ff2eaf515cf0f5214deddd9
12+
# Auto-formatted Ruby
13+
a5d229903d2f12d45f2c2c38822f1d0e7504ae7f
14+
# Auto-formatted Go
15+
08c658e66bf867090033ea096e244a93d46c0aa7
16+
# Auto-formatted Swift
17+
711d7057f79fb7d72fc3b35e010bd018f9009169
18+
# Auto-formatted shared ql packs
19+
3640b6d3a8ce9edf8e1d3ed106fe8526cf255bc0
20+
# Auto-formatted taint tracking files
21+
159d8e978c51959b380838c080d891b66e763b19

.github/workflows/check-change-note.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
- "*/ql/src/**/*.qll"
99
- "*/ql/lib/**/*.ql"
1010
- "*/ql/lib/**/*.qll"
11+
- "*/ql/lib/**/*.yml"
1112
- "!**/experimental/**"
1213
- "!ql/**"
1314
- "!swift/**"

.github/workflows/close-stale.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
runs-on: ubuntu-latest
1313

1414
steps:
15-
- uses: actions/stale@v7
15+
- uses: actions/stale@v8
1616
with:
1717
repo-token: ${{ secrets.GITHUB_TOKEN }}
1818
stale-issue-message: 'This issue is stale because it has been open 14 days with no activity. Comment or remove the `Stale` label in order to avoid having this issue closed in 7 days.'

.github/workflows/go-tests-other-os.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
runs-on: macos-latest
1414
steps:
1515
- name: Set up Go 1.20
16-
uses: actions/setup-go@v3
16+
uses: actions/setup-go@v4
1717
with:
1818
go-version: 1.20.0
1919
id: go
@@ -48,7 +48,7 @@ jobs:
4848
runs-on: windows-latest-xl
4949
steps:
5050
- name: Set up Go 1.20
51-
uses: actions/setup-go@v3
51+
uses: actions/setup-go@v4
5252
with:
5353
go-version: 1.20.0
5454
id: go

.github/workflows/go-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
runs-on: ubuntu-latest-xl
2222
steps:
2323
- name: Set up Go 1.20
24-
uses: actions/setup-go@v3
24+
uses: actions/setup-go@v4
2525
with:
2626
go-version: 1.20.0
2727
id: go

.github/workflows/ruby-build.yml

Lines changed: 93 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,42 +48,50 @@ jobs:
4848
run: |
4949
brew install gnu-tar
5050
echo "/usr/local/opt/gnu-tar/libexec/gnubin" >> $GITHUB_PATH
51+
- name: Install cargo-cross
52+
if: runner.os == 'Linux'
53+
run: cargo install cross --version 0.2.1
5154
- uses: ./.github/actions/os-version
5255
id: os_version
5356
- name: Cache entire extractor
5457
uses: actions/cache@v3
5558
id: cache-extractor
5659
with:
5760
path: |
58-
ruby/target/release/ruby-autobuilder
59-
ruby/target/release/ruby-autobuilder.exe
60-
ruby/target/release/ruby-extractor
61-
ruby/target/release/ruby-extractor.exe
62-
ruby/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
63-
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-extractor-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}--${{ hashFiles('ruby/**/*.rs') }}
61+
ruby/extractor/target/release/autobuilder
62+
ruby/extractor/target/release/autobuilder.exe
63+
ruby/extractor/target/release/extractor
64+
ruby/extractor/target/release/extractor.exe
65+
ruby/extractor/ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
66+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-extractor-${{ hashFiles('ruby/extractor/rust-toolchain.toml', 'ruby/extractor/Cargo.lock') }}--${{ hashFiles('ruby/extractor/**/*.rs') }}
6467
- uses: actions/cache@v3
6568
if: steps.cache-extractor.outputs.cache-hit != 'true'
6669
with:
6770
path: |
6871
~/.cargo/registry
6972
~/.cargo/git
7073
ruby/target
71-
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-rust-cargo-${{ hashFiles('ruby/rust-toolchain.toml', 'ruby/**/Cargo.lock') }}
74+
key: ${{ runner.os }}-${{ steps.os_version.outputs.version }}-ruby-rust-cargo-${{ hashFiles('ruby/extractor/rust-toolchain.toml', 'ruby/extractor/**/Cargo.lock') }}
7275
- name: Check formatting
7376
if: steps.cache-extractor.outputs.cache-hit != 'true'
74-
run: cargo fmt --all -- --check
77+
run: cd extractor && cargo fmt --all -- --check
7578
- name: Build
7679
if: steps.cache-extractor.outputs.cache-hit != 'true'
77-
run: cargo build --verbose
80+
run: cd extractor && cargo build --verbose
7881
- name: Run tests
7982
if: steps.cache-extractor.outputs.cache-hit != 'true'
80-
run: cargo test --verbose
81-
- name: Release build
82-
if: steps.cache-extractor.outputs.cache-hit != 'true'
83-
run: cargo build --release
83+
run: cd extractor && cargo test --verbose
84+
# On linux, build the extractor via cross in a centos7 container.
85+
# This ensures we don't depend on glibc > 2.17.
86+
- name: Release build (linux)
87+
if: steps.cache-extractor.outputs.cache-hit != 'true' && runner.os == 'Linux'
88+
run: cd extractor && cross build --release
89+
- name: Release build (windows and macos)
90+
if: steps.cache-extractor.outputs.cache-hit != 'true' && runner.os != 'Linux'
91+
run: cd extractor && cargo build --release
8492
- name: Generate dbscheme
8593
if: ${{ matrix.os == 'ubuntu-latest' && steps.cache-extractor.outputs.cache-hit != 'true'}}
86-
run: target/release/ruby-generator --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
94+
run: extractor/target/release/generator --dbscheme ql/lib/ruby.dbscheme --library ql/lib/codeql/ruby/ast/internal/TreeSitter.qll
8795
- uses: actions/upload-artifact@v3
8896
if: ${{ matrix.os == 'ubuntu-latest' }}
8997
with:
@@ -98,10 +106,10 @@ jobs:
98106
with:
99107
name: extractor-${{ matrix.os }}
100108
path: |
101-
ruby/target/release/ruby-autobuilder
102-
ruby/target/release/ruby-autobuilder.exe
103-
ruby/target/release/ruby-extractor
104-
ruby/target/release/ruby-extractor.exe
109+
ruby/extractor/target/release/autobuilder
110+
ruby/extractor/target/release/autobuilder.exe
111+
ruby/extractor/target/release/extractor
112+
ruby/extractor/target/release/extractor.exe
105113
retention-days: 1
106114
compile-queries:
107115
runs-on: ubuntu-latest-xl
@@ -116,21 +124,22 @@ jobs:
116124
key: ruby-build
117125
- name: Build Query Pack
118126
run: |
119-
rm -rf target/packs
120-
codeql pack create ../misc/suite-helpers --output target/packs
121-
codeql pack create ../shared/regex --output target/packs
122-
codeql pack create ../shared/ssa --output target/packs
123-
codeql pack create ../shared/tutorial --output target/packs
124-
codeql pack create ql/lib --output target/packs
125-
codeql pack create -j0 ql/src --output target/packs --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
126-
PACK_FOLDER=$(readlink -f target/packs/codeql/ruby-queries/*)
127+
PACKS=${{ runner.temp }}/query-packs
128+
rm -rf $PACKS
129+
codeql pack create ../misc/suite-helpers --output "$PACKS"
130+
codeql pack create ../shared/regex --output "$PACKS"
131+
codeql pack create ../shared/ssa --output "$PACKS"
132+
codeql pack create ../shared/tutorial --output "$PACKS"
133+
codeql pack create ql/lib --output "$PACKS"
134+
codeql pack create -j0 ql/src --output "$PACKS" --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
135+
PACK_FOLDER=$(readlink -f "$PACKS"/codeql/ruby-queries/*)
127136
codeql generate query-help --format=sarifv2.1.0 --output="${PACK_FOLDER}/rules.sarif" ql/src
128137
(cd ql/src; find queries \( -name '*.qhelp' -o -name '*.rb' -o -name '*.erb' \) -exec bash -c 'mkdir -p "'"${PACK_FOLDER}"'/$(dirname "{}")"' \; -exec cp "{}" "${PACK_FOLDER}/{}" \;)
129138
- uses: actions/upload-artifact@v3
130139
with:
131140
name: codeql-ruby-queries
132141
path: |
133-
ruby/target/packs/*
142+
${{ runner.temp }}/query-packs/*
134143
retention-days: 1
135144

136145
package:
@@ -158,12 +167,12 @@ jobs:
158167
mkdir -p ruby
159168
cp -r codeql-extractor.yml tools ql/lib/ruby.dbscheme.stats ruby/
160169
mkdir -p ruby/tools/{linux64,osx64,win64}
161-
cp linux64/ruby-autobuilder ruby/tools/linux64/autobuilder
162-
cp osx64/ruby-autobuilder ruby/tools/osx64/autobuilder
163-
cp win64/ruby-autobuilder.exe ruby/tools/win64/autobuilder.exe
164-
cp linux64/ruby-extractor ruby/tools/linux64/extractor
165-
cp osx64/ruby-extractor ruby/tools/osx64/extractor
166-
cp win64/ruby-extractor.exe ruby/tools/win64/extractor.exe
170+
cp linux64/autobuilder ruby/tools/linux64/autobuilder
171+
cp osx64/autobuilder ruby/tools/osx64/autobuilder
172+
cp win64/autobuilder.exe ruby/tools/win64/autobuilder.exe
173+
cp linux64/extractor ruby/tools/linux64/extractor
174+
cp osx64/extractor ruby/tools/osx64/extractor
175+
cp win64/extractor.exe ruby/tools/win64/extractor.exe
167176
chmod +x ruby/tools/{linux64,osx64}/{autobuilder,extractor}
168177
zip -rq codeql-ruby.zip ruby
169178
- uses: actions/upload-artifact@v3
@@ -226,3 +235,54 @@ jobs:
226235
shell: bash
227236
run: |
228237
codeql database analyze --search-path "${{ runner.temp }}/ruby-bundle" --format=sarifv2.1.0 --output=out.sarif ../database ruby-code-scanning.qls
238+
239+
# This is a copy of the 'test' job that runs in a centos7 container.
240+
# This tests that the extractor works correctly on systems with an old glibc.
241+
test-centos7:
242+
defaults:
243+
run:
244+
working-directory: ${{ github.workspace }}
245+
strategy:
246+
fail-fast: false
247+
runs-on: ubuntu-latest
248+
container:
249+
image: centos:centos7
250+
env:
251+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
252+
needs: [package]
253+
steps:
254+
- name: Install gh cli
255+
run: |
256+
yum-config-manager --add-repo https://cli.github.com/packages/rpm/gh-cli.repo
257+
# fetch-codeql requires unzip and jq
258+
# jq is available in epel-release (https://docs.fedoraproject.org/en-US/epel/)
259+
yum install -y gh unzip epel-release
260+
yum install -y jq
261+
- uses: actions/checkout@v3
262+
- name: Fetch CodeQL
263+
uses: ./.github/actions/fetch-codeql
264+
265+
# Due to a bug in Actions, we can't use runner.temp in the run blocks here.
266+
# https://github.com/actions/runner/issues/2185
267+
268+
- name: Download Ruby bundle
269+
uses: actions/download-artifact@v3
270+
with:
271+
name: codeql-ruby-bundle
272+
path: ${{ runner.temp }}
273+
- name: Unzip Ruby bundle
274+
shell: bash
275+
run: unzip -q -d "$RUNNER_TEMP"/ruby-bundle "$RUNNER_TEMP"/codeql-ruby-bundle.zip
276+
277+
- name: Run QL test
278+
shell: bash
279+
run: |
280+
codeql test run --search-path "$RUNNER_TEMP"/ruby-bundle --additional-packs "$RUNNER_TEMP"/ruby-bundle ruby/ql/test/library-tests/ast/constants/
281+
- name: Create database
282+
shell: bash
283+
run: |
284+
codeql database create --search-path "$RUNNER_TEMP"/ruby-bundle --language ruby --source-root ruby/ql/test/library-tests/ast/constants/ ../database
285+
- name: Analyze database
286+
shell: bash
287+
run: |
288+
codeql database analyze --search-path "$RUNNER_TEMP"/ruby-bundle --format=sarifv2.1.0 --output=out.sarif ../database ruby-code-scanning.qls

CODEOWNERS

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
/csharp/ @github/codeql-csharp
33
/go/ @github/codeql-go
44
/java/ @github/codeql-java
5-
/javascript/ @github/codeql-dynamic
6-
/python/ @github/codeql-dynamic
7-
/ruby/ @github/codeql-dynamic
5+
/javascript/ @github/codeql-javascript
6+
/python/ @github/codeql-python
7+
/ruby/ @github/codeql-ruby
88
/swift/ @github/codeql-swift
99
/misc/codegen/ @github/codeql-swift
1010
/java/kotlin-extractor/ @github/codeql-kotlin

config/identical-files.json

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlow.qll",
44
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlow.qll",
55
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlow.qll",
6-
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlow.qll",
76
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlow.qll",
87
"go/ql/lib/semmle/go/dataflow/internal/DataFlow.qll",
98
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlow.qll",
@@ -14,7 +13,6 @@
1413
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl.qll",
1514
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl.qll",
1615
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll",
17-
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl.qll",
1816
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl.qll",
1917
"go/ql/lib/semmle/go/dataflow/internal/DataFlowImpl.qll",
2018
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImpl.qll",
@@ -28,8 +26,6 @@
2826
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl4.qll",
2927
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl5.qll",
3028
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImpl6.qll",
31-
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplForSerializability.qll",
32-
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplForOnActivityResult.qll",
3329
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl1.qll",
3430
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl2.qll",
3531
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImpl3.qll",
@@ -39,10 +35,6 @@
3935
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll",
4036
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll",
4137
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll",
42-
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl1.qll",
43-
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl2.qll",
44-
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl3.qll",
45-
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImpl4.qll",
4638
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl1.qll",
4739
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl2.qll",
4840
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImpl3.qll",
@@ -67,7 +59,6 @@
6759
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplCommon.qll",
6860
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplCommon.qll",
6961
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll",
70-
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll",
7162
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplCommon.qll",
7263
"go/ql/lib/semmle/go/dataflow/internal/DataFlowImplCommon.qll",
7364
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplCommon.qll",
@@ -77,7 +68,6 @@
7768
"TaintTracking Java/C++/C#/Go/Python/Ruby/Swift": [
7869
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/tainttracking1/TaintTracking.qll",
7970
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/tainttracking1/TaintTracking.qll",
80-
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/tainttracking1/TaintTracking.qll",
8171
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/tainttracking1/TaintTracking.qll",
8272
"go/ql/lib/semmle/go/dataflow/internal/tainttracking1/TaintTracking.qll",
8373
"java/ql/lib/semmle/code/java/dataflow/internal/tainttracking1/TaintTracking.qll",
@@ -91,9 +81,6 @@
9181
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
9282
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
9383
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
94-
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
95-
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
96-
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
9784
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/tainttracking1/TaintTrackingImpl.qll",
9885
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/tainttracking2/TaintTrackingImpl.qll",
9986
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/tainttracking3/TaintTrackingImpl.qll",
@@ -115,7 +102,6 @@
115102
"java/ql/lib/semmle/code/java/dataflow/internal/DataFlowImplConsistency.qll",
116103
"cpp/ql/lib/semmle/code/cpp/dataflow/internal/DataFlowImplConsistency.qll",
117104
"cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll",
118-
"cpp/ql/lib/experimental/semmle/code/cpp/ir/dataflow/internal/DataFlowImplConsistency.qll",
119105
"csharp/ql/lib/semmle/code/csharp/dataflow/internal/DataFlowImplConsistency.qll",
120106
"python/ql/lib/semmle/python/dataflow/new/internal/DataFlowImplConsistency.qll",
121107
"ruby/ql/lib/codeql/ruby/dataflow/internal/DataFlowImplConsistency.qll",
@@ -293,6 +279,11 @@
293279
"cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/IRBlockImports.qll",
294280
"cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/internal/IRBlockImports.qll"
295281
],
282+
"C++ IR IRConsistencyImports": [
283+
"cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRConsistencyImports.qll",
284+
"cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/IRConsistencyImports.qll",
285+
"cpp/ql/lib/semmle/code/cpp/ir/implementation/aliased_ssa/internal/IRConsistencyImports.qll"
286+
],
296287
"C++ IR IRFunctionImports": [
297288
"cpp/ql/lib/semmle/code/cpp/ir/implementation/raw/internal/IRFunctionImports.qll",
298289
"cpp/ql/lib/semmle/code/cpp/ir/implementation/unaliased_ssa/internal/IRFunctionImports.qll",

0 commit comments

Comments
 (0)