diff --git a/.github/workflows/go-vuln-scan.yml b/.github/workflows/go-vuln-scan.yml new file mode 100644 index 00000000..12904755 --- /dev/null +++ b/.github/workflows/go-vuln-scan.yml @@ -0,0 +1,55 @@ +name: Go Vulnerability Scan + +on: + push: + branches: + - main + paths: + - "**.go" + - "go.mod" + - "go.sum" + pull_request: + paths: + - "**.go" + - "go.mod" + - "go.sum" + schedule: + # Run weekly on Monday at 08:00 UTC to catch newly disclosed vulnerabilities + - cron: "0 8 * * 1" + +permissions: + contents: read + +jobs: + govulncheck: + name: govulncheck + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: "1.24" + check-latest: true + + - name: Install govulncheck + run: go install golang.org/x/vuln/cmd/govulncheck@latest + + - name: Run govulncheck + run: govulncheck ./... + + gosec: + name: gosec + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-go@v5 + with: + go-version: "1.24" + check-latest: true + + - name: Run gosec + uses: securego/gosec@master + with: + args: -severity high -confidence medium -exclude-generated ./... diff --git a/CHANGELOG.md b/CHANGELOG.md index 30468245..a135fa4c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Added + +- Add Go vulnerability scanning CI workflow using `govulncheck` and `gosec` ([#65](https://github.com/KiiChain/kiichain/issues/65)) + ### Fixed - Fix division-by-zero chain halt in `CalculateReward` caused by sub-second schedule durations; replace `Seconds()` truncation with `Nanoseconds()` precision and release full remaining reward when `EndTime <= LastReleaseTime` ([#267](https://github.com/KiiChain/kiichain/issues/267))