Skip to content

fix(ci): verify release tag secret-scan ranges - #4808

Merged
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-4806
Aug 11, 2026
Merged

fix(ci): verify release tag secret-scan ranges#4808
chet merged 1 commit into
NVIDIA:mainfrom
chet:gh-issue-4806

Conversation

@chet

@chet chet commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

This follows #4715 and #4788 by using the same shared resolver for tags (for both Core and REST), finding the closest tag behind the release commit on its first-parent history, and giving both secret scanners that exact base plus the current tag commit. Pull request behavior stays the same, and main/manual runs are unchanged.

  • Expected green-run effect: No reliable full-pipeline savings. Core avoids its observed open-ended scan, while REST intentionally does real work instead of zero.
  • What it really buys us: A green release-tag check from either workflow means both scanners were given the same known commit range.

Related issues

This supports #4806

Type of Change

  • Add - New feature or capability
  • Change - Changes in existing functionality
  • Fix - Bug fixes
  • Remove - Removed features or deprecated functionality
  • Internal - Internal changes (refactoring, tests, docs, etc.)

Breaking Changes

  • This PR contains breaking changes

Testing

  • Unit tests added/updated

  • Integration tests added/updated

  • Manual testing performed

  • No testing required (docs, internal refactor, etc.)

  • bash .github/ci/test-resolve-secret-scan-range.sh

  • Exercised the resolver against the existing v2.1.0-rc.2 tag; it returned v2.1.0-rc.1's commit as the base and the exact v2.1.0-rc.2 commit as the head.

  • Core/REST final-gate inventories, token-permission policies, concurrency policies, actionlint, Bash syntax, and git diff --check.

  • cargo make format-nightly

  • cargo make clippy

  • Cached full Carbide-lints gate.

Additional Notes

This does not create a test release tag because these workflows publish release artifacts. The next natural tag is the hosted acceptance check: Core and REST should log the same non-empty base/head range, with no No commits to scan fallback. Managed-action source-error classification remains separate from this repository-side range fix.

Closes #4806

On the `v2.1.0-rc.2` tag, Core and REST both reported clean secret scans, but neither checked the release range we meant. Core scanned about 23.9 MB of open-ended history because it had no head, while REST scanned zero bytes because it had neither a base nor a head.

So, use the shared scan-range resolver for tags too. It finds the closest tag behind the release commit on its first-parent history, then gives both scanners that exact base plus the current tag commit. Pull request behavior stays the same, and main/manual runs are unchanged.

Expected green-run effect: no reliable full-pipeline savings. Core avoids its observed open-ended scan, while REST intentionally does real work instead of zero.

What it really buys us: a green release-tag check from either workflow means both scanners were given the same known commit range.

This supports NVIDIA#4806

Signed-off-by: Chet Nichols III <chetn@nvidia.com>
@chet
chet requested a review from a team as a code owner August 11, 2026 02:50
@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Summary by CodeRabbit

  • New Features

    • Secret scanning now determines accurate, non-empty commit ranges for both pull requests and release tags.
    • Tag-based scans support verified release history, including annotated and lightweight tags.
  • Bug Fixes

    • Improved handling of invalid, missing, mismatched, or unsupported references.
    • Prevented scans from running against empty or incorrectly resolved ranges.
  • Tests

    • Expanded coverage for release-tag history and error scenarios.
    • CI now validates shared secret-scan range behavior.

Walkthrough

The PR replaces the PR-only scan-range resolver with a shared resolver. The resolver supports pull requests and release tags, validates refs and SHAs, rejects empty ranges, and integrates with Core and REST TruffleHog workflows.

Changes

Secret-scan range resolution

Layer / File(s) Summary
Pull-request and release-tag resolver
.github/ci/resolve-secret-scan-range.sh
The resolver validates inputs, resolves pull-request merge bases or previous release tags, rejects invalid ranges, and emits normalized base and head SHAs.
Resolver fixtures and validation
.github/ci/test-resolve-secret-scan-range.sh
Tests cover release histories, tag resolution, malformed refs, missing tags, mismatched commits, empty ranges, and first releases without an earlier tag.
Core and REST workflow integration
.github/workflows/ci.yaml, .github/workflows/rest-ci.yml
Both workflows use the shared resolver for pull requests and tag pushes. Other pushes retain github.event.before handling.

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

Sequence Diagram(s)

sequenceDiagram
  participant CIWorkflow
  participant SecretScanResolver
  participant GitHubAPI
  participant GitRepository
  CIWorkflow->>SecretScanResolver: provide workflow ref and commit SHA
  SecretScanResolver->>GitHubAPI: retrieve pull-request base SHA
  GitHubAPI-->>SecretScanResolver: return base SHA
  SecretScanResolver->>GitRepository: compute merge base or previous release tag
  GitRepository-->>SecretScanResolver: return resolved base commit
  SecretScanResolver-->>CIWorkflow: emit base and head SHAs
Loading

Possibly related issues

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.
Title check ✅ Passed The title clearly describes the CI fix for verifying secret-scan ranges from release tags.
Description check ✅ Passed The description explains the shared resolver, release-tag range behavior, testing, and workflow impact.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@chet

chet commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai full_review, thanks!

@coderabbitai

coderabbitai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

@chet I will run a complete review of PR #4808.

🐇

✅ Action performed

Full review finished.

@github-actions

Copy link
Copy Markdown

🔐 TruffleHog Secret Scan

No secrets or credentials found!

Your code has been scanned for 700+ types of secrets and credentials. All clear! 🎉

🔗 View scan details

🕐 Last updated: 2026-08-11 02:51:51 UTC | Commit: 608a7fc

@nv-dmendoza nv-dmendoza left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM with 1 nit

- name: Compute TruffleHog scan range
id: scan-range
if: startsWith(github.ref, 'refs/heads/pull-request/')
if: startsWith(github.ref, 'refs/heads/pull-request/') || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

isn't triggering on just startsWith tags enough?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah so workflow_dispatch can also be launched against a tag, so checking only startsWith(github.ref, 'refs/tags/') would change manually run behavior(s) too. The github.event_name == 'push' guard keeps it scoped to actual release tag pushes, and leaves manual runs unchanged. This is probably a good place for a comment or something, haha.

@chet
chet merged commit 8687335 into NVIDIA:main Aug 11, 2026
124 checks passed
@chet
chet deleted the gh-issue-4806 branch August 11, 2026 17:18
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.

Make Core and REST Release Tags Scan the Same Verified Range

2 participants