Skip to content

Commit a22868b

Browse files
authored
Merge branch 'main' into ruby-3.1
2 parents abf3ce6 + 6acf49d commit a22868b

File tree

232 files changed

+23907
-6279
lines changed

Some content is hidden

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

232 files changed

+23907
-6279
lines changed

.codeqlmanifest.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"*/ql/examples/qlpack.yml",
77
"cpp/ql/test/query-tests/Security/CWE/CWE-190/semmle/tainted/qlpack.yml",
88
"javascript/ql/experimental/adaptivethreatmodeling/lib/qlpack.yml",
9+
"javascript/ql/experimental/adaptivethreatmodeling/modelbuilding/qlpack.yml",
910
"javascript/ql/experimental/adaptivethreatmodeling/src/qlpack.yml",
1011
"csharp/ql/campaigns/Solorigate/lib/qlpack.yml",
1112
"csharp/ql/campaigns/Solorigate/src/qlpack.yml",

.github/workflows/mad_modelDiff.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Models as Data - Diff
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
projects:
7+
description: "The projects to generate models for"
8+
required: true
9+
default: '["netty/netty"]'
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- "java/ql/src/utils/model-generator/**/*.*"
15+
- ".github/workflows/mad_modelDiff.yml"
16+
17+
permissions:
18+
contents: read
19+
20+
jobs:
21+
model-diff:
22+
name: Model Difference
23+
runs-on: ubuntu-latest
24+
if: github.repository == 'github/codeql'
25+
strategy:
26+
matrix:
27+
slug: ${{fromJson(github.event.inputs.projects || '["apache/commons-codec", "apache/commons-io", "apache/commons-beanutils", "apache/commons-logging", "apache/commons-fileupload", "apache/commons-lang", "apache/commons-validator", "apache/commons-csv", "apache/dubbo"]' )}}
28+
steps:
29+
- name: Clone github/codeql from PR
30+
uses: actions/checkout@v2
31+
if: github.event.pull_request
32+
with:
33+
path: codeql-pr
34+
- name: Clone github/codeql from main
35+
uses: actions/checkout@v2
36+
with:
37+
path: codeql-main
38+
ref: main
39+
- uses: ./codeql-main/.github/actions/fetch-codeql
40+
- name: Download database
41+
env:
42+
SLUG: ${{ matrix.slug }}
43+
run: |
44+
set -x
45+
mkdir lib-dbs
46+
SHORTNAME=${SLUG//[^a-zA-Z0-9_]/}
47+
projectId=`curl -s https://lgtm.com/api/v1.0/projects/g/${SLUG} | jq .id`
48+
curl -L "https://lgtm.com/api/v1.0/snapshots/$projectId/java" -o "$SHORTNAME.zip"
49+
unzip -q -d "${SHORTNAME}-db" "${SHORTNAME}.zip"
50+
mkdir "lib-dbs/$SHORTNAME/"
51+
mv "${SHORTNAME}-db/"$(ls -1 "${SHORTNAME}"-db)/* "lib-dbs/${SHORTNAME}/"
52+
- name: Generate Models (PR and main)
53+
run: |
54+
set -x
55+
mkdir tmp-models
56+
MODELS=`pwd`/tmp-models
57+
DATABASES=`pwd`/lib-dbs
58+
59+
analyzeDatabaseWithCheckout() {
60+
QL_VARIANT=$1
61+
DATABASE=$2
62+
cd codeql-$QL_VARIANT
63+
SHORTNAME=`basename $DATABASE`
64+
python java/ql/src/utils/model-generator/GenerateFlowModel.py $DATABASE $MODELS/${SHORTNAME}.qll
65+
mv $MODELS/${SHORTNAME}.qll $MODELS/${SHORTNAME}Generated_${QL_VARIANT}.qll
66+
cd ..
67+
}
68+
69+
for d in $DATABASES/*/ ; do
70+
ls -1 "$d"
71+
72+
analyzeDatabaseWithCheckout "main" $d
73+
if [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]
74+
then
75+
analyzeDatabaseWithCheckout "pr" $d
76+
fi
77+
done
78+
- name: Install diff2html
79+
if: github.event.pull_request
80+
run: |
81+
npm install -g diff2html-cli
82+
- name: Generate Model Diff
83+
if: github.event.pull_request
84+
run: |
85+
set -x
86+
MODELS=`pwd`/tmp-models
87+
ls -1 tmp-models/
88+
for m in $MODELS/*_main.qll ; do
89+
t="${m/main/"pr"}"
90+
basename=`basename $m`
91+
name="diff_${basename/_main.qll/""}"
92+
(diff -w -u $m $t | diff2html -i stdin -F $MODELS/$name.html) || true
93+
done
94+
- uses: actions/upload-artifact@v2
95+
with:
96+
name: models
97+
path: tmp-models/*.qll
98+
retention-days: 20
99+
- uses: actions/upload-artifact@v2
100+
with:
101+
name: diffs
102+
path: tmp-models/*.html
103+
retention-days: 20

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
CODEQL_THREADS: 4 # TODO: remove this once it's set by the CLI
1818
strategy:
1919
matrix:
20-
repo:
20+
repo:
2121
- github/codeql
2222
- github/codeql-go
2323
runs-on: ubuntu-latest
@@ -35,7 +35,7 @@ jobs:
3535
~/.cargo/registry
3636
~/.cargo/git
3737
ql/target
38-
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('**/Cargo.lock') }}
38+
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
3939
- name: Build Extractor
4040
run: cd ql; env "PATH=$PATH:`dirname ${CODEQL}`" ./create-extractor-pack.sh
4141
env:

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,24 @@ jobs:
2929
~/.cargo/registry
3030
~/.cargo/git
3131
ql/target
32-
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('**/Cargo.lock') }}
32+
key: ${{ runner.os }}-qltest-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
3333
- name: Build extractor
3434
run: |
3535
cd ql;
3636
codeqlpath=$(dirname ${{ steps.find-codeql.outputs.codeql-path }});
3737
env "PATH=$PATH:$codeqlpath" ./create-extractor-pack.sh
3838
- name: Run QL tests
39-
run: |
39+
run: |
4040
"${CODEQL}" test run --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --search-path "${{ github.workspace }}/ql/extractor-pack" --consistency-queries ql/ql/consistency-queries ql/ql/test
4141
env:
4242
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
4343
- name: Check QL formatting
44-
run: |
44+
run: |
4545
find ql/ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 "${CODEQL}" query format --check-only
4646
env:
4747
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
4848
- name: Check QL compilation
49-
run: |
49+
run: |
5050
"${CODEQL}" query compile --check-only --threads=4 --warnings=error --search-path "${{ github.workspace }}/ql/extractor-pack" "ql/ql/src" "ql/ql/examples"
5151
env:
5252
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}

