ci: Upgrade secret scanning workflow INF-162 - #63
Conversation
📝 WalkthroughWalkthroughThe pull request introduces a reusable workflow that runs Gitleaks and TruffleHog with configurable scan modes, thresholds, versions, and shared configuration. It updates triggers, documentation, artifact and Slack handling, and tightens three Gitleaks detection patterns. ChangesTN secret scanning
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant CallerWorkflow
participant ReusableSecretScan
participant Gitleaks
participant TruffleHog
participant FindingsProcessor
participant Slack
CallerWorkflow->>ReusableSecretScan: invoke with scan mode and scan settings
ReusableSecretScan->>Gitleaks: run configured repository scan
ReusableSecretScan->>TruffleHog: run repository scan
Gitleaks-->>FindingsProcessor: JSON findings
TruffleHog-->>FindingsProcessor: JSONL findings
FindingsProcessor->>Slack: send sanitized blocking-finding summary
FindingsProcessor-->>ReusableSecretScan: should_fail output
ReusableSecretScan-->>CallerWorkflow: success or failure status
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/workflows/reusable-secrets-scanning.yml:
- Around line 260-270: Update the TruffleHog report parsing loop around
trufflehog_report so any non-empty line that raises json.JSONDecodeError causes
the scan/report processing to fail closed instead of being skipped. Preserve
ignoring blank lines, and propagate or explicitly report the malformed-record
failure through the existing scan error path.
- Around line 94-98: Set persist-credentials to false in both the caller
repository checkout and the configuration checkout steps in
reusable-secrets-scanning.yml (caller checkout lines 94-98; configuration
checkout lines 100-106) before the workspace is mounted into scanner containers.
In @.github/workflows/secrets-scanning.yml:
- Around line 9-19: Restrict the workflow_dispatch scan_mode input in
.github/workflows/secrets-scanning.yml lines 9-19 to history, and update the
mode mapping at lines 25-25 so manual runs always use history unless explicit
range inputs are added. Remove unsupported manual pr and push options from
README.md lines 40-50 and document manual dispatch as history at line 56.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: f9856eae-1c3a-400e-a379-71277fe2dcc0
📒 Files selected for processing (4)
.github/workflows/reusable-secrets-scanning.yml.github/workflows/secrets-scanning.ymlREADME.mdsecurity/gitleaks/tn-gitleaks.toml
Summary
pr,push, and non-blockinghistoryscan modes with fetch depth, fail threshold, config ref/path, and scanner version inputstreasurenetprotocol/reusable-workflowsand document minimal TN repository usageNotes
mainand consumessecurity/gitleaks/tn-gitleaks.toml.fail_threshold.HEADinstead of unrelated history.historymode because manual events do not provide a native PR/push range.summary.mdandsanitized-findings.jsonare uploaded. Raw Gitleaks and TruffleHog reports remain local to the runner and are never included in the artifact.Validation
actionlintv1.7.12 against both changed workflow files with no findings.security/gitleaks/tn-gitleaks.tomlwith Pythontomllib.workflow_callvalidation from an isolated synthetic branch intreasurenetprotocol/technical-demo:18e0d3a.git diff --check.lint-and-validateand CodeRabbit checks pass at18e0d3a.Remaining Gate