Skip to content

feat(security): onboard pre-commit and Pulse secret scanning - #2405

Closed
gmanal wants to merge 12 commits into
NVIDIA:mainfrom
gmanal:enable-secret-scan
Closed

feat(security): onboard pre-commit and Pulse secret scanning#2405
gmanal wants to merge 12 commits into
NVIDIA:mainfrom
gmanal:enable-secret-scan

Conversation

@gmanal

Copy link
Copy Markdown

Description

Onboard NVIDIA secret scanning to cuda-python using the centrally maintained NVIDIA/security-workflows surfaces. Two complementary controls:

  • Local (advisory):secret-scan-trufflehog pre-commit hook — catches credentials before commit.
  • CI (enforcement): the Pulse reusable workflow — server-side scan on trusted branches that blocks on verified secrets.

Changes

  • Add .github/workflows/secret-scan-pulse.yml calling the centralized Pulse reusable workflow, on main, ctk-next, and copy-pr-bot pull-request/* branches; runs on nv-cpu-general (onboarded for this repo in the enterprise runner config).
  • Add the secret-scan-trufflehog pre-commit hook (pinned to security-workflowsv0.1.0), skipped on hosted pre-commit.ci which lacks the trufflehog binary.
  • Set failure_policy: unverified explicitly (fail on verified/live secrets, warn on unverified); fails closed on scanner/infra errors.
  • Pin per policy: pre-commit rev to release tag v0.1.0, workflow uses: to a reviewed commit SHA.
  • Document local setup and testing in CONTRIBUTING.md.

Checklist

  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@github-actionsgithub-actionsBot added the CI/CD CI/CD infrastructure label Jul 22, 2026
@github-actions

Copy link
Copy Markdown

@gmanal
gmanalforce-pushed the enable-secret-scan branch from 5d5f33f to 2df9477CompareJuly 22, 2026 13:44
Onboard NVIDIA/security-workflows secret scanning:
- .github/workflows/secret-scan-pulse.yml: call the Pulse reusable workflow
(pinned by commit SHA) on pushes to main, ctk-next, and copy-pr-bot
pull-request branches; runs on nv-cpu-general with the default unverified
failure_policy.
- .pre-commit-config.yaml: add the secret-scan-trufflehog local hook (pinned
to security-workflows v0.1.0), skipped on pre-commit.ci which lacks the
trufflehog binary.
- CONTRIBUTING.md: document local secret-scan setup.
@gmanal
gmanalforce-pushed the enable-secret-scan branch from 2df9477 to c5c2cf8CompareJuly 22, 2026 14:04
Comment threadCONTRIBUTING.md Outdated
Comment thread.pre-commit-config.yaml Outdated
Comment thread.github/workflows/secret-scan-pulse.yml
Comment thread.github/workflows/secret-scan-pulse.yml
@gmanal
gmanalforce-pushed the enable-secret-scan branch from ff352f5 to ff758acCompareJuly 24, 2026 05:18
@gmanal
gmanal requested review from kkraus14 and mdboomJuly 24, 2026 05:21
The pinned NVIDIA/security-workflows secret-scan-pulse.yml declares
actions: read in its own permissions block. A reusable workflow cannot
request more than the caller grants, so dropping actions: read from this
caller made the run fail at load time ("requesting actions: read, but is
only allowed actions: none"). Restore it.
@mdboom

Copy link
Copy Markdown
Contributor

Blocked by #2327 so that Windows developers can install pre-commit locally (and get the advantage of this here).

@mdboom

Copy link
Copy Markdown
Contributor

Blocked by #2327 so that Windows developers can install pre-commit locally (and get the advantage of this here).

Given an offline discussion, this does not need to be blocked on #2327.

Comment thread.pre-commit-config.yaml Outdated
@gmanal
gmanal requested a review from mdboomJuly 28, 2026 17:14
Comment threadCONTRIBUTING.md

## Secret Scanning

The `secret-scan-trufflehog` pre-commit hook scans staged files and installs TruffleHog on first run (use Git Bash on Windows). If it flags a secret, remove it before committing, or contact a maintainer if it's a false positive. Secrets are also scanned server-side in CI.

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.

Can we not require Git Bash on Windows? Given the pre-commit hook is mostly just downloading the correct platform binary to use, I imagine we can implement it in a way that doesn't add any extra dependencies for developers?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good call.
as hook detects OS/arch, downloads a pinned TruffleHog release, verifies its SHA-256, caches it, and execs it. None of that needs a shell and can be achieved using python script as well.

The fix will be to move the wrapper to language: python. pre-commit is itself Python, so an interpreter is guaranteed on every platform, and the whole thing is stdlib: platform for arch detection, urllib.request to download, hashlib to verify, tarfile/zipfile to extract.
No Git Bash, no curl, no extra dependencies on any OS.

Do you want to hold this PR for this change? or can we move and add it later.

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've opened NVIDIA/security-workflows#14 to address this upstream

@gmanal

Copy link
Copy Markdown
Author

Closing in favor of #2589, which supersedes this PR.

#2589 does everything here — the secret-scan-trufflehog pre-commit hook and the server-side Pulse secret scan with failure_policy: unverified — but routes them through the security-workflowssecurity suite: one pinned reference instead of one caller per scan. Beyond that it enables CodeQL SAST and retires this repo's codeql.yml, because both publish under /language:python and two analyses on the same commit overwrite each other's alerts. The suite runs the same analysis the retired workflow did: python, build-mode: none, security-extended.

@kkraus14 — your Git Bash question is resolved. The hook moved to language: python and installs the pinned, SHA-256-verified binary into pre-commit's own environment (NVIDIA/security-workflows#14, shipped in v0.3.0). No Git Bash, no curl, no extra developer dependencies; verified on Linux, macOS, and Windows across x86_64 and arm64. #2589 pins v0.3.0 and drops the Git Bash line from CONTRIBUTING.

@mdboom@rparolin — thanks for the reviews here. The SHA-pinning and CONTRIBUTING feedback both carried into #2589, and I've left a comment there summarising exactly what differs from this PR.

@gmanalgmanal closed this Aug 11, 2026
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CI/CDCI/CD infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@gmanal@mdboom@rparolin@kkraus14