Skip to content

fix(ci): dedupe govulncheck SARIF stacks via ci:vulncheck mage target - #3347

Merged
Andriy Knysh (aknysh) merged 3 commits into
mainfrom
osterman/govulncheck-sarif-dedupe
Oct 9, 2026
Merged

Andriy Knysh (aknysh) merged 3 commits into
mainfrom
osterman/govulncheck-sarif-dedupe

Conversation

@osterman

@osterman Erik Osterman (Cloud Posse) (osterman) commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

what

  • Add a ci:vulncheck <output> Mage target that runs govulncheck -format sarif ./... and removes exact duplicate stack objects from the report before writing it.
  • Point the govulncheck job in codeql.yml at the target instead of redirecting the scanner's output straight into govulncheck.sarif.
  • The logic lives in a new internal/ci/vulncheck package with unit tests; the target is listed in magefiles/README.md.
  • The report replaces the output file atomically, and only after the scan succeeded and its output parsed as SARIF. A scanner failure, empty output, or malformed output fails the step and leaves any existing report untouched.

why

  • Job 113647222434 finished the scan but failed the SARIF upload: results 5, 11, 12, 13 and 15 contained duplicate stacks entries, and the SARIF schema requires that array to hold unique objects. Code scanning therefore received nothing.
  • Only complete duplicates are dropped. Every finding and every distinct stack (different message, different frame order) is kept, in its original position.
  • It is a Mage target, not workflow shell with jq, because the repo keeps CI logic of this size in unit-tested Go. A shell version also could not distinguish "no findings" from "scanner produced nothing", which matters when the output is uploaded to code scanning.
  • Coverage is 90.8% for the new package.

references

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Vulnerability scan reports now remove duplicate stack entries before submission, preventing duplicate-entry errors. Reports are preserved if scanning or report processing fails.
  • Chores
    • Updated the vulnerability scan workflow and artifact handling to improve CI reliability.
  • Documentation
    • Added guidance on vulnerability scan report handling and validation.

govulncheck can emit identical stack objects within a result, but the SARIF
schema requires them to be unique, so GitHub code scanning rejected the
upload even though the scan itself succeeded.

Add ci:vulncheck, which runs govulncheck and removes exact duplicate stacks
before atomically writing the report. Failed scans and malformed or empty
output fail the target and leave any existing report untouched.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@atmos-pro

atmos-pro Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@osterman Erik Osterman (Cloud Posse) (osterman) added the no-release Do not create a new release (wait for additional code changes) label Oct 9, 2026
@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: cloudposse/atmos/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 328f701a-6c30-409b-9760-0b2b45eb84d4

📥 Commits

Reviewing files that changed from the base of the PR and between 8d406f1 and 2d5ea3b.


