Repository navigation
Conversation
Add a gitleaks scan at three layers so credentials never reach main: - pre-commit: scans staged changes. - pre-push: rescans the commits being pushed, catching --no-verify commits. `default_install_hook_types` makes `pre-commit install` add both hooks. - CI: secret-scan.yml scans every branch push and PR range with a pinned, checksum-verified gitleaks binary (no license key, so fork PRs work). .gitleaks.toml extends the upstream default rules with DB-URI passwords, Neon, Supabase, NVIDIA/NGC, W&B, and Docker Hub tokens, plus placeholder allowlists for docs and templates. tests/unit/test_gitleaks_config.py runs the real binary against generated fake keys to pin each rule's behavior; test.yml installs gitleaks so it runs in CI. .gitleaksignore records the temporary SWE-bench service token in examples/10_Agentic_Inference/dsv4_agentic_benchmark.yaml; a full scan of main is otherwise clean. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
9 tasks done
arekay-nv
marked this pull request as ready for review
October 22, 2026 18:10
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #541 +/- ##
=======================================
Coverage ? 81.37%
=======================================
Files ? 157
Lines ? 22472
Branches ? 0
=======================================
Hits ? 18286
Misses ? 4186
Partials ? 0 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds gitleaks secret scanning at three
layers so that a hardcoded credential is stopped before it reaches
main,ideally before it leaves a contributor's machine:
.pre-commit-config.yaml(gitleaks).pre-commit-config.yaml(gitleaks-push)--no-verifycommits.github/workflows/secret-scan.ymlorigin/main..HEAD) and PR (base..head); full history onmaindefault_install_hook_types: [pre-commit, pre-push]makes a plainpre-commit installadd both hooks. Existing clones have to rerun it once(documented in
docs/DEVELOPMENT.md).Rules (
.gitleaks.toml)useDefault = true).passwords in DB connection URIs (postgres/mysql/mongodb/redis/amqp,
including
+driver), Neonnpg_, Supabasesbp_/sb_secret_, NVIDIAnvapi-, legacy NGC keys, W&B API keys, and Docker Hubdckr_pat_/dckr_oat_.{var},[YOUR-PASSWORD],<password>, and the literal wordspass/password/secret/changeme/redacted. These are matched against the extracted secret andanchored. Reviewers: check whether this set is too broad or too narrow.
name=numbermatches forgeneric-api-key, which otherwise flagsmax_concurrency=100000indocs/ENDPOINT_CLIENT.md..gitleaksignoreholds one reviewed exception: the temporary SWE-bench servicetoken in
examples/10_Agentic_Inference/dsv4_agentic_benchmark.yaml. With it,a scan of
main's full history is clean.CI details
gitleaks-action. The action needsa
GITLEAKS_LICENSEsecret for org repos, and secrets aren't available tofork PRs.
.github/actions/install-gitleaks. It is pinned tothe same version as the pre-commit hook (v8.30.1) and SHA256-verified.
SKIP=gitleaks, becausestaged-change scanning has nothing to scan in CI.
Type of change
Testing
tests/unit/test_gitleaks_config.pyruns the real gitleaks binary withthe repo config. It checks that each custom rule fires on a matching
credential, ignores placeholders, and leaves the default rules active.
The fake credentials are generated at runtime from a fixed seed, so the
file contains nothing push protection would flag. 23 pass.
test.ymlinstalls gitleaks so this file runs in CI, and it is skipped when
gitleaks is not on PATH.
--no-verifycommit, andthe branch never reaches the remote;
gitleaks-pushruns at push time.main: no findings.pre-commit run --all-files: all hooks pass except the existingmacOS-only mypy
sched_setaffinityerrors in unchanged source.pytest -m "not slow and not performance": all gitleaks tests pass.The 119 failures are macOS-only (Linux CPU-affinity APIs,
/proc, IPCsocket-path length) and come from unchanged code.
Follow-ups (after merge)
main.Checklist
AGENTS.md,docs/DEVELOPMENT.md)🤖 Generated with Claude Code