Report every finding on a line in the guardrails content scan

Aperta Adatta ai principianti
#20,942 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
84/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
shell
Ambito
devtools, testing

Direzione di ricerca

Inizia da plugins/guardrails/git-hooks/content-scan.sh e controlla la pipeline sort -u usata da entrambe le scansioni. Poi leggi pre-commit-content.test.sh e pre-push-content.test.sh; aggiungi casi in cui una riga contiene un GitHub PAT e un percorso della home di Linux. Il lavoro è completato quando entrambi i risultati vengono segnalati in ciascun test, i risultati duplicati di due passaggi compaiono una sola volta ed entrambi gli script di test indicati vengono superati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Context

content_scan in plugins/guardrails/git-hooks/content-scan.sh ends with sort -u -t: -k1,1 -k2,2n. With key fields, sort -u treats two lines as duplicates when only their keys (path and line number) match. So when one line has two findings, for example a secret and a machine-specific path, or two secret patterns, only one is reported. The pre-commit and pre-push scans both use it.

This does not fail open: the line still blocks on the finding that is kept. But the author fixes one finding, commits or pushes again, and only then sees the second. Found by the review lane on #20938 (thread on content-scan.sh at the sort -u line); the same line is on main.

Proposed work

  • Sort by path and line, then remove only whole-line duplicates (for example sort -t: -k1,1 -k2,2n | uniq). Identical lines with equal keys end up next to each other, because sort compares the whole line when keys tie.
  • Add a test to pre-commit-content.test.sh and pre-push-content.test.sh: a line holding both a GitHub PAT and a Linux home path reports both findings.

Acceptance criteria

  • A line with two different findings reports both, in pre-commit and pre-push.
  • The same finding reached through two passes is still reported once.
  • pre-commit-content.test.sh and pre-push-content.test.sh pass.
Lingua principale
Shell
Stelle
22
Fork
2
Merge medio
3h 4m
PR unite (30g)
941

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di melodic-software/claude-code-plugins

Tutte le issue di melodic-software/claude-code-plugins

Issue simili

Altre issue su Shell/Bash

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.