.github/workflows/ruby-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
~/.cargo/registry
5151
~/.cargo/git
5252
ruby/target
53-
key: ${{ runner.os }}-rust-cargo-${{ hashFiles('**/Cargo.lock') }}
53+
key: ${{ runner.os }}-ruby-rust-cargo-${{ hashFiles('ruby/**/Cargo.lock') }}
5454
- name: Check formatting
5555
run: cargo fmt --all -- --check
5656
- name: Build

.github/workflows/ruby-qltest.yml

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,24 +24,28 @@ defaults:
2424
working-directory: ruby
2525

2626
jobs:
27-
qltest:
27+
qlformat:
2828
runs-on: ubuntu-latest
2929
steps:
3030
- uses: actions/checkout@v2
3131
- uses: ./.github/actions/fetch-codeql
32-
- uses: ./ruby/actions/create-extractor-pack
33-
- name: Run QL tests
34-
run: |
35-
codeql test run --search-path "${{ github.workspace }}/ruby/extractor-pack" --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test
36-
env:
37-
GITHUB_TOKEN: ${{ github.token }}
3832
- name: Check QL formatting
3933
run: find ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 codeql query format --check-only
34+
qlcompile:
35+
runs-on: ubuntu-latest
36+
steps:
37+
- uses: actions/checkout@v2
38+
- uses: ./.github/actions/fetch-codeql
4039
- name: Check QL compilation
4140
run: |
42-
codeql query compile --check-only --threads=4 --warnings=error "ql/src" "ql/examples"
41+
codeql query compile --check-only --threads=0 --ram 5000 --warnings=error "ql/src" "ql/examples"
4342
env:
4443
GITHUB_TOKEN: ${{ github.token }}
44+
qlupgrade:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v2
48+
- uses: ./.github/actions/fetch-codeql
4549
- name: Check DB upgrade scripts
4650
run: |
4751
echo >empty.trap
@@ -56,3 +60,17 @@ jobs:
5660
--dbscheme=ql/lib/ruby.dbscheme --target-dbscheme=downgrades/initial/ruby.dbscheme |
5761
xargs codeql execute upgrades testdb
5862
diff -q testdb/ruby.dbscheme downgrades/initial/ruby.dbscheme
63+
qltest:
64+
runs-on: ubuntu-latest
65+
strategy:
66+
matrix:
67+
slice: ["1/2", "2/2"]
68+
steps:
69+
- uses: actions/checkout@v2
70+
- uses: ./.github/actions/fetch-codeql
71+
- uses: ./ruby/actions/create-extractor-pack
72+
- name: Run QL tests
73+
run: |
74+
codeql test run --threads=0 --ram 5000 --slice ${{ matrix.slice }} --search-path "${{ github.workspace }}/ruby/extractor-pack" --check-databases --check-unused-labels --check-repeated-labels --check-redefined-labels --check-use-before-definition --consistency-queries ql/consistency-queries ql/test
75+
env:
76+
GITHUB_TOKEN: ${{ github.token }}

cpp/ql/examples/qlpack.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
name: codeql/cpp-examples
2-
version: 0.0.2
2+
groups:
3+
- cpp
4+
- examples
35
dependencies:
46
codeql/cpp-all: "*"

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ class DataFlowCallOption extends TDataFlowCallOption {
12901290
}
12911291
}
12921292

1293-
/** Content tagged with the type of a containing object. */
1293+
/** A `Content` tagged with the type of a containing object. */
12941294
class TypedContent extends MkTypedContent {
12951295
private Content c;
12961296
private DataFlowType t;

cpp/ql/lib/semmle/code/cpp/ir/dataflow/DefaultTaintTracking.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/**
2+
* An IR taint tracking library that uses an IR DataFlow configuration to track
3+
* taint from user inputs as defined by `semmle.code.cpp.security.Security`.
4+
*/
5+
16
import cpp
27
import semmle.code.cpp.security.Security
38
private import semmle.code.cpp.ir.dataflow.DataFlow

cpp/ql/lib/semmle/code/cpp/ir/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,7 @@ class DataFlowCallOption extends TDataFlowCallOption {
12901290
}
12911291
}
12921292

1293-
/** Content tagged with the type of a containing object. */
1293+
/** A `Content` tagged with the type of a containing object. */
12941294
class TypedContent extends MkTypedContent {
12951295
private Content c;
12961296
private DataFlowType t;

0 commit comments

Comments
 (0)