Skip to content

Commit 2f33b94

Browse files
committed
Merge branch 'main' into salvage
2 parents 83860ac + 317790e commit 2f33b94

File tree

3,663 files changed

+128813
-324832
lines changed

Some content is hidden

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

3,663 files changed

+128813
-324832
lines changed

.bazelrc

+14-3
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,19 @@ common --override_module=semmle_code=%workspace%/misc/bazel/semmle_code_stub
1010

1111
build --repo_env=CC=clang --repo_env=CXX=clang++
1212

13-
build:linux --cxxopt=-std=c++20
14-
build:macos --cxxopt=-std=c++20 --cpu=darwin_x86_64
15-
build:windows --cxxopt=/std:c++20 --cxxopt=/Zc:preprocessor
13+
# we use transitions that break builds of `...`, so for `test` to work with that we need the following
14+
test --build_tests_only
15+
16+
# this requires developer mode, but is required to have pack installer functioning
17+
startup --windows_enable_symlinks
18+
common --enable_runfiles
19+
20+
# with the above, we can avoid building python zips which is the default on windows as that's expensive
21+
build --nobuild_python_zip
22+
23+
common --registry=file:///%workspace%/misc/bazel/registry
24+
common --registry=https://bcr.bazel.build
25+
26+
common --@rules_dotnet//dotnet/settings:strict_deps=false
1627

1728
try-import %workspace%/local.bazelrc

.bazelrc.internal

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# this file should contain bazel settings required to build things from `semmle-code`
2+
3+
common --registry=file:///%workspace%/ql/misc/bazel/registry
4+
common --registry=https://bcr.bazel.build
5+
6+
# See bazelbuild/rules_dotnet#413: strict_deps in C# also appliy to 3rd-party deps, and when we pull
7+
# in (for example) the xunit package, there's no code in this at all, it just depends transitively on
8+
# its implementation packages without providing any code itself.
9+
# We either can depend on internal implementation details, or turn of strict deps.
10+
common --@rules_dotnet//dotnet/settings:strict_deps=false

.bazelversion

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
7.1.0
1+
7.1.2

.gitattributes

+24-15
Original file line numberDiff line numberDiff line change
@@ -50,31 +50,40 @@
5050
*.dll -text
5151
*.pdb -text
5252

53-
java/ql/test/stubs/**/*.java linguist-generated=true
54-
java/ql/test/experimental/stubs/**/*.java linguist-generated=true
53+
/java/ql/test/stubs/**/*.java linguist-generated=true
54+
/java/ql/test/experimental/stubs/**/*.java linguist-generated=true
55+
/java/kotlin-extractor/deps/*.jar filter=lfs diff=lfs merge=lfs -text
5556

5657
# Force git not to modify line endings for go or html files under the go/ql directory
57-
go/ql/**/*.go -text
58-
go/ql/**/*.html -text
58+
/go/ql/**/*.go -text
59+
/go/ql/**/*.html -text
5960
# Force git not to modify line endings for go dbschemes
60-
go/*.dbscheme -text
61+
/go/*.dbscheme -text
6162
# Preserve unusual line ending from codeql-go merge
62-
go/extractor/opencsv/CSVReader.java -text
63+
/go/extractor/opencsv/CSVReader.java -text
6364

6465
# For some languages, upgrade script testing references really old dbscheme
6566
# files from legacy upgrades that have CRLF line endings. Since upgrade
6667
# resolution relies on object hashes, we must suppress line ending conversion
6768
# for those testing dbscheme files.
68-
*/ql/lib/upgrades/initial/*.dbscheme -text
69-
70-
# Generated test files - these are synced from the standard JavaScript libraries using
71-
# `javascript/ql/experimental/adaptivethreatmodeling/test/update_endpoint_test_files.py`.
72-
javascript/ql/experimental/adaptivethreatmodeling/test/endpoint_large_scale/autogenerated/**/*.js linguist-generated=true -merge
73-
javascript/ql/experimental/adaptivethreatmodeling/test/endpoint_large_scale/autogenerated/**/*.ts linguist-generated=true -merge
69+
/*/ql/lib/upgrades/initial/*.dbscheme -text
7470

7571
# Auto-generated modeling for Python
76-
python/ql/lib/semmle/python/frameworks/data/internal/subclass-capture/*.yml linguist-generated=true
72+
/python/ql/lib/semmle/python/frameworks/data/internal/subclass-capture/*.yml linguist-generated=true
7773

7874
# auto-generated bazel lock file
79-
ruby/extractor/cargo-bazel-lock.json linguist-generated=true
80-
ruby/extractor/cargo-bazel-lock.json -merge
75+
/ruby/extractor/cargo-bazel-lock.json linguist-generated=true
76+
/ruby/extractor/cargo-bazel-lock.json -merge
77+
78+
# auto-generated files for the C# build
79+
/csharp/paket.lock linguist-generated=true
80+
# needs eol=crlf, as `paket` touches this file and saves it as crlf
81+
/csharp/.paket/Paket.Restore.targets linguist-generated=true eol=crlf
82+
/csharp/paket.main.bzl linguist-generated=true
83+
/csharp/paket.main_extension.bzl linguist-generated=true
84+
85+
# ripunzip tool
86+
/misc/ripunzip/ripunzip-* filter=lfs diff=lfs merge=lfs -text
87+
88+
# swift prebuilt resources
89+
/swift/third_party/resource-dir/*.zip filter=lfs diff=lfs merge=lfs -text

.github/labeler.yml

+1-4
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ Java:
1515
- change-notes/**/*java.*
1616

