spackle baseline cannot accept one finding or set an expiry

Aberta
#191 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
4/5
Tempo estimado
3-5 dias
Facilidade para iniciantes
58/100
Tipo de issue
Funcionalidade
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
go
Domínio
cli, security

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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

Linguagem predominante
Go
Estrelas
0
Forks
1
Merge médio
8h 14min
PRs com merge (30d)
3

Preparar o ambiente

Abrir no Codespaces

Inicia o contêiner de desenvolvimento do projeto no navegador, com a sua própria conta do GitHub.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de TMHSDigital/Spackle

Todas as issues de TMHSDigital/Spackle

Issues semelhantes

Mais issues de Go

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.