Skip to content

ci: gate govulncheck on an allowlist and accept GO-2026-6278 - #1640

Merged
lklimek merged 8 commits into
devfrom
ci/govulncheck-allowlist
Nov 25, 2026
Merged

lklimek merged 8 commits into
devfrom
ci/govulncheck-allowlist

Conversation

@Claudius-Maginificent

@Claudius-Maginificent Claudius-Maginificent commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

TL;DR: The vulnerability scan stops failing every pull request on a low-impact gorilla/websocket advisory that has no released fix, by letting the project accept a reported vulnerability with a written justification.

User story

As a Tenderdash maintainer, I want the vulnerability scan to fail only on vulnerabilities we have not consciously accepted, to keep it a meaningful merge gate instead of a check everyone learns to ignore.

Scenario

Base flow

  1. A contributor opens any pull request; the Vulnerability Scan workflow runs make vulncheck.

Actual behavior

The scan fails on every pull request (and on dev) with GO-2026-6278 in github.com/gorilla/websocket v1.5.3. v1.5.1 and v1.5.2 are unaffected, but dependencies (cometbft, oasis-core, gosec) require v1.5.3, and no later tagged release contains the fix. govulncheck offers no way to accept a finding, so the check stays red regardless of the change.

Expected behavior

The scan passes when every vulnerability the code calls is either fixed or listed for the detected module version, with a justification, in .github/govulncheck-allowlist.txt. Accepted findings show up as warnings; a new, unlisted one still fails the check.

Detailed discussion

What was done

  • scripts/govulncheck-gate.py runs govulncheck with -format json (which always exits 0), keeps only symbol-level findings (the code calls the vulnerable symbol), and fails on any whose OSV ID and module version (from the first trace frame) are not in the allowlist. Each entry reads <OSV ID> <module>@<version> <justification>, so a dependency change to another affected release does not inherit an earlier assessment. It prints the summary, fixed version and an example trace for each blocking finding, a ::warning:: for each allowed one, a ::notice:: for allowlist entries the code no longer calls (or now calls only at another version, asking to re-assess the entry), and the IDs of vulnerabilities in imported or required but uncalled code.
  • The gate fails closed: a non-zero or signal exit of govulncheck (e.g. a package load error), output without a config message, a scan mode other than source or a scan level other than symbol, output whose SBOM lists no scanned packages, a finding without a trace, malformed JSON, and an allowlist entry with a malformed OSV ID, no module@version, no justification or a duplicate all fail the job.
  • The Vulnerability Scan workflow runs the gate's unit tests (scripts/tests/test_govulncheck_gate.py) before the scan.
  • .github/govulncheck-allowlist.txt accepts GO-2026-6278 for github.com/gorilla/[email protected]. Justification: v1.5.3 regressed from crypto/rand to math/rand for client frame mask keys; only Tenderdash's WebSocket client (rpc/jsonrpc/client) masks frames, the node's WebSocket server does not; the mask carries no confidentiality (its key travels in the frame) and only shields WebSocket-unaware intercepting proxies from cache poisoning by attacker-chosen client payloads; since Go 1.22 top-level math/rand draws from the runtime's ChaCha8 generator by default (GODEBUG=randautoseed=0, or randseednop=0 with an explicit rand.Seed, selects the legacy one; Tenderdash sets neither); the fix exists only as the untagged master pseudo-version v1.5.4-0.20240701034025-d67f41855da4, and dependencies pin v1.5.3.
  • make vulncheck uses the gate; govulncheck is bumped from v1.9.0 to v1.10.0 (neither version has a suppression option).

Out of scope: upgrading gorilla/websocket to an untagged pseudo-version, or replacing the library.

Known limitations: the gate accepts by OSV ID and module version, not per call site: a new call path to an allowed vulnerability is accepted too. Package- and module-level findings (imported or required but not called) never fail the gate, matching govulncheck's own exit behaviour.

