Skip to content

Commit 518e2ae

Browse files
committed
Merge branch 'main' into jorgectf/python/deserialization
2 parents c5f30d9 + 94cb5c2 commit 518e2ae

File tree

1,403 files changed

+145318
-77935
lines changed

Some content is hidden

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

1,403 files changed

+145318
-77935
lines changed

.codeqlmanifest.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"*/ql/lib/qlpack.yml",
55
"*/ql/test/qlpack.yml",
66
"*/ql/examples/qlpack.yml",
7+
"*/ql/consistency-queries/qlpack.yml",
78
"cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml",
89
"javascript/ql/experimental/adaptivethreatmodeling/lib/qlpack.yml",
910
"javascript/ql/experimental/adaptivethreatmodeling/modelbuilding/qlpack.yml",
@@ -14,8 +15,6 @@
1415
"misc/legacy-support/*/qlpack.yml",
1516
"misc/suite-helpers/qlpack.yml",
1617
"ruby/extractor-pack/codeql-extractor.yml",
17-
"ruby/ql/consistency-queries/qlpack.yml",
18-
"ql/ql/consistency-queries/qlpack.yml",
1918
"ql/extractor-pack/codeql-extractor.yml"
2019
],
2120
"versionPolicies": {

.gitattributes

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@
5252
java/ql/test/stubs/**/*.java linguist-generated=true
5353
java/ql/test/experimental/stubs/**/*.java linguist-generated=true
5454

55+
# For some languages, upgrade script testing references really old dbscheme
56+
# files from legacy upgrades that have CRLF line endings. Since upgrade
57+
# resolution relies on object hashes, we must suppress line ending conversion
58+
# for those testing dbscheme files.
59+
*/ql/lib/upgrades/initial/*.dbscheme -text
60+
5561
# Generated test files - these are synced from the standard JavaScript libraries using
5662
# `javascript/ql/experimental/adaptivethreatmodeling/test/update_endpoint_test_files.py`.
5763
javascript/ql/experimental/adaptivethreatmodeling/test/endpoint_large_scale/autogenerated/**/*.js linguist-generated=true -merge

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,11 @@ on:
66
paths:
77
- "*/ql/src/**/*.ql"
88
- "*/ql/src/**/*.qll"
9+
- "*/ql/lib/**/*.ql"
10+
- "*/ql/lib/**/*.qll"
911
- "!**/experimental/**"
1012
- "!ql/**"
13+
- ".github/workflows/check-change-note.yml"
1114

1215
jobs:
1316
check-change-note:
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "Publish framework coverage as metrics"
2+
3+
on:
4+
schedule:
5+
- cron: '5 0 * * *'
6+
push:
7+
branches:
8+
- main
9+
workflow_dispatch:
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- ".github/workflows/csv-coverage-metrics.yml"
15+
16+
jobs:
17+
publish:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v2
22+
- name: Setup CodeQL
23+
uses: ./.github/actions/fetch-codeql
24+
- name: Create empty database
25+
run: |
26+
DATABASE="${{ runner.temp }}/java-database"
27+
PROJECT="${{ runner.temp }}/java-project"
28+
mkdir -p "$PROJECT/src/tmp/empty"
29+
echo "class Empty {}" >> "$PROJECT/src/tmp/empty/Empty.java"
30+
codeql database create "$DATABASE" --language=java --source-root="$PROJECT" --command 'javac src/tmp/empty/Empty.java'
31+
- name: Capture coverage information
32+
run: |
33+
DATABASE="${{ runner.temp }}/java-database"
34+
codeql database analyze --format=sarif-latest --output=metrics.sarif -- "$DATABASE" ./java/ql/src/Metrics/Summaries/FrameworkCoverage.ql
35+
- uses: actions/upload-artifact@v2
36+
with:
37+
name: metrics.sarif
38+
path: metrics.sarif
39+
retention-days: 20
40+
- name: Upload SARIF file
41+
uses: github/codeql-action/upload-sarif@v1
42+
with:
43+
sarif_file: metrics.sarif

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,12 @@ jobs:
3939

4040
- uses: ./.github/actions/fetch-codeql
4141

42+
- name: Install pack dependencies
43+
run: |
44+
for pack in modelbuilding src; do
45+
codeql pack install --mode verify -- "${pack}"
46+
done
47+
4248
- name: Check QL compilation
4349
run: |
4450
codeql query compile \
@@ -57,6 +63,9 @@ jobs:
5763

5864
- uses: ./.github/actions/fetch-codeql
5965

66+
- name: Install pack dependencies
67+
run: codeql pack install -- test
68+
6069
- name: Run QL tests
6170
run: |
6271
codeql test run \

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ jobs:
3131
uses: actions/cache@v2
3232
with:
3333
path: ${{ runner.temp }}/query-pack.zip
34-
key: queries-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}
34+
key: queries-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}
3535
- name: Build query pack
3636
if: steps.cache-queries.outputs.cache-hit != 'true'
3737
run: |
3838
cd ql/ql/src
3939
"${CODEQL}" pack create
40-
cd .codeql/pack/codeql/ql-all/0.0.0
40+
cd .codeql/pack/codeql/ql/0.0.0
4141
zip "${PACKZIP}" -r .
4242
env:
4343
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}

