Skip to content

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

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

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

@gmanal gmanal commented Jul 22, 2026

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-workflows v0.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-actions github-actions Bot added the CI/CD CI/CD infrastructure label Jul 22, 2026
@github-actions

Copy link
Copy Markdown

@gmanal
gmanal force-pushed the enable-secret-scan branch from 5d5f33f to 2df9477 Compare July 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
gmanal force-pushed the enable-secret-scan branch from 2df9477 to c5c2cf8 Compare July 22, 2026 14:04
Comment thread CONTRIBUTING.md Outdated
Comment thread .pre-commit-config.yaml Outdated
@leofang leofang assigned gmanal and kkraus14 and unassigned kkraus14 Jul 22, 2026
Comment thread .github/workflows/secret-scan-pulse.yml
Comment thread .github/workflows/secret-scan-pulse.yml
@gmanal
gmanal force-pushed the enable-secret-scan branch from ff352f5 to ff758ac Compare July 24, 2026 05:18
@gmanal
gmanal requested review from kkraus14 and mdboom July 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

mdboom commented Jul 24, 2026

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

mdboom commented Jul 27, 2026

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 mdboom July 28, 2026 17:14
Comment thread CONTRIBUTING.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

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

Labels

CI/CD CI/CD infrastructure

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants