Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

[Bug]: test home guard treats '..name' children of protected trees as outside them

Aperta Adatta ai principianti
#7,853 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@lidge-jun ci sta già lavorando.

Dal 28/10/2026.

  • #7884 di @lidge-jun — aperta

Valutazione

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

Direzione di ricerca

Inizia da src/lib/test-home-guard.ts: confronta l'helper isInside(parent, child), che usa !rel.startsWith(".."), con isSameOrInsideIgnoringPlatformCase() accanto, che divide sul separatore. Riproduci verificando protectedRemovalReason(join(protectedHome, "..backup")) rispetto a protectedRemovalReason(join(protectedHome, "backup")). È completato quando il primo restituisce un rifiuto, l'uguaglianza delle varianti di maiuscole/minuscole per le home di OpenCodex e Codex è gestita sulle piattaforme case-insensitive e i test coprono entrambi i casi.

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

Descrizione

bug
Client or integration

Other

Area

Other

Summary

src/lib/test-home-guard.ts protects the developer's real OpenCodex, Codex, Claude and LaunchAgents trees from test writes and removals. Its isInside(parent, child) helper, used by protectedRemovalReason() and therefore by assertRemovalOutsideProtectedTrees(), decides containment with !rel.startsWith("..") on the relative path. That is a string-prefix test, not a path-component test. A direct child of a protected tree whose name begins with two dots, such as ~/.opencodex/..backup, has the relative path ..backup. It is therefore judged outside the tree, and the removal guard does not refuse it. The neighbouring isSameOrInsideIgnoringPlatformCase() already does this correctly: it splits on the separator and only treats a leading .. component as leaving the root.

Separately, the equality comparisons for the OpenCodex and Codex homes (canonicalize(dir) === PROTECTED_HOME) are case-sensitive. On Windows and macOS, a not-yet-existing case variant such as .OPENCODEX canonicalizes through its parent and does not compare equal, although the filesystem treats it as the same directory.

Expected: protected-tree containment and equality use component-aware comparison, with case folding on case-insensitive platforms, as the Claude tree checks already do.

Found while reviewing the test-only fixture preload in #7852, which now carries its own component-aware checks.

Reproduction

With the guard armed and a synthetic real home: protectedRemovalReason(join(protectedHome, "..backup")) returns null, while protectedRemovalReason(join(protectedHome, "backup")) refuses.

Version

dev (2.94.0 line)

Operating system

All (case folding: Windows and macOS)

Provider and model

No response

Logs or error output
n/a
Screenshots and supporting files

No response

Redacted configuration
n/a
Checks
  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.
Lingua principale
TypeScript
Stelle
16.9k
Fork
1.3k
Merge medio
15h 24m
PR unite (30g)
678

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 lidge-jun/opencodex

Tutte le issue di lidge-jun/opencodex

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.