Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/dependencies-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# SPDX-License-Identifier: Apache-2.0

name: Dependency Review

on:
pull_request:
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

permissions: read-all

env:
OSV_SCANNER_VERSION: 2.7.0

jobs:
dependency-review:
name: Dependency Review
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7

- name: Resolve accepted advisories
id: allowlist
run: |
set -euo pipefail
ghsas="$(./scripts/osv-ignored.sh)"
echo "Accepted GHSAs: ${ghsas:-none}"
printf 'ghsas=%s\n' "$ghsas" >> "$GITHUB_OUTPUT"

- uses: actions/dependency-review-action@a1d282b36b6f3519aa1f3fc636f609c47dddb294 # v5.0.0
with:
base-ref: ${{ github.event.pull_request.base.sha || 'main' }}
head-ref: ${{ github.event.pull_request.head.sha || github.ref }}
fail-on-severity: high
comment-summary-in-pr: on-failure
allow-ghsas: ${{ steps.allowlist.outputs.ghsas }}

- uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7
with:
go-version-file: go.mod
cache-dependency-path: |
go.sum
simapp/go.sum
modules/light-clients/08-wasm/go.sum
e2e/go.sum

# Same scanner and config (osv-scanner.toml) as the OpenSSF Scorecard check. Go call
# analysis limits Go findings to vulnerabilities reachable from ibc-go code.
- name: OSV-Scanner
run: go run "github.com/google/osv-scanner/v2/cmd/osv-scanner@v${OSV_SCANNER_VERSION}" scan source -r --call-analysis=go .
20 changes: 20 additions & 0 deletions docs/dev/development-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,26 @@ Other helpful commands:
- `go get -u` to update an existing dependency.
- `go mod tidy` to update dependencies in `go.sum`.

## Vulnerability scanning

The [OpenSSF Scorecard](https://scorecard.dev/viewer/?uri=github.com/cosmos/ibc-go) Vulnerabilities check uses [OSV-Scanner](https://google.github.io/osv-scanner/). To reproduce it locally, scan every manifest in the repository (all `go.mod` files, `requirements.txt` and `docs/package-lock.json`) from the repository root:

```shell
go run github.com/google/osv-scanner/v2/cmd/osv-scanner@latest scan source -r .
```

To check whether ibc-go code actually calls a reported Go vulnerability, enable Go call analysis, which runs [govulncheck](https://go.dev/doc/tutorial/govulncheck) while still applying `osv-scanner.toml`. Add `--all-vulns` to also list vulnerabilities that are not called:

```shell
go run github.com/google/osv-scanner/v2/cmd/osv-scanner@latest scan source -r --call-analysis=go .
```

Fix vulnerabilities by bumping the dependency, then run `make tidy-all`. For the docs site, use `npm audit fix --package-lock-only` in `docs/`, or add an entry to `overrides` in `docs/package.json` when a transitive dependency pins a vulnerable version.

A vulnerability with no fix, or one that does not affect ibc-go, can be ignored by adding an `[[IgnoredVulns]]` entry with an `id` and a `reason` to the root `osv-scanner.toml`. OSV-Scanner only applies that file to manifests in the same directory, so every other manifest directory has an `osv-scanner.toml` symlink to it. Edit only the root file.

On every pull request, the Dependency Review workflow (`.github/workflows/dependencies-review.yml`) runs the call-analysis scan above and also fails on newly introduced high-severity vulnerabilities. Both accept the advisories listed in the root `osv-scanner.toml`.

## Protobuf

We use [Protocol Buffers](https://developers.google.com/protocol-buffers) along with [buf](https://docs.buf.build/introduction) and [gogoproto](https://github.com/gogo/protobuf) to generate code for use in ibc-go.
Expand Down
1 change: 1 addition & 0 deletions docs/osv-scanner.toml
Loading
Loading