Skip to content

Commit f34b7fa

Browse files
committed
codeql: publish the sarif file as build artifact
In some instances, CodeQL's web UI on github.com leaves questions unanswered. For example, in some alerts it is really necessary to follow the entire "taint flow" to understand why something might be an issue. The alerts for the `cpp/uncontrolled-allocation-size` rule, for example, are all false positives, and only when inspecting the exact flow does it become obvious that one alert wants to point out that the size of a binary patch hunk, which is specified in the patch, is then used to determine how much memory to allocate, which may potentially run out of memory (and is hence just Git doing what it is asked to, and does not need to be changed). To help with those issues, publish the `.sarif` file as part of every workflow run; This allows downloading that file and inspecting it e.g. with the SARIF viewer extension in VS Code (for details, see https://marketplace.visualstudio.com/items?itemName=MS-SarifVSCode.sarif-viewer). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent add1566 commit f34b7fa

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

.github/workflows/codeql.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,21 @@ jobs:
4646
4747
- name: Perform CodeQL Analysis
4848
uses: github/codeql-action/analyze@v3
49+
with:
50+
upload: False
51+
output: sarif-results
52+
53+
- name: debug
54+
shell: bash
55+
run: ls -la sarif-results
56+
57+
- name: publish sarif for debugging
58+
uses: actions/upload-artifact@v4
59+
with:
60+
name: sarif-results
61+
path: sarif-results
62+
63+
- name: Upload SARIF
64+
uses: github/codeql-action/upload-sarif@v3
65+
with:
66+
sarif_file: sarif-results/cpp.sarif

0 commit comments

Comments
 (0)