Skip to content

chore(ci): resolve Trivy install/dependency and Gosec HIGH-severity CI failures - #73

Merged
mridulgain merged 6 commits into
masterfrom
mg/fix-trivy-ci-install-failure
Aug 19, 2026
Merged

chore(ci): resolve Trivy install/dependency and Gosec HIGH-severity CI failures#73
mridulgain merged 6 commits into
masterfrom
mg/fix-trivy-ci-install-failure

Conversation

@mridulgain

@mridulgain mridulgain commented Aug 19, 2026

Copy link
Copy Markdown

Summary

Trivy install

  • Replaced the apt install + manual trivy fs invocation with aquasecurity/trivy-action@v0.35.0, already used elsewhere in this repo (artifacts.yaml), which resolves trivy via GitHub releases instead of the flaky apt mirror. (Check KAAP-2013)

Gosec & trivy

  • Fix 23 pre-existing HIGH findings based on the Gosec Security Scan job
  • Fix based on trivy reports

Test plan

  • go build ./..., go vet ./..., go test ./... pass across all three modules (root, examples, api/v2)

  • Confirm both Trivy Security Scan (Full) and Gosec Security Scan (Full) jobs pass in CI on this PR

🤖 Generated with Claude Code

mridulgain and others added 2 commits August 19, 2026 10:44
The Trivy security-scan workflow was pinned to installing
trivy=0.69.3 via the aquasecurity apt repo. That repo doesn't
reliably keep every released .deb available, so the pinned version
was removed and the "Install Trivy" step now fails with:

  E: Version '0.69.3' for 'trivy' was not found

Replace the apt-based install and manual `trivy fs` invocation with
aquasecurity/trivy-action@v0.35.0 (already used elsewhere in this
repo, see artifacts.yaml), which resolves trivy through GitHub
releases directly instead of the flaky apt mirror. The vulnerability
count-check and output-setting logic is preserved in a separate
"Check for vulnerabilities" step so trivy_high_found stays wired up
for downstream steps.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The Gosec Security Scan job fails CI whenever it reports any HIGH or
CRITICAL finding. A full-repo scan surfaced 23 pre-existing HIGH
findings, none introduced by this branch:

- G101 hardcoded-credentials: false positives on OAuth2/SAML spec
  constant strings (token-type URNs, grant-type URNs, endpoint URLs)
  and a k8s service-account token file path — none are secrets.
- G402 InsecureSkipVerify: intentional, admin-configured TLS
  bypass options in the httpclient, ldap, and keystone connectors.
- G404 weak RNG: math/rand used only for retry backoff jitter, not
  security-sensitive.
- G704/G204 SSRF/command-injection via taint analysis: the GitHub
  connector's apiURL comes from admin config or GitHub's own
  pagination headers, and the docker-entrypoint execs its own
  container argv/gomplate invocation — neither is attacker input.

Each suppression carries an inline justification. The generated
api/api_grpc.pb.go findings are handled by passing -exclude-generated
to gosec instead of annotating generated code.

Verified locally: `gosec -exclude-generated ./...` now reports 0
HIGH/CRITICAL (down from 23), 29 MEDIUM findings remain untouched
since they don't gate CI.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mridulgain mridulgain changed the title fix(ci): replace apt-based trivy install with official trivy-action fix(ci): resolve Trivy install and Gosec HIGH-severity CI failures Aug 19, 2026
The Trivy Filesystem Scan now runs successfully (after the install
fix) and surfaced real, pre-existing HIGH/CRITICAL CVEs in all three
Go modules (root, examples/, api/v2/):

- CVE-2026-33186 (CRITICAL) and GHSA-hrxh-6v49-42gf (HIGH) in
  google.golang.org/grpc -> bumped to v1.83.0
- CVE-2026-25681, CVE-2026-27136, CVE-2026-33814, CVE-2026-39821,
  CVE-2026-46600 in golang.org/x/net -> bumped to v0.58.0
- CVE-2026-56852 in golang.org/x/text -> bumped to v0.41.0
- CVE-2025-47913, CVE-2026-39828..39832, CVE-2026-39835,
  CVE-2026-42508, CVE-2026-46595, CVE-2026-46597 in
  golang.org/x/crypto -> bumped to v0.55.0
- CVE-2026-34986 in github.com/go-jose/go-jose/v4 -> bumped to v4.1.4
- CVE-2026-33487 in github.com/russellhaering/goxmldsig -> bumped to
  v1.6.0
- CVE-2026-29181 in go.opentelemetry.io/otel -> bumped to v1.45.0

