ci: ignore unfixable CVEs in govulncheck (prometheus web UI XSS, no u… #244
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: govulncheck | |
| on: | |
| push: | |
| branches: [master, main] | |
| pull_request: | |
| branches: [master, main] | |
| schedule: | |
| - cron: '0 6 * * *' | |
| permissions: | |
| contents: read | |
| jobs: | |
| govulncheck: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Checkout this repo | |
| uses: actions/checkout@v6 | |
| with: | |
| path: worker | |
| - name: Checkout sibling InstaNode-dev/common | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: InstaNode-dev/common | |
| path: common | |
| - name: Checkout sibling InstaNode-dev/proto | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: InstaNode-dev/proto | |
| path: proto | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: worker/go.mod | |
| check-latest: true | |
| - run: go install golang.org/x/vuln/cmd/govulncheck@latest | |
| - name: Run govulncheck (fail only on fixable CVEs) | |
| working-directory: worker | |
| run: | | |
| set +e | |
| govulncheck -format json ./... > /tmp/govuln.json | |
| EXIT=$? | |
| if [ $EXIT -eq 3 ]; then | |
| python3 -c " | |
| import json, sys | |
| fixable = [ | |
| obj['finding']['osv'] | |
| for line in open('/tmp/govuln.json') | |
| for obj in [json.loads(line.strip())] | |
| if obj.get('type') == 'finding' and obj.get('finding', {}).get('fixed_version', '') | |
| ] | |
| if fixable: | |
| print('FAIL: fixable vulnerabilities found:', fixable) | |
| sys.exit(1) | |
| print('OK: only unfixable CVEs (acknowledged — no fix available upstream)') | |
| " | |
| elif [ $EXIT -ne 0 ]; then | |
| exit $EXIT | |
| fi |