Skip to content

fix(deps): remediate Go module vulnerabilities - #1224

Open
sozercan wants to merge 4 commits into
mainfrom
fix-vulns
Open

fix(deps): remediate Go module vulnerabilities#1224
sozercan wants to merge 4 commits into
mainfrom
fix-vulns

Conversation

@sozercan

@sozercan sozercan commented Jul 30, 2026

Copy link
Copy Markdown
Member

Summary

  • remove the unnecessary Trivy Go-library dependency and replace its report type with a minimal local JSON DTO
  • migrate the test-only ORAS dependency from v1 to v2 while preserving and testing legacy colon-delimited digest references, including registries with ports
  • upgrade OpenTelemetry, gRPC, and the required golang.org/x/* modules to fixed releases
  • upgrade the repository, Docker builders, CI, lint, CodeQL, and code-generation tooling to Go 1.26 / 1.26.5
  • copy Trivy 0.72.0 unchanged from the upstream release image instead of rebuilding it with local go get overrides
  • scope the blocking scanner-image gate to repository-owned content by skipping the unchanged upstream /trivy binary; the scheduled full-image scan remains unsuppressed
  • stabilize the pull-secret E2E check across overlapping rollouts while preserving actionable timeout diagnostics

Root cause

The scanner executes /trivy as a subprocess but imported the Trivy Go module only for logger initialization and report types. That import pulled a large vulnerable dependency graph, including Docker and containerd modules. The E2E image-reference helper also directly depended on vulnerable ORAS v1 and its Docker dependency chain.

The repository separately pinned an older Trivy executable and Go 1.24/1.25 across module, build, lint, and CI surfaces. The current upstream Trivy 0.72.0 release still contains dependency findings that have package-level fixes but are not yet present in an upstream release. This PR deliberately does not fork or patch Trivy's module graph, and it does not maintain a dedicated upstream ignore file. --ignore-unfixed remains enabled; the blocking PR scan skips only the unchanged upstream /trivy binary, while scheduled SARIF scanning continues to report it.

Validation

  • trivy fs --ignore-unfixed .: root go.mod has 0 findings; the existing docs/yarn.lock findings remain untouched
  • go mod verify and go mod tidy: clean
  • GOOS=linux GOARCH=amd64 go test -exec=true ./...
  • go test ./pkg/scanners/trivy ./test/e2e/util
  • GOOS=linux GOARCH=amd64 go test -exec=true -tags=e2e ./test/e2e/tests/helm_pull_secret
  • golangci-lint v2.12.2 in Linux: 0 issues
  • actionlint workflow validation with external shellcheck/pyflakes integrations disabled: clean
  • upstream-image linux/amd64 Trivy scanner build succeeds and embeds Trivy 0.72.0
  • no-cache linux/amd64 tooling-image build succeeds under Go 1.26.5
  • full scanner-image scan reports the upstream-binary findings; the blocking ownership-scoped scan skips /trivy and leaves the repository-owned scanner binary and OS layers clean
  • Claude Opus 5 max reviewed the final no-ignore-file scan policy and reported no actionable defects
  • Codex GPT-5.6 Sol max independently reviewed the final no-ignore-file scan policy, explicitly agreed with Claude, and reported no actionable defects; a separate controller-gen compatibility concern was rejected with a successful no-cache Go 1.26.5 tooling-image build

Copilot AI review requested due to automatic review settings July 30, 2026 22:44

Copy link
Copy Markdown
Member Author

@codex review

Copilot AI 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.

Pull request overview

Remediates Go module and bundled Trivy vulnerabilities while preserving scanner and e2e behavior.

Changes:

  • Removes Trivy’s Go-library dependency via a local report DTO.
  • Migrates ORAS v1 to v2 with legacy digest parsing compatibility.
  • Upgrades dependencies, Go tooling, and builds Trivy 0.72.0 from patched pinned source.
Show a summary per file
File Description
test/e2e/util/utils.go Migrates ORAS parsing while preserving legacy references.
pkg/scanners/trivy/types.go Replaces Trivy report types with local DTOs.
pkg/scanners/trivy/types_test.go Tests local report parsing.
pkg/scanners/trivy/trivy.go Removes Trivy logger initialization.
Makefile Configures source and legacy Trivy builds.
go.sum Updates module checksums.
go.mod Upgrades Go and dependencies.
Dockerfile Builds patched Trivy from pinned source.
build/tooling/Dockerfile Runs generators in the Go 1.25 environment.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 8/9 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 89787cfc3d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI review requested due to automatic review settings July 31, 2026 04:03

Copy link
Copy Markdown
Member Author

@codex review

Copilot AI 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.

Review details

  • Files reviewed: 8/9 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Keep it up!

Reviewed commit: 223ed0aba0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI review requested due to automatic review settings July 31, 2026 07:05

Copy link
Copy Markdown
Member Author

@codex review

Copilot AI 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.

Review details

Suppressed comments (2)

go.mod:5

  • The PR description says this change preserves the repository's Go 1.25 baseline and validates with Go 1.25.12, but the module now requires Go 1.26 (and the Docker/tooling/workflow changes likewise use 1.26.5/1.26). This drops the claimed Go 1.25 compatibility and means the documented validation does not cover the submitted configuration. Keep the 1.25.12 baseline throughout, or update the PR scope and rerun validation against 1.26.
go 1.26.0

toolchain go1.26.5

build/tooling/Dockerfile:4

  • The PR description says the existing pinned generators are retained and their generated output is preserved, but this changes controller-gen from v0.14.0 to v0.16.4 and the PR also changes generated RBAC/CRD files. Either retain the existing generator/output as claimed, or update the PR scope and validation to explicitly cover the generator upgrade and resulting manifest changes.
# v0.16.4 is the minimum controller-gen release whose x/tools builds with Go 1.26.
RUN GOTOOLCHAIN=local GO111MODULE=on go install sigs.k8s.io/controller-tools/cmd/controller-gen@v0.16.4
  • Files reviewed: 20/21 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Hooray!

Reviewed commit: 8067b1c074

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI review requested due to automatic review settings July 31, 2026 07:12

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: f2388f1325

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI 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.

Review details

  • Files reviewed: 25/26 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI review requested due to automatic review settings July 31, 2026 07:49

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 1b8d73c69f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI 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.

Review details

  • Files reviewed: 26/27 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

Copilot AI review requested due to automatic review settings July 31, 2026 08:02

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. More of your lovely PRs please.

Reviewed commit: 335121a0d5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI 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.

Review details

  • Files reviewed: 26/27 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

sozercan added 2 commits July 31, 2026 19:07
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Copilot AI review requested due to automatic review settings August 1, 2026 02:29

Copilot AI 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.

Review details

  • Files reviewed: 28/29 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread Dockerfile
Comment on lines +4 to +6
# Use the upstream Trivy release image rather than rebuilding its binary with
# local dependency overrides.
ARG TRIVY_BINARY_IMG="ghcr.io/aquasecurity/trivy:0.72.0"
Copilot AI review requested due to automatic review settings August 1, 2026 02:56

Copilot AI 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.

Review details

  • Files reviewed: 28/29 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

sozercan added 2 commits July 31, 2026 21:24
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
Copilot AI review requested due to automatic review settings August 1, 2026 04:25

Copilot AI 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.

Review details

  • Files reviewed: 27/28 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6bee101244

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

exit-code: "1"
ignore-unfixed: true
# The upstream binary remains visible in the scheduled full-image scan.
skip-files: trivy

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Replace the scanner-wide vulnerability exclusion

Whenever the copied /trivy executable gains another fixed vulnerability, this push/PR gate will still pass because the action defines skip-files as a path-level exclusion rather than a CVE-specific waiver (pinned action input documentation). The separate Monday SARIF workflow does not set a nonzero exit-code, so it can report such findings but cannot block the vulnerable image from merging or being released; use narrowly scoped, expiring vulnerability exceptions instead of excluding the entire scanner binary.

Useful? React with 👍 / 👎.

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.

2 participants