spackle baseline cannot accept one finding or set an expiry

未关闭
#191 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
58/100
Issue 类型
功能
描述清晰度
描述清楚
活跃度
活跃
技术栈
go
领域
cli, security

调研方向

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.

由索引模型根据 Issue 内容生成。

描述

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

主要语言
Go
星标
0
派生
1
平均合并
8 小时 14 分钟
30 天内合并 PR
3

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TMHSDigital/Spackle 的其他 Issue

查看 TMHSDigital/Spackle 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。