Skip to content

Commit 1f5afda

Browse files
committed
build: capture govulncheck results as Code Scanning alerts
Related to [0] and regular questions we've had in the past, we don't have a clear answer for "are we vulnerable to a CVE" in a way that our users are clearly able to determine, as well as "will oapi-codegen fix it". As a step towards answering the former, and leading towards the latter, we can start running `govulncheck` in CI as a way to ensure that we always have that information to hand. This will re-run on commits to HEAD, as well as on a schedule, to make sure we're aware of new CVEs. By producing this in SARIF format, we can then have this uploaded to GitHub's Code Scanning alerts, which are more straightforward to validate. The Code Scanning alerts page is gated to maintainers, but doesn't (currently) hide anything that can't be seen by someone running `govulncheck` themselves on the project. [0]: oapi-codegen/governance#11
1 parent bdc4edc commit 1f5afda

1 file changed

Lines changed: 33 additions & 0 deletions

File tree

.github/workflows/govulncheck.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: Determine known CVEs through `govulncheck`
2+
on:
3+
push:
4+
branches:
5+
- main
6+
schedule:
7+
# Mondays at 0000
8+
- cron: "0 0 * * 1"
9+
jobs:
10+
build:
11+
name: Build
12+
runs-on: ubuntu-latest
13+
steps:
14+
- id: govulncheck
15+
uses: golang/govulncheck-action@v1
16+
with:
17+
# to be explicit, we're only checking the top-level `oapi-codegen` package
18+
# we are intentionally NOT intending to keep on top of security updates in `internal/test` or `examples`, or any submodules thereof
19+
go-package: ./...
20+
# NOTE that we want to produce the SARIF-formatted report, which can then be consumed by other tools ...
21+
output-format: sarif
22+
output-file: govulncheck.sarif
23+
24+
# ... such as the Code Scanning tab (https://github.com/oapi-codegen/oapi-codegen/security/code-scanning?query=is%3Aopen+branch%3Amain+tool%3Agovulncheck)
25+
- name: Upload SARIF file
26+
uses: github/codeql-action/upload-sarif@v3
27+
with:
28+
sarif_file: govulncheck.sarif
29+
category: govulncheck
30+
31+
- name: Print code scanning results URL
32+
run: |
33+
echo "Results (for maintainers): https://github.com/${{ github.repository }}/security/code-scanning?query=is%3Aopen+branch%3Amain+tool%3Agovulncheck"

0 commit comments

Comments
 (0)