Testing

  • python3 -B -m unittest discover -s scripts/tests -p test_govulncheck_gate.py: 22 tests covering the allow/block decisions, every fail-closed path above, and main() exit propagation. All scripts/tests pass; ruff check and ruff format are clean.
  • Real govulncheck v1.10.0 over ./rpc/... ./light/...: with the allowlist the gate exits 0 and warns about GO-2026-6278; with an empty allowlist it exits 1 and prints the WSClient.dial → websocket.Dialer.Dial trace.

Breaking changes

None.

Prior work

Attribution

🤖 Co-authored by Claudius the Magnificent AI Agent

🤖 Generated with Claude Code

PR Hygiene · 523d29c

  • Bots — thepastaclaw skipped by lklimek
  • Self-review — not asked of a bot author
  • Build running
  • Approvals
    • github (.github/govulncheck-allowlist.txt, .github/workflows/govulncheck.yml) — approved by lklimek
    • files with no dedicated owner (Makefile, scripts/govulncheck-gate.py, scripts/tests/test_govulncheck_gate.py) — lklimek or shumkov

When every merge requirement is met, the PR Hygiene check passes. Reviewer limits do not block merging; other required GitHub checks and protections still apply.

govulncheck has no way to suppress a finding. `make vulncheck` now runs
it with `-format json` and fails only for vulnerabilities the code calls
that .github/govulncheck-allowlist.txt does not justify; allowed findings
print a warning and stale entries a notice.

Allow GO-2026-6278 (gorilla/websocket weak PRNG for client frame mask
keys): masking carries no confidentiality, only the WebSocket client
masks, and the fix exists only as an untagged master pseudo-version.

Also bump govulncheck to v1.10.0.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

Run configuration

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@thepastaclaw

thepastaclaw commented Nov 25, 2026 •

Copy link
Copy Markdown

⏹️ Not reviewed — PR is closed (merged) (commit 523d29c)

lklimek and others added 2 commits November 25, 2026 12:20
- Fail unless govulncheck reports a symbol-level scan, and on findings
  without a trace, instead of passing them silently.
- Reject allowlist entries with a malformed OSV ID or listed twice;
  split entries on any whitespace.
- Report vulnerabilities in imported or required but uncalled code.
- Treat a scanner killed by a signal as a failure.
- Follow the scripts/ layout: govulncheck-gate.py with its tests in
  scripts/tests, run by the Vulnerability Scan workflow.
- Correct the GO-2026-6278 justification: v1.5.1 and v1.5.2 are
  unaffected, but dependencies pin v1.5.3.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
A listed vulnerability that is still imported but no longer called got
'no longer reported' next to the uncalled summary that lists it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Claudius-Maginificent
Claudius-Maginificent marked this pull request as ready for review November 25, 2026 12:25
@github-actions

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Nov 25, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Final validation — Phase 2 only (queue backlog)

This PR adds a govulncheck allowlist that reports GO-2026-6278 as a warning while continuing to fail on unlisted vulnerabilities that the code calls. The vulnerability scan, all 15 gate tests, and the build, test, and lint checks passed; PR Hygiene is still pending.

🟡 3 suggestion(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); reviewer 2: gpt-6.2-sol (agent: phase2-reviewer, role: general); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The PR adds a CI gate whose finding classification, allowlist validation, and failure handling warrant review, but it does not change a critical runtime surface.
  • Phase 1 reviewers: not run (skipped for throughput: 11 PRs queued, above the 10 limit)
  • Second Phase-2 pass: on this first full review every Phase-2 reviewer also ran a second, independent time, and the verifier weighed both sets
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer, gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `scripts/govulncheck-gate.py`:
- [SUGGESTION] scripts/govulncheck-gate.py:92-97: The v1.5.3 exception also admits other affected WebSocket releases
  Impact: If a dependency change selects another affected Gorilla WebSocket release, maintainers get a passing scan even though the written exception only assesses v1.5.3.
  A dependency change can inherit a risk acceptance written for a different release. The gate matches only the OSV ID, but GO-2026-6278 also covers a separate range before v1.5.1, so the ID does not establish that the scanner found v1.5.3. Match each called finding against the advisory ID, module path, and version from its first trace frame before grouping findings for display, and include the detected version in the warning.
