Skip to content

Commit d9d7583

Browse files
wolfeidauCosmin Cojocar
authored and
Cosmin Cojocar
committed
update README with instructions on how to integrate with GitHub codescanning
1 parent 3ed39fe commit d9d7583

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

README.md

+36
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,42 @@ jobs:
7474
args: ./...
7575
```
7676
77+
### Integrating with code scanning
78+
79+
You can [integrate third-party code analysis tools](https://docs.github.com/en/github/finding-security-vulnerabilities-and-errors-in-your-code/integrating-with-code-scanning) with GitHub code scanning by uploading data as SARIF files.
80+
81+
The workflow shows an example of running the `gosec` as a step in a GitHub action workflow which outputs the `results.sarif` file. The workflow then uploads the `results.sarif` file to GitHub using the `upload-sarif` action.
82+
83+
```yaml
84+
name: "Security Scan"
85+
86+
# Run workflow each time code is pushed to your repository and on a schedule.
87+
# The scheduled workflow runs every at 00:00 on Sunday UTC time.
88+
on:
89+
push:
90+
schedule:
91+
- cron: '0 0 * * 0'
92+
93+
jobs:
94+
tests:
95+
runs-on: ubuntu-latest
96+
env:
97+
GO111MODULE: on
98+
steps:
99+
- name: Checkout Source
100+
uses: actions/checkout@v2
101+
- name: Run Gosec Security Scanner
102+
uses: securego/gosec@master
103+
with:
104+
# we let the report trigger content trigger a failure using the GitHub Security features.
105+
args: '-no-fail -fmt sarif -out results.sarif ./...'
106+
- name: Upload SARIF file
107+
uses: github/codeql-action/upload-sarif@v1
108+
with:
109+
# Path to SARIF file relative to the root of the repository
110+
sarif_file: results.sarif
111+
```
112+
77113
### Local Installation
78114

79115
```bash

0 commit comments

Comments
 (0)