Skip to content

Commit df972ee

Browse files
committed
QL: Merge branch 'main' into use-set-literal
2 parents 7c02b6a + 1762394 commit df972ee

4,693 files changed

Lines changed: 716944 additions & 386 deletions

File tree

Some content is hidden

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

.github/workflows/codeql-analysis.yml

Lines changed: 58 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,30 @@ on:
1212

1313
jobs:
1414

15+
build_query_pack:
16+
runs-on: ubuntu-latest-xl
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Find codeql
20+
id: find-codeql
21+
uses: github/codeql-action/init@esbena/ql
22+
with:
23+
languages: javascript # does not matter
24+
- name: Build query pack
25+
run: |
26+
cd ql/src
27+
"${CODEQL}" pack create
28+
cd .codeql/pack/codeql/ql-all/0.0.0
29+
zip "${PACKZIP}" -r .
30+
env:
31+
CODEQL: ${{ steps.find-codeql.outputs.codeql-path }}
32+
PACKZIP: ${{ runner.temp }}/query-pack.zip
33+
- name: Upload query pack
34+
uses: actions/upload-artifact@v2
35+
with:
36+
name: query-pack
37+
path: ${{ runner.temp }}/query-pack.zip
38+
1539
# XXX this is mostly an inlined copy of the 'build' job in build.yml
1640
build_extractor_pack:
1741
strategy:
@@ -79,71 +103,67 @@ jobs:
79103

80104
analyze:
81105
name: Analyze
82-
needs: build_extractor_pack
106+
needs:
107+
- build_query_pack
108+
- build_extractor_pack
83109

84-
runs-on: ubuntu-latest
110+
runs-on: ubuntu-latest-xl
85111

86112
permissions:
87113
actions: read
88114
contents: read
89115
security-events: write
90116

91117
steps:
92-
- name: Download pack
118+
- name: Download query pack
119+
uses: actions/download-artifact@v2
120+
with:
121+
name: query-pack
122+
path: ${{ runner.temp }}/query-pack-artifact
123+
124+
- name: Download extractor pack
93125
uses: actions/download-artifact@v2
94126
with:
95127
name: extractor-pack
96128
path: ${{ runner.temp }}/extractor-pack-artifact
97129

98-
- name: Unzip pack
130+
- name: Prepare packs
131+
id: prepare-packs
99132
run: |
100133
set -x
101-
mkdir "${PACKTMP}"
102-
cd "${PACKTMP}"
103-
unzip "${PACKARTIFACT}/*.zip" -d unzipped
104-
cp -r unzipped/ql "${PACK}"
134+
mkdir -p "${COMPLETE_PACK}" "${PACKS_TMP}"
135+
cd "${PACKS_TMP}"
136+
unzip "${QUERY_PACK_ARTIFACT}/*.zip" -d query-pack-artifact-unzipped
137+
cp -r query-pack-artifact-unzipped/. "${COMPLETE_PACK}"
138+
unzip "${EXTRACTOR_PACK_ARTIFACT}/*.zip" -d extractor-pack-artifact-unzipped
139+
cp -r extractor-pack-artifact-unzipped/ql/. "${COMPLETE_PACK}"
140+
cd "${COMPLETE_PACK}"
141+
zip "${COMPLETE_PACK_ZIP}" -r .
105142
env:
106-
PACKTMP: ${{ runner.temp }}/extractor-pack-artifact.tmp
107-
PACKARTIFACT: ${{ runner.temp }}/extractor-pack-artifact
108-
PACK: ${{ runner.temp }}/extractor-pack
109-
110-
- name: Checkout repository
111-
uses: actions/checkout@v2
112-
113-
- name: Make config file
114-
run: |
115-
set -x
116-
echo "name: CodeQL config for QL" >> "${CONFIG_FILE}"
117-
echo "" >> "${CONFIG_FILE}"
118-
echo "disable-default-queries: true" >> "${CONFIG_FILE}"
119-
echo "" >> "${CONFIG_FILE}"
120-
echo "queries: " >> "${CONFIG_FILE}"
121-
echo " - name: Standard queries" >> "${CONFIG_FILE}"
122-
echo " uses: ${SUITE}" >> "${CONFIG_FILE}"
123-
cat "${CONFIG_FILE}"
124-
env:
125-
SUITE: ./ql/src/codeql-suites/ql-code-scanning.qls
126-
CONFIG_FILE: ./.custom-codeql-actions-config.yml
143+
PACKS_TMP: ${{ runner.temp }}/pack-artifacts.tmp
144+
QUERY_PACK_ARTIFACT: ${{ runner.temp }}/query-pack-artifact
145+
EXTRACTOR_PACK_ARTIFACT: ${{ runner.temp }}/extractor-pack-artifact
146+
COMPLETE_PACK: ${{ runner.temp }}/pack
147+
COMPLETE_PACK_ZIP: ${{ runner.temp }}/pack.zip
127148