.github/workflows/ruby-qltest.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,14 @@ jobs:
5252
codeql dataset import -S ql/lib/upgrades/initial/ruby.dbscheme testdb empty.trap
5353
codeql dataset upgrade testdb --additional-packs ql/lib
5454
diff -q testdb/ruby.dbscheme ql/lib/ruby.dbscheme
55+
- name: Check DB downgrade scripts
56+
run: |
57+
echo >empty.trap
58+
rm -rf testdb; codeql dataset import -S ql/lib/ruby.dbscheme testdb empty.trap
59+
codeql resolve upgrades --format=lines --allow-downgrades --additional-packs downgrades \
60+
--dbscheme=ql/lib/ruby.dbscheme --target-dbscheme=downgrades/initial/ruby.dbscheme |
61+
xargs codeql execute upgrades testdb
62+
diff -q testdb/ruby.dbscheme downgrades/initial/ruby.dbscheme
5563
qltest:
5664
runs-on: ubuntu-latest
5765
strategy:
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Validate change notes
2+
3+
on:
4+
push:
5+
paths:
6+
- "*/ql/*/change-notes/**/*"
7+
- ".github/workflows/validate-change-notes.yml"
8+
branches:
9+
- main
10+
- "rc/*"
11+
pull_request:
12+
paths:
13+
- "*/ql/*/change-notes/**/*"
14+
- ".github/workflows/validate-change-notes.yml"
15+
16+
jobs:
17+
check-change-note:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v2
22+
23+
- name: Setup CodeQL
24+
uses: ./.github/actions/fetch-codeql
25+
26+
- name: Fail if there are any errors with existing change notes
27+
28+
run: |
29+
codeql pack release --groups cpp,csharp,java,javascript,python,ruby,-examples,-test,-experimental

.pre-commit-config.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
exclude: /test/.*$(?<!\.ql)(?<!\.qll)(?<!\.qlref)
4+
repos:
5+
- repo: https://github.com/pre-commit/pre-commit-hooks
6+
rev: v3.2.0
7+
hooks:
8+
- id: trailing-whitespace
9+
- id: end-of-file-fixer
10+
11+
- repo: local
12+
hooks:
13+
- id: codeql-format
14+
name: Fix QL file formatting
15+
files: \.qll?$
16+
language: system
17+
entry: codeql query format --in-place
18+
19+
- id: sync-files
20+
name: Fix files required to be identical
21+
language: system
22+
entry: python3 config/sync-files.py --latest
23+
pass_filenames: false
24+
25+
- id: qhelp
26+
name: Check query help generation
27+
files: \.qhelp$
28+
language: system
29+
entry: python3 misc/scripts/check-qhelp.py

CONTRIBUTING.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,11 @@ If you have an idea for a query that you would like to share with other CodeQL u
4242

4343
- The queries and libraries must be autoformatted, for example using the "Format Document" command in [CodeQL for Visual Studio Code](https://help.semmle.com/codeql/codeql-for-vscode/procedures/about-codeql-for-vscode.html).
4444

45-
If you prefer, you can use this [pre-commit hook](misc/scripts/pre-commit) that automatically checks whether your files are correctly formatted. See the [pre-commit hook installation guide](docs/pre-commit-hook-setup.md) for instructions on how to install the hook.
45+
If you prefer, you can either:
46+
1. install the [pre-commit framework](https://pre-commit.com/) and install the configured hooks on this repo via `pre-commit install`, or
47+
2. use this [pre-commit hook](misc/scripts/pre-commit) that automatically checks whether your files are correctly formatted.
48+
49+
See the [pre-commit hook installation guide](docs/pre-commit-hook-setup.md) for instructions on the two approaches.
4650

4751
4. **Compilation**
4852

@@ -63,6 +67,6 @@ After the experimental query is merged, we welcome pull requests to improve it.
6367

6468
## Using your personal data
6569

66-
If you contribute to this project, we will record your name and email address (as provided by you with your contributions) as part of the code repositories, which are public. We might also use this information to contact you in relation to your contributions, as well as in the normal course of software development. We also store records of CLA agreements signed in the past, but no longer require contributors to sign a CLA. Under GDPR legislation, we do this on the basis of our legitimate interest in creating the CodeQL product.
70+
If you contribute to this project, we will record your name and email address (as provided by you with your contributions) as part of the code repositories, which are public. We might also use this information to contact you in relation to your contributions, as well as in the normal course of software development. We also store records of CLA agreements signed in the past, but no longer require contributors to sign a CLA. Under GDPR legislation, we do this on the basis of our legitimate interest in creating the CodeQL product.
6771

6872
Please do get in touch ([email protected]) if you have any questions about this or our data protection policies.

0 commit comments

Comments
 (0)