Git checks: follow `cd <dir> &&` in chained commands

Aperta
#23 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
git, python, shell
Ambito
security, tooling

Direzione di ricerca

Start with the hook code that splits a command on && and ; and runs Git checks using its cwd. Trace how a plain cd part is parsed, including relative paths and ~ expansion, and how an unresolvable target should fall back to the hook directory. Add regression tests for a blocked cd dir && git add -A and an allowed equivalent using only fake paths and values.

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

Descrizione

enhancement

cd /path/proj && git add -A && git commit -m wip is probably the commonest way an agent stages files in another folder. The guard checks each && part on its own, but runs the Git checks against the hook's cwd, not the folder the cd moved to. A secrets file, or a settings file holding a secret, in /path/proj isn't caught.

Done when

  • In a chain of && / ; parts, a plain cd <dir> changes the folder used for the parts after it (relative to the current one, with ~ expanded).
  • If the folder can't be worked out (for example cd "$VAR"), the guard falls back to the hook's cwd and keeps today's behaviour.
  • Regression tests cover a blocked cd dir && git add -A and an allowed one, with fake values only.

Found while reviewing #19.


Generated by Claude Code

Lingua principale
Python
Stelle
1
Fork
1
Merge medio
2h 28m
PR unite (30g)
6

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 JTHCode/secretguard

Tutte le issue di JTHCode/secretguard

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.