1717
JS:
18-
- any: [ 'javascript/**/*', '!javascript/ql/experimental/adaptivethreatmodeling/**/*' ]
18+
- any: [ 'javascript/**/*' ]
1919
- change-notes/**/*javascript*
2020

2121
Kotlin:
@@ -46,6 +46,3 @@ documentation:
4646
# Since these are all shared files that need to be synced, just pick _one_ copy of each.
4747
"DataFlow Library":
4848
- "shared/dataflow/**/*"
49-
50-
"ATM":
51-
- javascript/ql/experimental/adaptivethreatmodeling/**/*

.github/workflows/build-ripunzip.yml

+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Build runzip
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
ripunzip-version:
7+
description: "what reference to checktout from google/runzip"
8+
required: false
9+
default: v1.2.1
10+
openssl-version:
11+
description: "what reference to checkout from openssl/openssl for Linux"
12+
required: false
13+
default: openssl-3.3.0
14+
15+
jobs:
16+
build:
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
os: [ubuntu-20.04, macos-12, windows-2019]
21+
runs-on: ${{ matrix.os }}
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
repository: google/ripunzip
26+
ref: ${{ inputs.ripunzip-version }}
27+
# we need to avoid ripunzip dynamically linking into libssl
28+
# see https://github.com/sfackler/rust-openssl/issues/183
29+
- if: runner.os == 'Linux'
30+
name: checkout openssl
31+
uses: actions/checkout@v4
32+
with:
33+
repository: openssl/openssl
34+
path: openssl
35+
ref: ${{ inputs.openssl-version }}
36+
- if: runner.os == 'Linux'
37+
name: build and install openssl with fPIC
38+
shell: bash
39+
working-directory: openssl
40+
run: |
41+
./config -fPIC --prefix=$HOME/.local --openssldir=$HOME/.local/ssl
42+
make -j $(nproc)
43+
make install_sw -j $(nproc)
44+
- if: runner.os == 'Linux'
45+
name: build (linux)
46+
shell: bash
47+
run: |
48+
env OPENSSL_LIB_DIR=$HOME/.local/lib64 OPENSSL_INCLUDE_DIR=$HOME/.local/include OPENSSL_STATIC=yes cargo build --release
49+
mv target/release/ripunzip ripunzip-linux
50+
- if: runner.os == 'Windows'
51+
name: build (windows)
52+
shell: bash
53+
run: |
54+
cargo build --release
55+
mv target/release/ripunzip ripunzip-windows
56+
- name: build (macOS)
57+
if: runner.os == 'macOS'
58+
shell: bash
59+
run: |
60+
rustup target install x86_64-apple-darwin
61+
rustup target install aarch64-apple-darwin
62+
cargo build --target x86_64-apple-darwin --release
63+
cargo build --target aarch64-apple-darwin --release
64+
lipo -create -output ripunzip-macos \
65+
-arch x86_64 target/x86_64-apple-darwin/release/ripunzip \
66+
-arch arm64 target/aarch64-apple-darwin/release/ripunzip
67+
- uses: actions/upload-artifact@v4
68+
with:
69+
name: ripunzip-${{ runner.os }}
70+
path: ripunzip-*
71+
- name: Check built binary
72+
shell: bash
73+
run: |
74+
./ripunzip-* --version

.github/workflows/buildifier.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Check bazel formatting
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- "**.bazel"
7+
- "**.bzl"
8+
branches:
9+
- main
10+
- "rc/*"
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
check:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
- name: Check bazel formatting
22+
uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507
23+
with:
24+
extra_args: >
25+
buildifier --all-files 2>&1 ||
26+
(
27+
echo -e "In order to format all bazel files, please run:\n bazel run //misc/bazel:buildifier"; exit 1
28+
)

.github/workflows/codeql-analysis.yml

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ jobs:
5656
# uses a compiled language
5757

5858
- run: |
59-
dotnet build csharp
59+
cd csharp
60+
dotnet tool restore
61+
dotnet build .
6062
6163
- name: Perform CodeQL Analysis
6264
uses: github/codeql-action/analyze@main

