Skip to content

Commit a5abc63

Browse files
authored
Merge branch 'main' into releases
2 parents 5b35e9a + 32b90a8 commit a5abc63

Some content is hidden

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

50 files changed

+5760
-4321
lines changed

.github/workflows/hotspots.yml

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
name: "Hotspots CodeQL Build/Publish"
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: "QLPack version"
8+
required: true
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: read
15+
packages: write
16+
steps:
17+
- name: Checkout github/codeql
18+
uses: actions/checkout@v2
19+
with:
20+
path: codeql
21+
repository: github/codeql
22+
token: ${{ secrets.GITHUB_TOKEN }}
23+
fetch-depth: 0
24+
25+
- name: Checkout github/codeql-community-packs
26+
uses: actions/checkout@v2
27+
with:
28+
path: codeql-community-packs
29+
repository: githubsecuritylab/codeql-community-packs
30+
ref: ${{ github.ref }}
31+
32+
- name: Find codeql
33+
id: find-codeql
34+
uses: github/codeql-action/init@aa93aea877e5fb8841bcb1193f672abf6e9f2980
35+
with:
36+
languages: javascript # does not matter
37+
38+
- name: Initialize CodeQL
39+
id: init
40+
run: |
41+
# Take the most modern version
42+
VERSION="$(find "${{ runner.tool_cache }}/CodeQL/" -maxdepth 1 -mindepth 1 -type d -print \
43+
| sort \
44+
| tail -n 1 \
45+
| tr -d '\n')"
46+
47+
CODEQL="$VERSION/x64/codeql/"
48+
"${CODEQL}"/codeql version --format=json
49+
echo "${CODEQL}" >> $GITHUB_PATH
50+
51+
- name: Create CodeQL config
52+
run: |
53+
mkdir -p ~/.config/codeql
54+
echo '--search-path /home/runner/work/codeql-community-packs/codeql-community-packs/codeql/ql/extractor-pack' >> ~/.config/codeql/config
55+
56+
- name: Install QL extractor
57+
working-directory: codeql/ql
58+
run: |
59+
./scripts/create-extractor-pack.sh
60+
61+
- name: Patch the CodeQL distro
62+
working-directory: codeql-community-packs
63+
run: |
64+
pip install pandas
65+
python ql/hotspots/scripts/generate-hotspots-queries.py \
66+
--ql-extractor "$GITHUB_WORKSPACE/codeql/ql/extractor-pack" \
67+
--ql-path "$GITHUB_WORKSPACE/codeql"
68+
python ql/hotspots/scripts/patch-codeql.py \
69+
--hotspots "$GITHUB_WORKSPACE/codeql-community-packs/ql/hotspots/output" \
70+
--ql "$GITHUB_WORKSPACE/codeql" \
71+
--dest "$GITHUB_WORKSPACE/codeql-patched" \
72+
--qlpack-version ${{ inputs.version }}
73+
env:
74+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- name: Check and publish hotspots lib packs
77+
working-directory: codeql-patched
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.GHCR_TOKEN }}
80+
run: |
81+
for LANG in "cpp" "csharp" "go" "java" "javascript" "python" "ruby" "swift"
82+
do
83+
echo "Processing $LANG packs"
84+
PUBLISHED_VERSION=$(gh api /orgs/githubsecuritylab/packages/container/hotspots-$LANG-all/versions --jq '.[0].metadata.container.tags[0]')
85+
CURRENT_VERSION=$(grep version $LANG/ql/lib/qlpack.yml | awk '{print $2}')
86+
echo "Published lib version: $PUBLISHED_VERSION"
87+
echo "Local lib version: $CURRENT_VERSION"
88+
if [ "$PUBLISHED_VERSION" != "$CURRENT_VERSION" ]; then
89+
codeql pack install "$LANG/ql/lib"
90+
codeql pack publish "$LANG/ql/lib"
91+
fi
92+
93+
PUBLISHED_VERSION=$(gh api /orgs/githubsecuritylab/packages/container/hotspots-$LANG-queries/versions --jq '.[0].metadata.container.tags[0]')
94+
CURRENT_VERSION=$(grep version $LANG/ql/src/qlpack.yml | awk '{print $2}')
95+
echo "Published queries version: $PUBLISHED_VERSION"
96+
echo "Local queries version: $CURRENT_VERSION"
97+
if [ "$PUBLISHED_VERSION" != "$CURRENT_VERSION" ]; then
98+
codeql pack install "$LANG/ql/src"
99+
codeql pack publish "$LANG/ql/src"
100+
fi
101+
done
102+

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,10 @@ test-*.ql
1919
**/*.testproj/*
2020
*/test-output.txt
2121

22+
# Temporary files
23+
ql/hotspots/output/**
24+
25+
# Cache
26+
**/__pycache__/
27+
2228
.DS_Store
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/java-all
4+
extensible: summaryModel
5+
data: []

java/ext-library-sources/qlpack.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,3 @@ dataExtensions:
88
- 'manual/**/*.yml'
99
- 'generated/*.yml'
1010
- 'generated/**/*.yml'
11-
- 'experimental/*.yml'

java/ext/experimental/android.webkit.model.yml

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

java/ext/experimental/com.jfinal.core.model.yml

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

java/ext/experimental/empty.model.yml

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

java/ext/experimental/java.io.model.yml

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

java/ext/experimental/javax.servlet.http.model.yml

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

java/ext/generated/empty.model.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
extensions:
2+
- addsTo:
3+
pack: codeql/java-all
4+
extensible: summaryModel
5+
data: []

0 commit comments

Comments
 (0)