Skip to content

Commit 2d57786

Browse files
authored
Merge branch 'main' into cleartext
2 parents 7fd64f1 + 06afe9c commit 2d57786

File tree

2,360 files changed

+189944
-57709
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,360 files changed

+189944
-57709
lines changed

.github/labeler.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ documentation:
4242

4343
"QL-for-QL":
4444
- ql/**/*
45+
- .github/workflows/ql-for-ql*

.github/workflows/go-tests.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111
name: Test Linux (Ubuntu)
1212
runs-on: ubuntu-latest
1313
steps:
14-
- name: Set up Go 1.18.1
14+
- name: Set up Go 1.19
1515
uses: actions/setup-go@v3
1616
with:
17-
go-version: 1.18.1
17+
go-version: 1.19
1818
id: go
1919

2020
- name: Check out code
@@ -57,10 +57,10 @@ jobs:
5757
name: Test MacOS
5858
runs-on: macos-latest
5959
steps:
60-
- name: Set up Go 1.18.1
60+
- name: Set up Go 1.19
6161
uses: actions/setup-go@v3
6262
with:
63-
go-version: 1.18.1
63+
go-version: 1.19
6464
id: go
6565

6666
- name: Check out code
@@ -87,10 +87,10 @@ jobs:
8787
name: Test Windows
8888
runs-on: windows-2019
8989
steps:
90-
- name: Set up Go 1.18.1
90+
- name: Set up Go 1.19
9191
uses: actions/setup-go@v3
9292
with:
93-
go-version: 1.18.1
93+
go-version: 1.19
9494
id: go
9595

9696
- name: Check out code

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

Lines changed: 46 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- uses: actions/checkout@v3
1818
- name: Find codeql
1919
id: find-codeql
20-
uses: github/codeql-action/init@aa93aea877e5fb8841bcb1193f672abf6e9f2980
20+
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
2121
with:
2222
languages: javascript # does not matter
2323
- name: Get CodeQL version
@@ -27,30 +27,37 @@ jobs:
2727
shell: bash
2828
env:
2929
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
30+
- name: Cache entire pack
31+
id: cache-pack
32+
uses: actions/cache@v3
33+
with:
34+
path: ${{ runner.temp }}/pack
35+
key: ${{ runner.os }}-pack-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}--${{ hashFiles('.github/workflows/ql-for-ql-build.yml') }}
3036
- name: Cache queries
37+
if: steps.cache-pack.outputs.cache-hit != 'true'
3138
id: cache-queries
3239
uses: actions/cache@v3
3340
with:
34-
path: ${{ runner.temp }}/query-pack.zip
35-
key: queries-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}
41+
path: ${{ runner.temp }}/queries
42+
key: queries-${{ hashFiles('ql/**/*.ql*') }}-${{ hashFiles('ql/**/qlpack.yml') }}-${{ hashFiles('ql/ql/src/ql.dbscheme*') }}-${{ steps.get-codeql-version.outputs.version }}--${{ hashFiles('.github/workflows/ql-for-ql-build.yml') }}
3643
- name: Build query pack
37-
if: steps.cache-queries.outputs.cache-hit != 'true'
44+
if: steps.cache-queries.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
3845
run: |
3946
cd ql/ql/src
40-
"${CODEQL}" pack create
41-
cd .codeql/pack/codeql/ql/0.0.0
42-
zip "${PACKZIP}" -r .
47+
"${CODEQL}" pack create -j 16
48+
mv .codeql/pack/codeql/ql/0.0.0 ${{ runner.temp }}/queries
4349
env:
4450
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
45-
PACKZIP: ${{ runner.temp }}/query-pack.zip
46-
- name: Upload query pack
47-
uses: actions/upload-artifact@v3
48-
with:
49-
name: query-pack-zip
50-
path: ${{ runner.temp }}/query-pack.zip
51-
51+
- name: Move cache queries to pack
52+
if: steps.cache-pack.outputs.cache-hit != 'true'
53+
run: |
54+
cp -r ${{ runner.temp }}/queries ${{ runner.temp }}/pack
55+
env:
56+
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
57+
5258
### Build the extractor ###
5359
- name: Cache entire extractor
60+
if: steps.cache-pack.outputs.cache-hit != 'true'
5461
id: cache-extractor
5562
uses: actions/cache@v3
5663
with:
@@ -61,7 +68,7 @@ jobs:
6168
ql/target/release/ql-extractor.exe
6269
key: ${{ runner.os }}-extractor-${{ hashFiles('ql/**/Cargo.lock') }}-${{ hashFiles('ql/**/*.rs') }}
6370
- name: Cache cargo
64-
if: steps.cache-extractor.outputs.cache-hit != 'true'
71+
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
6572
uses: actions/cache@v3
6673
with:
6774
path: |
@@ -70,72 +77,35 @@ jobs:
7077
ql/target
7178
key: ${{ runner.os }}-rust-cargo-${{ hashFiles('ql/**/Cargo.lock') }}
7279
- name: Check formatting
73-
if: steps.cache-extractor.outputs.cache-hit != 'true'
80+
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
7481
run: cd ql; cargo fmt --all -- --check
7582
- name: Build
76-
if: steps.cache-extractor.outputs.cache-hit != 'true'
83+
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
7784
run: cd ql; cargo build --verbose
7885
- name: Run tests
79-
if: steps.cache-extractor.outputs.cache-hit != 'true'
86+
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
8087
run: cd ql; cargo test --verbose
8188
- name: Release build
82-
if: steps.cache-extractor.outputs.cache-hit != 'true'
89+
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
8390
run: cd ql; cargo build --release
8491
- name: Generate dbscheme
85-
if: steps.cache-extractor.outputs.cache-hit != 'true'
92+
if: steps.cache-extractor.outputs.cache-hit != 'true' && steps.cache-pack.outputs.cache-hit != 'true'
8693
run: ql/target/release/ql-generator --dbscheme ql/ql/src/ql.dbscheme --library ql/ql/src/codeql_ql/ast/internal/TreeSitter.qll
87-
- uses: actions/upload-artifact@v3
88-
with:
89-
name: extractor-ubuntu-latest
90-
path: |
91-
ql/target/release/ql-autobuilder
92-
ql/target/release/ql-autobuilder.exe
93-
ql/target/release/ql-extractor
94-
ql/target/release/ql-extractor.exe
95-
retention-days: 1
9694