- [SUGGESTION] scripts/govulncheck-gate.py:64-73: The gate can report a clean scan after a metadata query that checked no code
  Impact: If a maintainer reuses the wrapper with govulncheck's JSON query mode, the check passes without analyzing any Tenderdash packages.
  A successful database lookup can produce the same passing verdict as a clean source scan. Govulncheck v1.10.0 defaults `scan_level` to `symbol` even in query mode, which emits advisory metadata but no call findings, and `test_clean_scan_passes` explicitly accepts config-only output. The checked-in Makefile runs a real source scan. Require `scan_mode: source` and an `SBOM` with non-empty `roots`, which the pinned scanner emits even when there are no findings, and update the tests to distinguish a clean scan from missing scan output.

In `.github/govulncheck-allowlist.txt`:
- [SUGGESTION] .github/govulncheck-allowlist.txt:6: The WebSocket exception assumes ChaCha8 even when Go uses the legacy generator
  Impact: Operators assessing WebSocket clients run with legacy Go randomness settings can mistakenly rely on the exception's ChaCha8 rationale.
  The stated mitigation depends on runtime settings, not just the Go version. Gorilla v1.5.3 uses top-level `math/rand.Uint32`; on the pinned Go 1.27.4, `GODEBUG=randautoseed=0` selects the legacy generator, and `randseednop=0` lets an explicit `rand.Seed` call select it too. The repository does not enable either override. Describe ChaCha8 as the default under Tenderdash's runtime settings rather than an unconditional guarantee.

Comment thread scripts/govulncheck-gate.py Resolved
Comment thread scripts/govulncheck-gate.py Resolved
Comment thread .github/govulncheck-allowlist.txt Resolved
@github-actions

Copy link
Copy Markdown

Ready for review — github: ktechmidas or lklimek or shumkov · files with no dedicated owner: lklimek or shumkov.
Full checklist in the description.

@github-actions github-actions Bot added ready-for-human PR Hygiene: bots done, author self-reviewed, awaiting human review and removed waiting-bots Waiting for the review bots to report on this head labels Nov 25, 2026
lklimek and others added 2 commits November 25, 2026 14:28
An allowlist entry now names the module version its assessment covers
(<OSV ID> <module>@<version> <justification>), so a dependency change to
another affected release of the same advisory fails the gate instead of
inheriting the old exception. The gate also requires a source-mode scan
with SBOM roots, so output that analysed no packages (e.g. query mode)
cannot pass as a clean scan. The GO-2026-6278 justification states that
ChaCha8 is the default generator, not an unconditional guarantee.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
When an allowlisted advisory is called only at another module version, the
gate's notice asks to re-assess and update the entry instead of removing
it. A frame without a module or version blocks with a readable name
instead of a traceback. The allowlist header says replaced modules are
named by their replacement and the standard library as stdlib@<Go version>.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added waiting-bots Waiting for the review bots to report on this head and removed ready-for-human PR Hygiene: bots done, author self-reviewed, awaiting human review labels Nov 25, 2026

@thepastaclaw thepastaclaw left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review — Final validation — Phase 2 only (queue backlog)

New on this head: This update pins govulncheck exceptions to exact module versions, requires a symbol-level source scan with package roots, and adds guidance when an advisory is detected at a different version. Govulncheck, the Linux build, Go vet, and lint passed on this head; unit, app, ABCI CLI, and end-to-end tests were still pending.

🟡 1 suggestion(s) | 💬 1 nitpick(s)

Approved: nothing here blocks the merge. The non-blocking findings are optional: fix them forward, in this PR or a follow-up, without waiting for another review round.

Review provenance

Source: reviewer 1: gpt-6.2-sol (agent: phase2-reviewer, role: general); final verifier: gpt-6.2-sol (agent: sol-verifier, role: final-verifier)

  • Triage: normal by gpt-6.2-sol (effort low) — The change adds nontrivial CI gate logic for parsing scan results, matching version-specific exceptions, and failing closed, but it does not modify a critical runtime surface.
  • Phase 1 reviewers: not run (skipped for throughput: 13 PRs queued, above the 10 limit)
  • Fresh verifier: gpt-6.2-sol — final-verifier; agent sol-verifier
  • Phase 2 reviewers: gpt-6.2-sol — general (completed, effort high); agent phase2-reviewer
