Skip to content

feat(redact): replace gitleaks with betterleaks for secret detection#760

Open
peyton-alt wants to merge 2 commits intomainfrom
betterleaks-migration
Open

feat(redact): replace gitleaks with betterleaks for secret detection#760
peyton-alt wants to merge 2 commits intomainfrom
betterleaks-migration

Conversation

@peyton-alt
Copy link
Contributor

@peyton-alt peyton-alt commented Mar 24, 2026

Betterleaks is a drop-in replacement by the gitleaks author with expanded rules (241 vs 223) and active development. The detect API is identical (NewDetectorDefaultConfig, DetectString, Finding.Secret), so this is a pure dependency + naming swap with no logic changes.

Closes #756


Note

Medium Risk
Updates the CLI’s secret redaction dependency, which is security-sensitive and could change what gets flagged/redacted (false positives/negatives) despite the API being drop-in compatible.

Overview
Switches pattern-based secret detection in redact from gitleaks to betterleaks, updating the detector wiring and corresponding test/documentation wording.

Updates dependency manifests (go.mod/go.sum) to add betterleaks and refresh related transitive modules, and expands .allowed-licenses to include 0BSD.

Written by Cursor Bugbot for commit b8f369e. Configure here.

Betterleaks is a drop-in replacement by the gitleaks author with
expanded rules (241 vs 223) and active development. The detect API
is identical (NewDetectorDefaultConfig, DetectString, Finding.Secret),
so this is a pure dependency + naming swap with no logic changes.

Closes #756

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Entire-Checkpoint: e9bf2a2ffc9f
Copilot AI review requested due to automatic review settings March 24, 2026 00:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates Entire’s redaction secret-scanning dependency from gitleaks to betterleaks (a maintained drop-in replacement by the original author) and refreshes related references.

Changes:

  • Swap github.com/zricethezav/gitleaks/v8/detect for github.com/betterleaks/betterleaks/detect and rename related detector globals.
  • Update docs/tests wording to reference betterleaks.
  • Update go.mod / go.sum to reflect the new module graph.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
redact/redact.go Switch detector import and rename cached detector variables; update comments to reference betterleaks.
redact/redact_test.go Update test comment to reference betterleaks.
go.mod Add betterleaks direct dependency; remove gitleaks; indirect dependency graph changes.
go.sum Update checksums to match the new dependency graph.
docs/security-and-privacy.md Update security docs to reference betterleaks instead of gitleaks.

New transitive dependency github.com/mikelolasagasti/xz (via
betterleaks -> mholt/archives) uses the 0BSD license. 0BSD is
a permissive public-domain-equivalent license.

Refs: #756
Entire-Checkpoint: b627e9d2cb4f
@peyton-alt
Copy link
Contributor Author

@BugBot review

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@peyton-alt peyton-alt marked this pull request as ready for review March 24, 2026 01:03
@peyton-alt peyton-alt requested a review from a team as a code owner March 24, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Consider using Betterleaks instead of Gitleaks

2 participants