9795
### Package the queries and extractor ###
98-
- uses: actions/download-artifact@v3
99-
with:
100-
name: query-pack-zip
101-
path: query-pack-zip
102-
- uses: actions/download-artifact@v3
103-
with:
104-
name: extractor-ubuntu-latest
105-
path: linux64
106-
- run: |
107-
unzip query-pack-zip/*.zip -d pack
108-
cp -r ql/codeql-extractor.yml ql/tools ql/ql/src/ql.dbscheme.stats pack/
109-
mkdir -p pack/tools/linux64
110-
if [[ -f linux64/ql-autobuilder ]]; then
111-
cp linux64/ql-autobuilder pack/tools/linux64/autobuilder
112-
chmod +x pack/tools/linux64/autobuilder
113-
fi
114-
if [[ -f linux64/ql-extractor ]]; then
115-
cp linux64/ql-extractor pack/tools/linux64/extractor
116-
chmod +x pack/tools/linux64/extractor
117-
fi
118-
cd pack
119-
zip -rq ../codeql-ql.zip .
120-
- uses: actions/upload-artifact@v3
121-
with:
122-
name: codeql-ql-pack
123-
path: codeql-ql.zip
124-
retention-days: 1
125-
126-
### Run the analysis ###
127-
- name: Download pack
128-
uses: actions/download-artifact@v3
129-
with:
130-
name: codeql-ql-pack
131-
path: ${{ runner.temp }}/codeql-ql-pack-artifact
132-
133-
- name: Prepare pack
96+
- name: Package pack
97+
if: steps.cache-pack.outputs.cache-hit != 'true'
13498
run: |
135-
unzip "${PACK_ARTIFACT}/*.zip" -d "${PACK}"
99+
cp -r ql/codeql-extractor.yml ql/tools ql/ql/src/ql.dbscheme.stats ${PACK}/
100+
mkdir -p ${PACK}/tools/linux64
101+
cp ql/target/release/ql-autobuilder ${PACK}/tools/linux64/autobuilder
102+
cp ql/target/release/ql-extractor ${PACK}/tools/linux64/extractor
103+
chmod +x ${PACK}/tools/linux64/autobuilder
104+
chmod +x ${PACK}/tools/linux64/extractor
136105
env:
137-
PACK_ARTIFACT: ${{ runner.temp }}/codeql-ql-pack-artifact
138106
PACK: ${{ runner.temp }}/pack
107+
108+
### Run the analysis ###
139109
- name: Hack codeql-action options
140110
run: |
141111
JSON=$(jq -nc --arg pack "${PACK}" '.database."run-queries"=["--search-path", $pack] | .resolve.queries=["--search-path", $pack] | .resolve.extractor=["--search-path", $pack] | .database.init=["--search-path", $pack]')
@@ -149,21 +119,26 @@ jobs:
149119
echo " - ql/ql/test" >> ${CONF}
150120
echo " - \"*/ql/lib/upgrades/\"" >> ${CONF}
151121
echo "disable-default-queries: true" >> ${CONF}
152-
echo "packs:" >> ${CONF}
153-
echo " - codeql/ql" >> ${CONF}
122+
echo "queries:" >> ${CONF}
123+
echo " - uses: ./ql/ql/src/codeql-suites/ql-code-scanning.qls" >> ${CONF}
154124
echo "Config file: "
155125
cat ${CONF}
156126
env:
157127
CONF: ./ql-for-ql-config.yml
158128
- name: Initialize CodeQL
159-
uses: github/codeql-action/init@aa93aea877e5fb8841bcb1193f672abf6e9f2980
129+
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
160130
with:
161131
languages: ql
162132
db-location: ${{ runner.temp }}/db
163133
config-file: ./ql-for-ql-config.yml
134+
- name: Move pack cache
135+
run: |
136+
cp -r ${PACK}/.cache ql/ql/src/.cache
137+
env:
138+
PACK: ${{ runner.temp }}/pack
164139

