clone guard: -o path that is a symlink into the checkout is followed, still overwrites the repo AGENTS.md (follow-up to #238/#275)

Aperta
#276 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
76/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python, shell
Ambito
security, tooling

Direzione di ricerca

Start with adapters/codex/install.sh and reproduce the symlink case from the issue against a checkout containing AGENTS.md. Trace the -o path handling through the directory-resolution guard, then add the requested symlink test. Done means the target inside the checkout is refused with exit 2 and no file or backup is written.

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

Descrizione

From the PR #275 review (Cyra). #275 refuses in-checkout AGENTS.md writes by resolving the directory of -o. The guard does not resolve the final path component, so a symlink whose target lives inside the checkout is followed and the write lands in the repo anyway.

Repro on pr-275 (a9508c82):

cd /path/to/coco-checkout
ln -s "$PWD/AGENTS.md" /tmp/outlink.md
bash adapters/codex/install.sh -o /tmp/outlink.md
# exit 0, no refusal; /path/to/coco-checkout/AGENTS.md replaced (1294 lines), backup written as /tmp/outlink.md.backup-<ts>

Expected: same refusal as PR #275's other cases (-o inside the checkout), exit 2, nothing written.
Actual: the tracked contributor guide is overwritten through the symlink.

Lower severity than #238 — it needs a deliberately planted symlink, not the README path — so it does not block #275. Fix would be resolving the target (e.g. readlink loop / python3 -c os.path.realpath) before the inside $repo_root_phys comparison, plus a test case.

P2, non-blocking for #275. Evidence above, reproduced 2026-09-27.

Lingua principale
HTML
Stelle
347
Fork
12
Merge medio
2g 16h
PR unite (30g)
95

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 coco-research/coco

Tutte le issue di coco-research/coco

Issue simili

Altre issue su Security

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.