128149
- name: Hack codeql-action options
129150
run: |
130-
JSON=$(jq -nc --arg pack "${PACK}" '.resolve.extractor=["--search-path", $pack] | .database.init=["--search-path", $pack]')
151+
JSON=$(jq -nc --arg pack "${COMPLETE_PACK}" '.resolve.queries=["--search-path", $pack] | .resolve.extractor=["--search-path", $pack] | .database.init=["--search-path", $pack]')
131152
echo "CODEQL_ACTION_EXTRA_OPTIONS=${JSON}" >> ${GITHUB_ENV}
132153
env:
133-
PACK: ${{ runner.temp }}/extractor-pack
154+
COMPLETE_PACK: ${{ runner.temp }}/pack
155+
156+
- name: Checkout repository
157+
uses: actions/checkout@v2
134158

135159
- name: Initialize CodeQL
136160
uses: github/codeql-action/init@esbena/ql
137161
with:
138162
languages: ql
139163
db-location: ${{ runner.temp }}/db
140-
config-file: ./.custom-codeql-actions-config.yml
141164

142165
- name: Perform CodeQL Analysis
143166
uses: github/codeql-action/analyze@esbena/ql
144-
with:
145-
results: ${{ runner.temp }}/results
146-
add-snippets: true
147167

148168
- name: Upload db
149169
uses: actions/upload-artifact@v2
@@ -152,9 +172,9 @@ jobs:
152172
path: ${{ runner.temp }}/db
153173
retention-days: 1
154174

155-
- name: Upload results
175+
- name: Upload complete pack
156176
uses: actions/upload-artifact@v2
157177
with:
158-
name: results
159-
path: ${{ runner.temp }}/results
178+
name: complete-pack
179+
path: ${{ runner.temp }}/pack.zip
160180
retention-days: 1

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

codeql-ql.code-workspace

Lines changed: 0 additions & 14 deletions
This file was deleted.

extractor/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ edition = "2018"
1010
flate2 = "1.0"
1111
node-types = { path = "../node-types" }
1212
tree-sitter = "0.19"
13-
tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "577c43d96c93915bd7ae9c2765d11be8db102952" }
13+
tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "36bdc0eae196f9833182ce3f8932be63534121b3" }
1414
clap = "2.33"
1515
tracing = "0.1"
1616
tracing-subscriber = { version = "0.2", features = ["env-filter"] }

generator/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ edition = "2018"
1010
node-types = { path = "../node-types" }
1111
tracing = "0.1"
1212
tracing-subscriber = { version = "0.2", features = ["env-filter"] }
13-
tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "577c43d96c93915bd7ae9c2765d11be8db102952" }
13+
tree-sitter-ql = { git = "https://github.com/tausbn/tree-sitter-ql.git", rev = "36bdc0eae196f9833182ce3f8932be63534121b3" }

ql/src/codeql-suites/ql-all.qls

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
- description: All Code Scanning queries for QL
2+
- queries: .
3+
- include:
4+
kind:
5+
- problem
6+
- path-problem
7+
- alert
8+
- path-alert

ql/src/codeql-suites/ql-code-scanning.qls

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,13 @@
66
- path-problem
77
- alert
88
- path-alert
9+
precision:
10+
- high
11+
- very-high
12+
problem.severity:
13+
- error
14+
- warning
15+
- exclude:
16+
deprecated: //
17+
- exclude:
18+
query path: /^experimental\/.*/

0 commit comments

Comments
 (0)