Skip to content

docs(ci): verify the Gitleaks download checksum in the CI recipe - #604

Closed
HetCreep wants to merge 7 commits into
NVIDIA:mainfrom
HetCreep:docs/ci-gitleaks-checksum
Closed

HetCreep wants to merge 7 commits into
NVIDIA:mainfrom
HetCreep:docs/ci-gitleaks-checksum

Conversation

@HetCreep

@HetCreep HetCreep commented Nov 15, 2026 •

Copy link
Copy Markdown

Summary

The GitHub Actions CI recipe in docs/ci-integration.mdx downloaded the Gitleaks release tarball and piped it straight from curl into tar with no integrity check. A reader who copies the recipe runs whatever that URL returns.

This change downloads the archive into $RUNNER_TEMP (with --retry 3) and verifies it with sha256sum -c against a SHA-256 digest pinned in the recipe, the same value already pinned in scanner_install.py and ci/Dockerfile.tier1, then extracts it. No behavior change for a genuine release; it fails closed if the archive does not match. The digest must be updated together with GITLEAKS_VERSION.

Scoped to the checksum fix only. Two related points from the same review — the recipe pinning mutable action/tool tags while the repo's own workflows SHA-pin everything, and the jq quality gate passing on an empty quality_summary — are described in #603 for maintainer direction rather than forced here.

Closes part of #603.

Verification

  • I am familiar with the Contributing Guidelines
  • Added or updated focused tests — N/A: documentation-only change (a shell snippet inside an existing fenced block); no product code path.
  • Updated documentation for user-visible changes
  • Ran make lint — could not run the pinned Fern CLI in this environment; the edit stays inside the existing ```yaml code fence, so MDX structure is unchanged.
  • Ran make test — N/A (docs-only)
  • Ran make build — N/A (docs-only)
  • Did not add credentials, private datasets, or proprietary benchmark content

Release Impact

  • No user-visible release note needed
  • Updated CHANGELOG.md

🤖 Generated with Claude Code

The GitHub Actions recipe in docs/ci-integration.mdx piped the Gitleaks
release tarball from curl straight into tar with no integrity check.
Download the archive and its published checksums file, verify it with
sha256sum -c, then extract. Raised in NVIDIA#603.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Signed-off-by: HetCreep <[email protected]>

@rng1995 rng1995 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.

I reviewed the diff and tested the step in a Debian container under bash -e without pipefail, which is GitHub's default shell. The check works as written. It fails closed on a mismatched archive, a missing or CRLF checksum line, and an empty checksums file, and a genuine release still installs. The CHANGELOG entry sits under Unreleased → Documentation, and no test asserts the old recipe text.

Three inline comments:

  • P2: check against a pinned digest instead of a checksums file from the same release.
  • P3: download into $RUNNER_TEMP, with --retry.
  • P3: a non-blocking follow-up for maintainers about the managed Gitleaks install.

The two suggestion blocks work together. Applying both gives exactly the step I tested: a genuine archive installs, a tampered one fails with exit 1, and nothing is left in the checkout.

Comment thread docs/ci-integration.mdx Resolved
Comment thread docs/ci-integration.mdx Resolved
Comment thread docs/ci-integration.mdx Resolved
Check the download against the SHA-256 already pinned in
scanner_install.py and ci/Dockerfile.tier1 instead of a checksums file
from the same release, which a replaced release can replace as well.
Download into $RUNNER_TEMP so the archive stays out of the checkout,
and retry the request as ci/Dockerfile.tier1 does.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: HetCreep <[email protected]>
@HetCreep

Copy link
Copy Markdown
Author

Thanks for the thorough review and the container repro. I checked the points against main: the digest matches the pin in scanner_install.py and ci/Dockerfile.tier1 and the release's own checksums.txt, the v8.30.0 release is not immutable and ships no signatures, and a gitleaks on PATH takes precedence over the managed install.

Pushed 4cab9ae, which applies both suggestions: a pinned GITLEAKS_SHA256, and the download into $RUNNER_TEMP with --retry 3 (the checksums.txt request is gone). The CHANGELOG line now says "a pinned SHA-256 digest".

I ran the check against a fake archive locally (genuine passes; a tampered archive and a wrong digest both exit 1 with nothing extracted). I did not run the full workflow on a GitHub runner. I left the managed-install question and the optional drift-guard test for the maintainers.

@chrisknvidia

Copy link
Copy Markdown
Collaborator

Review follow-up on a8a542b603a5.

Re-reviewed the current pinned-digest implementation against the existing comments. The same-origin checksums weakness and checkout-pollution/retry issues are addressed in source. Independently downloaded the genuine Gitleaks 8.30.0 linux/x64 release, verified the pinned SHA-256, extracted it and ran gitleaks version in Linux (8.30.0); appending a byte makes checksum verification fail. No new scoped code defect found. The full hosted workflow and privileged system install were not run. Please update the PR description, which still says the recipe downloads checksums.txt, to describe the current pinned-digest behavior. Other reviewers' threads were left untouched.

HetCreep and others added 3 commits November 16, 2026 15:29
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Signed-off-by: HetCreep <[email protected]>
NVIDIA#630 landed the same pinned-digest Gitleaks step on main with its own
CHANGELOG entry under Changed, so this bullet repeated it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Narendran Raghavan <[email protected]>
@rng1995

rng1995 commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

Thanks @HetCreep for raising #603 and for this fix. The pinned-digest Gitleaks step and the $RUNNER_TEMP download you pushed in 4cab9ae are now on main through #630, which finished #603 together with #617 and #618. The recipe on this branch is identical to main.

That left this PR with only a second CHANGELOG entry for the same change, so I dropped it in 3e9f94d and am closing this as superseded by #630. Thanks again for the careful write-up and the quick turnaround on the review.

@rng1995 rng1995 closed this Nov 16, 2026
@HetCreep
HetCreep deleted the docs/ci-gitleaks-checksum branch November 22, 2026 05:34
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