spackle baseline cannot accept one finding or set an expiry

Open
#191 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
58/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
go
Domain
cli, security

Research direction

Start with internal/cli/baseline.go and internal/finding/baseline.go, then read the baseline section of docs/ci.md and inspect how report --finding validates IDs. Check how baseline rewriting handles diff scans and existing entries. Done means the acceptance criteria pass, including documentation updates; the issue suggests running make test-short and make lint.

Written by the indexing model from the issue text.

Description

enhancement severity: medium

Summary

spackle baseline always accepts every open finding of a run and rewrites the file. Accepting a single false positive, or giving an entry an expiry date, means editing JSON by hand. Proposal: --finding <id> and --expires <date>.

Where

  • internal/cli/baseline.go:22-23 (flags --out and --reason only)
  • internal/cli/baseline.go:51, :87 (file built from every open finding; old entries dropped)
  • internal/finding/baseline.go:39-56, :68-80 (Expires is enforced but nothing writes it)
  • docs/ci.md:182 (tells the user to edit the JSON)

Details

The command builds the file from every open or patch-available finding of the run, so it accepts everything at once. To accept one false positive from a later scan, the user must hand-write an entry with the right id and fingerprint, or rerun spackle baseline, which also accepts every other new finding. The rewrite also drops old entries that match nothing in the run, and nothing checks whether the run was a --since, --changed or --staged scan, where most accepted findings are simply out of scope.

Impact

Teams using the CI gate, which is the documented adoption path. Day-to-day triage is one finding at a time ("this one is a false positive, accept it for 90 days"). Today the easy path accepts real new findings along with the false positive.

Suggested fix

Add --finding <id> (repeatable, same id check as report --finding) and --expires <YYYY-MM-DD>. With --finding, load the existing --out file, add or update only the named entries (with --reason and --expires), and keep every other entry untouched. Without --finding, keep today's behavior, but refuse or warn when the run is a diff scan, since rewriting would drop the entries the diff did not cover.

Acceptance criteria

  • spackle baseline --finding F-... --reason ... --expires 2027-03-01 adds one entry and keeps the rest
  • An unknown finding id is refused with the ids of the run
  • A full rewrite from a diff-scan run warns or refuses
  • docs/ci.md documents both flags

Related: #81

Getting started

  • Relevant files: docs/ci.md, internal/cli/baseline.go, internal/finding/baseline.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/ci.md (baseline section)

Filed by repo-audit/full-audit at 50e92ec. Severity: medium. Effort: S. audit-key: enhancement|internal/cli/baseline.go|runBaseline-finding-expires

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.