165140
- name: Perform CodeQL Analysis
166-
uses: github/codeql-action/analyze@aa93aea877e5fb8841bcb1193f672abf6e9f2980
141+
uses: github/codeql-action/analyze@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
167142
with:
168143
category: "ql-for-ql"
169144
- 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@aa93aea877e5fb8841bcb1193f672abf6e9f2980
28+
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
2929
with:
3030
languages: javascript # does not matter
3131
- uses: actions/cache@v3

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

Lines changed: 2 additions & 2 deletions
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@aa93aea877e5fb8841bcb1193f672abf6e9f2980
25+
uses: github/codeql-action/init@71a8b35ff4c80fcfcd05bc1cd932fe3c08f943ca
2626
with:
2727
languages: javascript # does not matter
2828
- uses: actions/cache@v3
@@ -44,7 +44,7 @@ jobs:
4444
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
4545
- name: Check QL formatting
4646
run: |
47-
find ql/ql "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 "${CODEQL}" query format --check-only
47+
find ql/ql/src "(" -name "*.ql" -or -name "*.qll" ")" -print0 | xargs -0 "${CODEQL}" query format --check-only
4848
env:
4949
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
5050
- name: Check QL compilation

config/identical-files.json

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -485,28 +485,39 @@
485485
"ruby/ql/lib/codeql/ruby/security/internal/SensitiveDataHeuristics.qll"
486486
],
487487
"ReDoS Util Python/JS/Ruby/Java": [
488-
"javascript/ql/lib/semmle/javascript/security/performance/ReDoSUtil.qll",
489-
"python/ql/lib/semmle/python/security/performance/ReDoSUtil.qll",
490-
"ruby/ql/lib/codeql/ruby/security/performance/ReDoSUtil.qll",
491-
"java/ql/lib/semmle/code/java/security/performance/ReDoSUtil.qll"
488+
"javascript/ql/lib/semmle/javascript/security/regexp/NfaUtils.qll",
489+
"python/ql/lib/semmle/python/security/regexp/NfaUtils.qll",
490+
"ruby/ql/lib/codeql/ruby/security/regexp/NfaUtils.qll",
491+
"java/ql/lib/semmle/code/java/security/regexp/NfaUtils.qll"
492492
],
493493
"ReDoS Exponential Python/JS/Ruby/Java": [
494-
"javascript/ql/lib/semmle/javascript/security/performance/ExponentialBackTracking.qll",
495-
"python/ql/lib/semmle/python/security/performance/ExponentialBackTracking.qll",
496-
"ruby/ql/lib/codeql/ruby/security/performance/ExponentialBackTracking.qll",
497-
"java/ql/lib/semmle/code/java/security/performance/ExponentialBackTracking.qll"
494+
"javascript/ql/lib/semmle/javascript/security/regexp/ExponentialBackTracking.qll",
495+
"python/ql/lib/semmle/python/security/regexp/ExponentialBackTracking.qll",
496+
"ruby/ql/lib/codeql/ruby/security/regexp/ExponentialBackTracking.qll",
497+
"java/ql/lib/semmle/code/java/security/regexp/ExponentialBackTracking.qll"
498498
],
499499
"ReDoS Polynomial Python/JS/Ruby/Java": [
500-
"javascript/ql/lib/semmle/javascript/security/performance/SuperlinearBackTracking.qll",
501-
"python/ql/lib/semmle/python/security/performance/SuperlinearBackTracking.qll",
502-
"ruby/ql/lib/codeql/ruby/security/performance/SuperlinearBackTracking.qll",
503-
"java/ql/lib/semmle/code/java/security/performance/SuperlinearBackTracking.qll"
500+
"javascript/ql/lib/semmle/javascript/security/regexp/SuperlinearBackTracking.qll",
501+
"python/ql/lib/semmle/python/security/regexp/SuperlinearBackTracking.qll",
502+
"ruby/ql/lib/codeql/ruby/security/regexp/SuperlinearBackTracking.qll",
503+
"java/ql/lib/semmle/code/java/security/regexp/SuperlinearBackTracking.qll"
504+
],
505+
"RegexpMatching Python/JS/Ruby": [
506+
"javascript/ql/lib/semmle/javascript/security/regexp/RegexpMatching.qll",
507+
"python/ql/lib/semmle/python/security/regexp/RegexpMatching.qll",
508+
"ruby/ql/lib/codeql/ruby/security/regexp/RegexpMatching.qll"
504509
],
505510
"BadTagFilterQuery Python/JS/Ruby": [
506511
"javascript/ql/lib/semmle/javascript/security/BadTagFilterQuery.qll",
507512
"python/ql/lib/semmle/python/security/BadTagFilterQuery.qll",
508513
"ruby/ql/lib/codeql/ruby/security/BadTagFilterQuery.qll"
509514
],
515+
"OverlyLargeRange Python/JS/Ruby/Java": [
516+
"javascript/ql/lib/semmle/javascript/security/OverlyLargeRangeQuery.qll",
517+
"python/ql/lib/semmle/python/security/OverlyLargeRangeQuery.qll",
518+
"ruby/ql/lib/codeql/ruby/security/OverlyLargeRangeQuery.qll",
519+
"java/ql/lib/semmle/code/java/security/OverlyLargeRangeQuery.qll"
520+
],
510521
"CFG": [
511522
"csharp/ql/lib/semmle/code/csharp/controlflow/internal/ControlFlowGraphImplShared.qll",
512523
"ruby/ql/lib/codeql/ruby/controlflow/internal/ControlFlowGraphImplShared.qll",
@@ -586,5 +597,9 @@
586597
"Swift patterns test file": [
587598
"swift/ql/test/extractor-tests/patterns/patterns.swift",
588599
"swift/ql/test/library-tests/parent/patterns.swift"
600+
],
601+
"IncompleteMultiCharacterSanitization JS/Ruby": [
602+
"javascript/ql/lib/semmle/javascript/security/IncompleteMultiCharacterSanitizationQuery.qll",
603+
"ruby/ql/lib/codeql/ruby/security/IncompleteMultiCharacterSanitizationQuery.qll"
589604
]
590605
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
class AttributeArgument extends @attribute_arg {
2+
string toString() { none() }
3+
}
4+
5+
class Attribute extends @attribute {
6+
string toString() { none() }
7+
}
8+
9+
class LocationDefault extends @location_default {
10+
string toString() { none() }
11+
}
12+
13+
from AttributeArgument arg, int kind, Attribute attr, int index, LocationDefault location
14+
where
15+
attribute_args(arg, kind, attr, index, location) and
16+
not arg instanceof @attribute_arg_constant_expr
17+
select arg, kind, attr, index, location

0 commit comments

Comments
 (0)