Skip to content

Commit 4c4cacf

Browse files
committed
feat(security): onboard security-suite (secret + CodeQL) scanning.
Call the centrally maintained NVIDIA/security-workflows security suite rather than wiring each scan separately: one pinned reference runs the Pulse secret scan and CodeQL SAST, both explicitly enabled. Replace .github/workflows/codeql.yml with the suite's SAST scan. Both publish code scanning results under the category /language:python, so keeping the local workflow would put two analyses on every commit that overwrite each other's alerts. The suite performs the same analysis: python, build-mode none, security-extended queries, on ubuntu-latest.
1 parent 4b13910 commit 4c4cacf

4 files changed

Lines changed: 61 additions & 47 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 0 additions & 46 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
#
5+
# CI security scanning via the NVIDIA/security-workflows suite: Pulse secret scan + CodeQL SAST.
6+
# Pulse runs on Linux nv-gha-runners (Docker image + OIDC/Vault) — Linux-only by design.
7+
# The local secret-scan-trufflehog pre-commit hook is cross-platform (Linux/macOS/Windows).
8+
# Pinned to a reviewed commit SHA.
9+
10+
name: Security Suite (Pulse + CodeQL)
11+
12+
on:
13+
push:
14+
branches:
15+
- main
16+
- ctk-next
17+
- "pull-request/[0-9]+"
18+
workflow_dispatch:
19+
20+
concurrency:
21+
group: ${{ github.workflow }}-on-${{ github.event_name }}-from-${{ github.ref_name }}
22+
cancel-in-progress: true
23+
24+
# Caller must grant every permission the reusable workflow declares, including scans it disables.
25+
permissions:
26+
contents: read
27+
id-token: write # OIDC -> Vault -> nvcr.io image pull
28+
security-events: write # publish redacted SARIF to code scanning
29+
actions: read
30+
31+
jobs:
32+
security-suite:
33+
name: Security Suite
34+
# Pulse needs nv-gha-runners + Vault/nvcr vars; skip on forks.
35+
if: github.repository == 'NVIDIA/cuda-python'
36+
uses: NVIDIA/security-workflows/.github/workflows/security-suite.yml@09c4c130ba7bd14c5061ba8b66d3ebdf797de855
37+
with:
38+
enable-secret-scan: true
39+
enable-sast-scan: true
40+
secret-runs-on: linux-amd64-cpu4
41+
# Set failure_policy explicitly so enforcement can't drift with upstream defaults.
42+
# unverified — fail on verified/live secrets (183); warn on unverified (185) [default]
43+
# strict — fail on any finding (verified or unverified)
44+
# all — warn only; never fail the job on findings
45+
secret-failure-policy: unverified
46+
# Same analysis the retired codeql.yml performed: python, build-mode none, security-extended.
47+
sast-languages: '["python"]'

.pre-commit-config.yaml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,20 @@ ci:
99
autoupdate_branch: ''
1010
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
1111
autoupdate_schedule: quarterly
12-
skip: [lychee, check-precommit-installed]
12+
skip: [lychee, check-precommit-installed, secret-scan-trufflehog]
1313
submodules: false
1414

1515
# Please update the rev: SHAs below with this command:
1616
# pre-commit autoupdate --freeze
1717
repos:
18+
# Runs first so a leaked credential blocks the commit before any formatter runs.
19+
# Self-installing: the hook downloads a pinned, checksum-verified trufflehog on
20+
# first use (no manual install). Skipped on pre-commit.ci; Pulse CI enforces server-side.
21+
- repo: https://github.com/NVIDIA/security-workflows
22+
rev: 09c4c130ba7bd14c5061ba8b66d3ebdf797de855 # frozen: v0.2.0
23+
hooks:
24+
- id: secret-scan-trufflehog
25+
1826
- repo: https://github.com/astral-sh/ruff-pre-commit
1927
rev: c60c980e561ed3e73101667fe8365c609d19a438 # frozen: v0.15.9
2028
hooks:

CONTRIBUTING.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,11 @@ commit` workflow. To resolve this, you can either:
179179
2. Skip it by setting the environment variable `SKIP` to `lychee`. This would
180180
be `$env:SKIP = "lychee"` in PowerShell or `set SKIP=lychee` in cmd.
181181

182+
## Secret Scanning
183+
184+
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.
185+
186+
182187
## Signing Your Work
183188

184189
Contributions to files licensed under Apache 2.0 must be certified under the

0 commit comments

Comments
 (0)