Skip to content

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

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

feat(security): onboard pre-commit and Pulse secret scanning#2405
gmanal wants to merge 2 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

Two complementary controls prevent accidental credential leakage:

- **Local pre-commit** (`secret-scan-trufflehog`, via `.pre-commit-config.yaml`): catches credentials before commit. Requires `trufflehog` on your PATH (the wrapper prints install commands if missing). Never commit a flagged secret; check with maintainers on false positives, and only use `git commit --no-verify` in exceptional, agreed cases.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This means that encouraging installation of pre-commit is even more important, as is making sure our pre-commit config works on Windows (which it currently doesn't).

Comment thread .pre-commit-config.yaml
# pre-commit autoupdate --freeze
repos:
# Runs first so a leaked credential blocks the commit before any formatter runs.
# Requires `trufflehog` on $PATH; the wrapper prints install commands if missing.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Will this fail if not installed, or just warn (and continue to the other checks)?

The installation instructions mention an insecure installation method:

  Install on macOS or Linux (no package manager required):
    curl -sSfL https://raw.githubusercontent.com/trufflesecurity/trufflehog/main/scripts/install.sh \
        | sh -s -- -b /usr/local/bin

Maybe this tool could install it in a safe way to the local pre-commit environment (the way other pre-commit hooks work).

@leofang leofang assigned gmanal and kkraus14 and unassigned kkraus14 Jul 22, 2026
uses: NVIDIA/security-workflows/.github/workflows/secret-scan-pulse.yml@69032f641c3c34e0c0b46f636b54ed2b101b7aa4
with:
runs-on: linux-amd64-cpu4
# Set failure_policy explicitly so enforcement can't drift with upstream defaults.

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.

Is the Linux-only execution context intentional? The called workflow relies on POSIX shell syntax, docker, and python3, while the local pre-commit hook is also Bash-only and documents no Windows installation path. If Windows developers are expected to use this hook, please add a supported Windows implementation/instructions; otherwise, please document that this control is Linux/macOS-only.

permissions:
contents: read
id-token: write # OIDC -> Vault -> nvcr.io image pull
security-events: write # publish redacted SARIF to code scanning

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.

NVIDIA/cuda-python is public. GitHub documents actions: read as required by upload-sarif only for private repositories; this workflow otherwise needs contents: read, id-token: write, and security-events: write. Could we drop actions: read here to keep the caller token at the minimum scope?

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.

3 participants