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

Aberta Para iniciantes
#129 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
78/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
go
Domínio
cli

Direção de pesquisa

Comece por runRunsCompare em internal/cli/runs.go (por volta das linhas 308-322) e por printRunRow (linhas 88-98), onde Title, Location, Target e Extra são impressos sem escape. Leia a limpeza existente em internal/report/doc.go (linhas 576-583) e em terminal.go para reutilizá-la, talvez exportando-a como report.CleanText. Está concluído quando a saída de texto de runs e de runs compare não tiver caracteres de controle C0/C1 vindos do conteúdo do ledger. Isso é verificado por um teste que armazena um achado com um byte ESC em seu title e location, executado com go test ./internal/cli ./internal/report.

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

Descrição

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

Linguagem predominante
Go
Estrelas
0
Forks
1
Métricas de merge de PRs
Nenhum PR com merge em 30d

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.