.github/workflows/csharp-qltest.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ jobs:
6565
key: csharp-qltest-${{ matrix.slice }}
6666
- name: Run QL tests
6767
run: |
68-
codeql test run --threads=0 --ram 50000 --slice ${{ matrix.slice }} --search-path extractor-pack --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
68+
codeql test run --threads=0 --ram 50000 --slice ${{ matrix.slice }} --search-path "${{ github.workspace }}" --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries ql/test --compilation-cache "${{ steps.query-cache.outputs.cache-dir }}"
6969
env:
7070
GITHUB_TOKEN: ${{ github.token }}
7171
unit-tests:
@@ -81,10 +81,11 @@ jobs:
8181
dotnet-version: 8.0.101
8282
- name: Extractor unit tests
8383
run: |
84+
dotnet tool restore
8485
dotnet test -p:RuntimeFrameworkVersion=8.0.1 extractor/Semmle.Util.Tests
8586
dotnet test -p:RuntimeFrameworkVersion=8.0.1 extractor/Semmle.Extraction.Tests
8687
dotnet test -p:RuntimeFrameworkVersion=8.0.1 autobuilder/Semmle.Autobuild.CSharp.Tests
87-
dotnet test -p:RuntimeFrameworkVersion=8.0.1 "${{ github.workspace }}/cpp/autobuilder/Semmle.Autobuild.Cpp.Tests"
88+
dotnet test -p:RuntimeFrameworkVersion=8.0.1 autobuilder/Semmle.Autobuild.Cpp.Tests
8889
shell: bash
8990
stubgentest:
9091
runs-on: ubuntu-latest
@@ -100,6 +101,6 @@ jobs:
100101
# Update existing stubs in the repo with the freshly generated ones
101102
mv "$STUBS_PATH/output/stubs/_frameworks" ql/test/resources/stubs/
102103
git status
103-
codeql test run --threads=0 --search-path extractor-pack --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries -- ql/test/library-tests/dataflow/flowsources/aspremote
104+
codeql test run --threads=0 --search-path "${{ github.workspace }}" --check-databases --check-undefined-labels --check-repeated-labels --check-redefined-labels --consistency-queries ql/consistency-queries -- ql/test/library-tests/dataflow/flowsources/aspremote
104105
env:
105106
GITHUB_TOKEN: ${{ github.token }}

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

+7-61
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ on:
77
- .github/workflows/go-tests-other-os.yml
88
- .github/actions/**
99
- codeql-workspace.yml
10-
env:
11-
GO_VERSION: '~1.22.0'
10+
- MODULE.bazel
11+
- .bazelrc
12+
- misc/bazel/**
1213

1314
permissions:
1415
contents: read
@@ -18,72 +19,17 @@ jobs:
1819
name: Test MacOS
1920
runs-on: macos-latest
2021
steps:
21-
- name: Set up Go ${{ env.GO_VERSION }}
22-
uses: actions/setup-go@v5
23-
with:
24-
go-version: ${{ env.GO_VERSION }}
25-
cache: false
26-
id: go
27-
2822
- name: Check out code
2923
uses: actions/checkout@v4
30-
31-
- name: Set up CodeQL CLI
32-
uses: ./.github/actions/fetch-codeql
33-
34-
- name: Enable problem matchers in repository
35-
shell: bash
36-
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
37-
38-
- name: Build
39-
run: |
40-
cd go
41-
make
42-
43-
- name: Cache compilation cache
44-
id: query-cache
45-
uses: ./.github/actions/cache-query-compilation
46-
with:
47-
key: go-qltest
48-
- name: Test
49-
run: |
50-
cd go
51-
make test cache="${{ steps.query-cache.outputs.cache-dir }}"
24+
- name: Run tests
25+
uses: ./go/actions/test
5226

5327
test-win:
5428
if: github.repository_owner == 'github'
5529
name: Test Windows
5630
runs-on: windows-latest-xl
5731
steps:
58-
- name: Set up Go ${{ env.GO_VERSION }}
59-
uses: actions/setup-go@v5
60-
with:
61-
go-version: ${{ env.GO_VERSION }}
62-
cache: false
63-
id: go
64-
6532
- name: Check out code
6633
uses: actions/checkout@v4
67-
68-
- name: Set up CodeQL CLI
69-
uses: ./.github/actions/fetch-codeql
70-
71-
- name: Enable problem matchers in repository
72-
shell: bash
73-
run: 'find .github/problem-matchers -name \*.json -exec echo "::add-matcher::{}" \;'
74-
75-
- name: Build
76-
run: |
77-
cd go
78-
make
79-
80-
- name: Cache compilation cache
81-
id: query-cache
82-
uses: ./.github/actions/cache-query-compilation
83-
with:
84-
key: go-qltest
85-
86-
- name: Test
87-
run: |
88-
cd go
89-
make test cache="${{ steps.query-cache.outputs.cache-dir }}"
34+
- name: Run tests
35+
uses: ./go/actions/test

0 commit comments

Comments
 (0)