Add Secret scanning workflow#6390
Conversation
- adds NVIDIA/security-workflows/.github/workflows/secret-scan-trufflehog.yml workflow Signed-off-by: Janusz Lisiecki <jlisiecki@nvidia.com>
|
| Filename | Overview |
|---|---|
| .github/workflows/security.yml | New TruffleHog secret-scan workflow; action is properly pinned to a full commit SHA, but fetch-depth may be silently ignored by the composite action, and only pull_request triggers are configured (missing push and schedule). |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[PR opened/updated targeting main] --> B{pull_request trigger}
B --> C[Job: security runs-on: ubuntu-latest]
C --> D[uses: NVIDIA/security-workflows secret-scan-trufflehog @ pinned SHA]
D --> E{fetch-depth: 0 recognized input?}
E -->|Yes| F[Full history checkout TruffleHog scans all commits]
E -->|No - silently ignored| G[Shallow checkout TruffleHog scans PR diff only]
F --> H{Secrets found?}
G --> H
H -->|Yes| I[Job fails]
H -->|No| J[Job passes]
Reviews (1): Last reviewed commit: "Add Secret scaning workflow" | Re-trigger Greptile
| with: | ||
| fetch-depth: 0 |
There was a problem hiding this comment.
[Question]
fetch-depth likely not a recognized input of the composite action
The fetch-depth: 0 is passed in the with: block to the composite action NVIDIA/security-workflows/.github/actions/secret-scan-trufflehog. The commented-out "optional overrides" below list runs-on, extra-args, and fail-on-findings — fetch-depth is absent. If the action's action.yml does not declare fetch-depth as an input, GitHub Actions will silently ignore it (a warning is logged but execution continues). The action will then perform its own checkout with the default depth (typically 1), meaning TruffleHog won't have access to the full commit history, potentially missing secrets buried in older commits.
| on: | ||
| pull_request: | ||
| branches: [ "main" ] |
There was a problem hiding this comment.
[Suggestion] Add
push trigger to catch direct commits to main
The workflow only fires on pull_request. If a secret is committed directly to main (e.g., a fast-forward merge, a direct push by a maintainer), it will never be scanned. The existing codeql.yml uses both push and pull_request for the same reason.
| on: | |
| pull_request: | |
| branches: [ "main" ] | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] |
| on: | ||
| pull_request: | ||
| branches: [ "main" ] |
There was a problem hiding this comment.
[Suggestion] Consider adding a
schedule trigger for periodic full-repo scans
TruffleHog's detector set is continuously updated; secrets that weren't recognized when a commit was made can become detectable later. A scheduled scan catches these retroactively. The existing codeql.yml already uses a weekly schedule trigger for exactly this reason.
| on: | |
| pull_request: | |
| branches: [ "main" ] | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| schedule: | |
| - cron: "17 3 * * 1" # Weekly on Monday |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Category:
Other (e.g. Documentation, Tests, Configuration)
Description:
Additional information:
Affected modules and functionalities:
Key points relevant for the review:
Tests:
Checklist
Documentation
DALI team only
Requirements
REQ IDs: N/A
JIRA TASK: N/A