runs and runs compare print target text without the control-character cleaning the reports use

未关闭 适合新手
#129 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
78/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
go
领域
cli

调研方向

从 internal/cli/runs.go 中的 runRunsCompare(约第 308-322 行)和 printRunRow(第 88-98 行)开始,这里的 Title、Location、Target 和 Extra 未经转义直接输出。阅读 internal/report/doc.go(第 576-583 行)和 terminal.go 中已有的清理逻辑,以便复用,例如将其导出为 report.CleanText。完成标准是:runs 和 runs compare 的文本输出中不再包含来自 ledger 内容的 C0/C1 控制字符。通过一个测试验证:该测试存储一条 title 和 location 中含有 ESC 字节的 finding,并使用 go test ./internal/cli ./internal/report 运行。

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

描述

bug good first issue severity: low

Summary

The report renderers strip control characters from target-derived text before printing (internal/report/doc.go:576-583), so a scanned repository cannot move the cursor or retitle the operator's terminal. spackle runs compare and the spackle runs list print finding titles, file locations and targets from the ledger without that cleaning.

Where

  • internal/cli/runs.go:308-322 (runRunsCompare text output)
  • internal/cli/runs.go:88-98 (printRunRow)
  • internal/report/doc.go:576-583, internal/report/terminal.go:24-29 (the cleaning the reports apply)

Details

line := fmt.Sprintf("  %s  %-8s %s (%s)", r.ID, r.Severity, r.Title, r.Location)

Titles can be model-written from target content, and locations hold target file names. On POSIX filesystems, file names can contain control bytes.

Impact

A scanned repository can put terminal control sequences into the operator's terminal output when they compare or list runs. This is display-only, but it breaks the guarantee the report path already gives.

Suggested fix

Export the existing cleaning helper (for example report.CleanText) and apply it to Title, Location and Target in runRunsCompare and to Target and Extra in printRunRow. JSON output needs no change.

Acceptance criteria

  • Text output of runs and runs compare contains no C0 or C1 control characters from ledger content.
  • A test stores a finding whose title and location contain an ESC byte and checks the printed text.

Getting started

  • Relevant files: internal/cli/runs.go, internal/report/doc.go
  • How to run tests: go test ./internal/cli ./internal/report

Related: #45


Filed by repo-audit/full-audit at fffef43. Severity: low. Effort: S. audit-key: bug|internal/cli/runs.go|runRunsCompare

主要语言
Go
星标
0
派生
1
PR 合并指标
30 天内没有已合并 PR

环境准备

在 Codespaces 中打开

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

从这里开始

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

TMHSDigital/Spackle 的其他 Issue

查看 TMHSDigital/Spackle 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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