🤖 Prompt for all review comments with AI agents
These findings are from an automated code review (PastaClaw). How to work through them:
- Verify each finding against the code; fix only what is real, as narrowly as the finding.
- If a finding is wrong, decline it on its thread in one or two sentences; the bot answers once and stops.
- To defer one, link a tracking issue on its thread (or reply asking the bot to file one).
- Suggestions don't block the merge, but most are worth fixing in this PR; judge each on its merits.
- Keep the PR's scope; don't grow it to satisfy hardening suggestions.
- Carried items were raised in an earlier round: read the thread first, and don't re-fix what you already fixed, declined or deferred there. Disputed and deferred items are already handled and are not listed.

In `scripts/govulncheck-gate.py`:
- [SUGGESTION] scripts/govulncheck-gate.py:124-131: The gate asks for reassessment when the detected version is already approved
  Impact: When maintainers allowlist two versions for the same advisory and a scan detects only one, the gate tells them to update the unused entry to a version they have already approved.
  Following the notice can create a duplicate entry that `load_allowlist` rejects on the next run. The notice added in `58d08199f` searches all called findings by advisory ID, so it can recommend updating to the same version the preceding warning already accepts. Use `blocked` to identify versions that need reassessment, and add a test where two versions are allowlisted but only one is detected.

In `.github/govulncheck-allowlist.txt`:
- [NITPICK] .github/govulncheck-allowlist.txt:5-6: The standard-library exception format looks like it accepts the output of `go version`
  Impact: A maintainer who reads `stdlib@<Go version>` and enters `[email protected]` gets an allowlist parse error.
  The header leaves the required prefix unclear. The gate requires a `v` prefix, and govulncheck normalizes `go1.27.4` to `v1.27.4` in the finding frame. Show the exact form to copy from the finding.

Comment thread scripts/govulncheck-gate.py Resolved
Comment thread .github/govulncheck-allowlist.txt Resolved
Comment thread scripts/govulncheck-gate.py Resolved
Comment thread scripts/govulncheck-gate.py Resolved
Comment thread .github/govulncheck-allowlist.txt Resolved
@github-actions github-actions Bot removed the waiting-bots Waiting for the review bots to report on this head label Nov 25, 2026
@lklimek
lklimek enabled auto-merge (squash) November 25, 2026 14:46
@github-actions

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

@github-actions github-actions Bot added the waiting-bots Waiting for the review bots to report on this head label Nov 25, 2026
Copilot AI requested a review from lklimek November 25, 2026 15:14
The re-assess notice for an unused allowlist entry listed every called
version of the advisory, including one another entry already accepts;
following it would duplicate that entry. It now lists only blocked
versions, so an entry unused beside an accepted version gets the plain
"no longer called" notice. The allowlist header shows the exact stdlib
form ([email protected]), not the go1.27.4 spelling of `go version`.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@github-actions

github-actions Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Waiting for bot review — thepastaclaw not yet. Wait for the missing reviews, or a writer can post /skip-bots to proceed without them; blocking findings still need addressing.
Full checklist in the description.

This reverts commit 12a300e, which is
outside the scope of this PR (the govulncheck allowlist gate).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@lklimek
lklimek disabled auto-merge November 25, 2026 15:46
@lklimek

lklimek commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

/skip-bots

@github-actions github-actions Bot removed the waiting-bots Waiting for the review bots to report on this head label Nov 25, 2026
@lklimek
lklimek disabled auto-merge November 25, 2026 16:10
@lklimek
lklimek merged commit bb646ad into dev Nov 25, 2026
14 of 28 checks passed
@lklimek
lklimek deleted the ci/govulncheck-allowlist branch November 25, 2026 16:10
@github-actions github-actions Bot added this to the v2.0 milestone Nov 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants