A secret added and removed inside the diff range is never reported

Open
#212 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
48/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
git, go
Domain
devtools, security

Research direction

Start with the documented entry points in internal/gitx/gitx.go, internal/seed/secrets.go, and internal/seed/external.go, then read docs/findings.md, docs/comparison.md, and docs/config.md to understand current scan scope and configuration. The acceptance criteria require documenting history coverage and, with an opt-in, reporting secrets added and removed within the range with the commit and redacted value; the issue leaves whole-history behavior and finding status open.

Written by the indexing model from the issue text.

Description

enhancement severity: low

Summary

A --since scan reads the current content of the files that differ between the merge base and HEAD. A credential committed in one commit of a pull request and deleted in a later commit of the same pull request is seen by neither the built-in secret scan nor gitleaks, although it is in the pushed history. Proposal: an opt-in scan of added lines per commit, and at minimum a sentence in the docs.

Where

  • internal/gitx/gitx.go:641-646, :740 (two-point diff for --since)
  • internal/seed/secrets.go:46 (scan over walked files)
  • internal/seed/external.go:216 (gitleaks in directory mode)

Details

The same holds for any secret that was removed from the tree before the first scan. The docs do not mention history as covered or not covered.

Impact

Teams that rely on the pull request gate or a pre-push scan to catch leaked keys. A secret removed in a fixup commit is a common kind of leak, and it still has to be rotated.

Suggested fix

For --since scans, add an opt-in (for example [scan] secrets_history = true or --secrets-history) that runs the built-in secret patterns over the added lines of each commit in <merge-base>..HEAD (with the same --no-textconv --no-ext-diff hardening, bounded by commit count and bytes) and reports a match that is absent from the current tree as a finding located at <commit>:<path>:<line>, with remediation "rotate the credential; removing the line does not remove it from history". Redact the value exactly as the tree scan does. Open questions: whether to offer a whole-history mode for full scans, and how such a finding gets a fingerprint and a status once the branch is squashed. At minimum, state in docs/findings.md or docs/comparison.md that history is not scanned.

Acceptance criteria

  • The docs state whether history is scanned
  • With the opt-in, a secret added and removed within the range is reported with its commit
  • The value is redacted in every output

Getting started

  • Relevant files: internal/gitx/gitx.go, internal/seed/external.go, internal/seed/secrets.go
  • How to run tests: make test-short (Unix) or .\make.ps1 test-short (Windows PowerShell); make lint before you call it done
  • Related docs: docs/findings.md, docs/comparison.md, docs/config.md

Filed by repo-audit/full-audit at 50e92ec. Severity: low. Effort: M. audit-key: enhancement|internal/seed/secrets.go|secretsSeeder-history

Dominant language
Go
Stars
0
Forks
1
Avg merge
8h 14m
Merged PRs (30d)
3

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from TMHSDigital/Spackle

All issues in TMHSDigital/Spackle

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.