grpc v1.82.1+ (needed for GHSA-hrxh-6v49-42gf) requires Go 1.25, so
this also bumps go.mod's go directive 1.24.0 -> 1.25.0 in all three
modules, ci.yaml's pinned go-version 1.24 -> 1.25, and the Dockerfile
builder base image to golang:1.25.13-alpine3.23.

The Go 1.25 toolchain's stricter vet printf check flagged two
existing non-constant-format-string calls to the newRedirectedErr
helper in server/oauth2.go (a real latent bug: a '%' in a redirect
URI or connector-derived value could have been misinterpreted as a
format verb); fixed by passing the value as a %s argument instead of
as the format string itself.

Verified: go build/vet/test pass across all three modules (root,
examples, api/v2); the one remaining test failure
(TestVerifyUnsignedMessageAndSignedAssertionWithRootXmlNs) is a
pre-existing, unrelated fixture-cert-expiry issue already fixed on a
separate branch (PR #72).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@mridulgain mridulgain changed the title fix(ci): resolve Trivy install and Gosec HIGH-severity CI failures fix(ci): resolve Trivy install/dependency and Gosec HIGH-severity CI failures Aug 19, 2026
@mridulgain mridulgain changed the title fix(ci): resolve Trivy install/dependency and Gosec HIGH-severity CI failures chore(ci): resolve Trivy install/dependency and Gosec HIGH-severity CI failures Aug 19, 2026
golangci-lint v1.64.5 (pinned in Makefile) was built with Go 1.24 and
refuses to lint a module targeting a newer Go version:

  Error: can't load config: the Go language version (go1.24) used to
  build golangci-lint is lower than the targeted Go version (1.25.0)

This became a hard failure once go.mod's go directive was bumped to
1.25.0 (see the grpc CVE fix on the parent branch). golangci-lint's
v1 line is discontinued, so there is no newer v1.x build to pin
instead — migrated to v2.12.2.

- Ran `golangci-lint migrate` to convert .golangci.yml to the v2
  schema. gosimple/stylecheck are now folded into v2's staticcheck
  meta-linter (same checks, no behavior change intended).
- Bumped Makefile's GOLANGCI_VERSION to 2.12.2.
- Fixed the new findings the newer staticcheck/prealloc checks
  surfaced, all pre-existing and mechanical:
  - Removed embedded-field redundancy (`x.Embedded.Field` ->
    `x.Field`) in server/oauth2.go, server/rotation.go, and several
    storage/kubernetes files.
  - Converted an equality-chain switch to a tagged switch in
    server/oauth2.go.
  - Preallocated a slice with known capacity in
    storage/conformance/conformance.go.
  - Removed two `//nolint:prealloc` directives in
    connector/keystone/keystone.go that prealloc no longer flags.
  - Simplified `c.Config.Field` to `c.Field` in
    connector/atlassiancrowd/atlassiancrowd_test.go (embedded Config).

Verified: `golangci-lint run` reports 0 issues; go build/vet/test
pass (the one remaining test failure is the pre-existing,
unrelated SAML fixture-cert-expiry issue fixed on a separate branch,
PR #72).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…roken

CI failed installing golangci-lint v2.12.2:

  err hash_sha256_verify checksum for '.../golangci-lint-2.12.2-linux-amd64.tar.gz' did not verify
  8df580d2670fed8fa984aac0507099af8df275e665215f5c7a2ae3943893a553 vs fd3a137c7e722128143cc8932bcaa00bc73e10adadee18bdb0893453edb2c137

The computed hash (fd3a137c...) matches the checksum published for
golangci-lint-2.12.2-linux-amd64.tar.gz.sbom.json, not the .tar.gz
itself — install.sh's asset-matching picked the wrong file for this
release. Reproduces the same way on darwin-arm64, so it's a bug in
this specific release's assets/naming, not a platform issue.

v2.11.0 installs correctly via the same script (verified locally),
is built with go1.26.1 (satisfies the go1.25 language-version floor
golangci-lint enforces against go.mod), and lints this repo with the
migrated v2 config at 0 issues.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
hsri-pf9
hsri-pf9 previously approved these changes Aug 19, 2026
@mridulgain mridulgain self-assigned this Aug 19, 2026
fix(lint): migrate golangci-lint config to v2 (required by Go 1.25 bump)
Comment thread Makefile
Comment thread api/v2/go.mod
@mridulgain
mridulgain merged commit 0bbe683 into master Aug 19, 2026
10 of 11 checks passed
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