Skip to content

Commit f05f70d

Browse files
Run CodeQL for GitHub Actions & improve workflows (#2853)
* Run CodeQL for GitHub Actions & improve workflows The CIFuzz workflow has been adjusted based on https://github.com/google/oss-fuzz/blob/cafd7a0eb8ecb4e007c56897996a9b65c49c972f/docs/getting-started/continuous_integration.md * Increase upload-sarif version --------- Co-authored-by: Éamonn McManus <[email protected]>
1 parent 676b005 commit f05f70d

File tree

3 files changed

+29
-3
lines changed

3 files changed

+29
-3
lines changed

.github/workflows/check-api-compatibility.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
name: Check API compatibility
44

55
on: pull_request
6+
permissions:
7+
contents: read # to fetch code (actions/checkout)
68

79
jobs:
810
check-api-compatibility:

.github/workflows/cifuzz.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,39 @@
11
name: CIFuzz
22
on: [pull_request]
3+
permissions: {}
4+
35
jobs:
46
Fuzzing:
57
runs-on: ubuntu-latest
8+
permissions:
9+
security-events: write
610
steps:
711
- name: Build Fuzzers
812
id: build
13+
# Cannot be pinned to commit because there are no releases, see https://github.com/google/oss-fuzz/issues/6836
914
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
1015
with:
1116
oss-fuzz-project-name: 'gson'
1217
dry-run: false
1318
language: jvm
1419
- name: Run Fuzzers
20+
# Cannot be pinned to commit because there are no releases, see https://github.com/google/oss-fuzz/issues/6836
1521
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
1622
with:
1723
oss-fuzz-project-name: 'gson'
1824
fuzz-seconds: 600
1925
dry-run: false
26+
output-sarif: true
2027
- name: Upload Crash
2128
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
2229
if: failure() && steps.build.outcome == 'success'
2330
with:
2431
name: artifacts
2532
path: ./out/artifacts
33+
- name: Upload Sarif
34+
if: always() && steps.build.outcome == 'success'
35+
uses: github/codeql-action/upload-sarif@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
36+
with:
37+
# Path to SARIF file relative to the root of the repository
38+
sarif_file: cifuzz-sarif/results.sarif
39+
checkout_path: cifuzz-sarif

.github/workflows/codeql-analysis.yml

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,27 @@ on:
1313

1414
jobs:
1515
analyze:
16-
name: Analyze
16+
name: Analyze (${{ matrix.language }})
1717
runs-on: ubuntu-latest
1818
permissions:
1919
security-events: write
2020

2121
strategy:
2222
fail-fast: false
2323
matrix:
24-
language: [ 'java' ]
24+
include:
25+
- language: java
26+
build-mode: manual
27+
# GitHub Actions
28+
- language: actions
29+
build-mode: none
2530

2631
steps:
2732
- name: Checkout repository
2833
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2934

3035
- name: Set up JDK 17
36+
if: ${{ matrix.language == 'java' }}
3137
uses: actions/setup-java@c5195efecf7bdfc987ee8bae7a71cb8b11521c00 # v4.7.1
3238
with:
3339
distribution: 'temurin'
@@ -39,15 +45,19 @@ jobs:
3945
uses: github/codeql-action/init@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
4046
with:
4147
languages: ${{ matrix.language }}
48+
build-mode: ${{ matrix.build-mode }}
4249
# Run all security queries and maintainability and reliability queries
4350
queries: +security-and-quality
4451

4552
# Only compile main sources, but ignore test sources because findings for them might not
4653
# be that relevant (though GitHub security view also allows filtering by source type)
4754
# Can replace this with github/codeql-action/autobuild action to run complete build
48-
- name: Compile sources
55+
- name: Compile sources (Java)
56+
if: ${{ matrix.language == 'java' }}
4957
run: |
5058
mvn compile --batch-mode --no-transfer-progress
5159
5260
- name: Perform CodeQL Analysis
5361
uses: github/codeql-action/analyze@181d5eefc20863364f96762470ba6f862bdef56b # v3.29.2
62+
with:
63+
category: "/language:${{ matrix.language }}"

0 commit comments

Comments
 (0)