⛔ Files ignored due to path filters (1)
  • go.sum is excluded by !**/*.sum

📒 Files selected for processing (13)
  • .github/actions/download-artifact-retry/action.yml
  • .github/actions/setup-go-cache/action.yml
  • .github/workflows/codeql.yml
  • .github/workflows/vhs.yaml
  • NOTICE
  • docs/fixes/2026-10-09-govulncheck-sarif-duplicate-stacks.md
  • go.mod
  • internal/ci/vulncheck/sarif.go
  • internal/ci/vulncheck/sarif_test.go
  • internal/ci/vulncheck/scan.go
  • internal/ci/vulncheck/scan_test.go
  • magefiles/README.md
  • magefiles/ci_vulncheck.go

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.



📝 Walkthrough

Walkthrough

The change adds a Mage-based govulncheck scan that removes duplicate SARIF stacks before writing its report. It updates the CodeQL workflow to use the target and includes related tests, documentation, workflow action updates, cache handling, and Go module version changes.

Changes

SARIF vulnerability scan

Layer / File(s) Summary
SARIF stack deduplication
internal/ci/vulncheck/sarif.go, internal/ci/vulncheck/sarif_test.go
Adds first-occurrence deduplication for repeated stack objects. Tests cover equality, ordering, report shapes, JSON value preservation, and invalid input.
Scan and report writing
internal/ci/vulncheck/scan.go, internal/ci/vulncheck/scan_test.go
Adds scan parameter validation, command execution, SARIF normalization, and temporary-file report replacement. Tests cover scan arguments, output, and failure cases.
Mage and CodeQL integration
magefiles/ci_vulncheck.go, magefiles/README.md, .github/workflows/codeql.yml, docs/fixes/*
Adds the Mage target and uses it in CodeQL. The README and fix report describe the target and reported validation status.

CI and dependency updates

Layer / File(s) Summary
Workflow and action updates
.github/actions/download-artifact-retry/action.yml, .github/actions/setup-go-cache/action.yml, .github/workflows/vhs.yaml
Pins artifact downloads to v8.0.2 and passes the cache-mode input to the shell step through an environment variable.
Go and module version updates
go.mod, NOTICE
Advances the declared Go version and selected module versions. Updates the corresponding license-source URLs.

Priority: ➖ Normal

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Low

Sequence Diagram(s)

sequenceDiagram
  participant CodeQL as CodeQL workflow
  participant Mage as CI.Vulncheck
  participant Scan as vulncheck.Scan
  participant Tool as govulncheck
  participant Dedupe as DedupeStacks
  participant Report as SARIF report
  CodeQL->>Mage: invoke vulncheck target
  Mage->>Scan: pass output path and context
  Scan->>Tool: run SARIF scan
  Tool-->>Scan: return SARIF output
  Scan->>Dedupe: normalize duplicate stacks
  Dedupe-->>Scan: return normalized SARIF
  Scan->>Report: replace report after successful scan and normalization
Loading

Suggested labels: patch, minor

Suggested reviewers: aknysh


Merge Risk: ⚪ Minimal · up to 2d5ea

The new scan target and upload path are aligned. No concrete issue currently blocks merging; the full scan and upload still need CI validation.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 25.81% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 5 files. (8 skipped: … Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies the main change: deduplicating govulncheck SARIF stacks through the new ci:vulncheck Mage target.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.

Full details: Docstring Coverage

Explanation

Docstring coverage is 25.81% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 31 functions across 5 files. (8 skipped: 8 unsupported.)



  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • 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

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues found.

Scanned Files

  • .github/workflows/vhs.yaml
  • go.mod

@github-actions github-actions Bot added the size/m Medium size PR label Oct 9, 2026
@github-actions

github-actions Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Warning

SHA Pin Verification Passed — with documented exceptions

All 239 third-party action reference(s) are covered, but 2 rely on a documented allowlist entry in allowlist.json and could not be automatically drift-checked. This does not fail CI, but should be reviewed.

Action Location Status Details
aquasecurity/[email protected] build.yml:162 ⚠️ Allowlisted (documented) The aquasecurity GitHub organization has enabled an IP allow list that blocks API access (git ref/tag lookups) from GitHub-hosted Actions runner IPs, for any caller, on any of their repos, including public ones — this is not specific to our token or workflow. Verified independently: the exact same 403 is reported against the sibling aquasecurity/tfsec-action, and trivy-cache-action's issue tracker explicitly confirms 'aquasecurity GitHub org now has IP allow list enabled, blocking API access'. Manually confirmed our pinned SHA is correct (dereferenced the v0.36.0 annotated tag directly against the GitHub API from a non-Actions IP; it matches) — this entry only silences the automated drift check, which the API access restriction makes impossible to run in CI, not the underlying security property.
aquasecurity/[email protected] test.yml:1294 ⚠️ Allowlisted (documented) The aquasecurity GitHub organization has enabled an IP allow list that blocks API access (git ref/tag lookups) from GitHub-hosted Actions runner IPs, for any caller, on any of their repos, including public ones — this is not specific to our token or workflow. Verified independently: the exact same 403 is reported against the sibling aquasecurity/tfsec-action, and trivy-cache-action's issue tracker explicitly confirms 'aquasecurity GitHub org now has IP allow list enabled, blocking API access'. Manually confirmed our pinned SHA is correct (dereferenced the v0.36.0 annotated tag directly against the GitHub API from a non-Actions IP; it matches) — this entry only silences the automated drift check, which the API access restriction makes impossible to run in CI, not the underlying security property.

See the action run for full details.

@mergify

mergify Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify Bot added the needs-cloudposse Needs Cloud Posse assistance label Oct 9, 2026
The pin comment used the floating `v8` tag, which upstream moved from
v8.0.1 to v8.0.2, so verify-sha-pinning reported a SHA mismatch. Pin to
the exact v8.0.2 tag so the check no longer drifts.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
…-cache

Go 1.26.9 and golang.org/x/net 0.60.0 fix the HTTP/2 vulnerabilities
GO-2026-6603, -6610, -6611, -6612 and -6617 that Scorecard reports. The
x/net bump also moves x/crypto, x/sync, x/sys, x/term, x/text and x/mod
forward by one release each.

setup-go-cache now passes inputs.cache to the shell through env instead of
interpolating it into the script, which resolves the Semgrep
run-shell-injection finding.

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

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

🚀 Go Version Change Detected

This PR changes the Go version:

  • Base branch (main): 1.26.8
  • This PR: 1.26.9
  • Change: ⬆️ Upgrade

Tip

Upgrade Checklist


This is an automated comment from the Go Version Check action.

@osterman

Copy link
Copy Markdown
Member Author

CodeRabbit (@coderabbitai) review

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 78.50467% with 23 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.80%. Comparing base (8d406f1) to head (2d5ea3b).

Files with missing lines Patch % Lines
internal/ci/vulncheck/scan.go 73.17% 6 Missing and 5 partials ⚠️
internal/ci/vulncheck/sarif.go 84.37% 5 Missing and 5 partials ⚠️
magefiles/ci_vulncheck.go 0.00% 2 Missing ⚠️

❌ Your patch check has failed because the patch coverage (78.50%) is below the target coverage (85.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3347      +/-   ##
==========================================
- Coverage   84.82%   84.80%   -0.02%     
==========================================
  Files        2135     2138       +3     
  Lines      208579   208686     +107     
==========================================
+ Hits       176917   176975      +58     
- Misses      23371    23401      +30     
- Partials     8291     8310      +19     
Flag Coverage Δ
unittests 84.80% <78.50%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
magefiles/ci_vulncheck.go 0.00% <0.00%> (ø)
internal/ci/vulncheck/sarif.go 84.37% <84.37%> (ø)
internal/ci/vulncheck/scan.go 73.17% <73.17%> (ø)

... and 15 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aknysh
Andriy Knysh (aknysh) added this pull request to the merge queue Oct 9, 2026
@atmos-pro

atmos-pro Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

Merged via the queue into main with commit ba97f20 Oct 9, 2026
131 checks passed
@aknysh
Andriy Knysh (aknysh) deleted the osterman/govulncheck-sarif-dedupe branch October 9, 2026 18:00
@atmos-pro

atmos-pro Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Tip

Atmos Pro  

No affected stacks workflow was detected for this pull request.
If this is expected, no action is needed.
Learn More. Ask AI.

@mergify mergify Bot removed the needs-cloudposse Needs Cloud Posse assistance label Oct 9, 2026
Erik Osterman (Cloud Posse) (osterman) added a commit that referenced this pull request Oct 9, 2026
Take main's ci:vulncheck mage target (#3347) over this branch's jq/shell
SARIF dedupe, and main's download-artifact v8.0.2 pin over the v8.0.1
comment-only fix. Drop the superseded jq script, its shell test and its
fix doc.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Erik Osterman (Cloud Posse) (osterman) added a commit that referenced this pull request Oct 9, 2026
Take main's download-artifact v8.0.2 pin and its ci:vulncheck SARIF dedupe
(#3347), dropping the equivalent changes cherry-picked earlier.

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

Copy link
Copy Markdown

These changes were released in v1.231.1-rc.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-release Do not create a new release (wait for additional code changes) size/m Medium size PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants