SSH config writes are not idempotent, and tests write fixture hosts into the user's real ~/.ssh/config (164 duplicate blocks observed)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- python
- Ambito
- networking, testing
Direzione di ricerca
Individua il percorso di scrittura della configurazione SSH e i test che creano il fixture my_cluster; verifica innanzitutto quali test possono raggiungere ~/.ssh/config. Il lavoro è completato quando scritture ripetute non creano blocchi host duplicati, le voci generate sono isolate in modo sicuro o sostituibili e i test usano una configurazione temporanea preservando le voci reali dell’utente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Summary
clustrix appends entries to the user's real ~/.ssh/config without deduplicating, and it writes test-fixture hosts into that personal config. On my machine this accumulated to 164 identical placeholder blocks.
Evidence
Measured on a real user config (macOS, ~/.ssh/config):
total lines: 1202
total Host entries: 172
Frequency by host (real hostnames redacted):
164 Host my_cluster <- test fixture, repeated 164x
1 Host <gpu-host-alias>
1 Host <slurm-host-alias>
1 Host test_cli
1 Host test_cleanup
1 Host <slurm-host-alias-2>
1 Host <slurm-host>
1 Host <slurm-host-alias-3>
1 Host <institution-domain>
Every duplicate block is byte-identical and self-labelled:
# Clustrix auto-generated entry for my_cluster
Host my_cluster
HostName cluster.example.com
User testuser
IdentityFile ~/.ssh/id_ed25519_clustrix_testuser_my_cluster
IdentitiesOnly yes
cluster.example.com / testuser is a test fixture, not a real host. After removing only the my_cluster blocks, the file went from 1202 lines / 172 Host entries to 52 lines / 8 Host entries, with every genuine entry preserved.
Two distinct bugs
- No deduplication on write. Each run appends a new block for a host that already has one. Nothing detects or replaces the existing entry, so the file grows without bound across runs.
- Tests write to the real user config.
my_cluster→cluster.example.com/testuseris fixture data. A test suite should never mutate~/.ssh/config; it should write to a temp file and point SSH at it via-F/ssh_configpath injection.
Impact
- The user's personal SSH config becomes unmanageable (1202 lines of which ~96% is generated noise).
- Real entries get buried among fixtures, making the file hard to audit.
- Functionally the duplicates are inert — OpenSSH takes the first match for a given
Hostpattern — so this is a hygiene and trust problem rather than a broken-connection problem. But it means clustrix silently rewrites a security-relevant file in the user's home directory.
Suggested fixes
- Make config writes idempotent: look for an existing block for the same
Hostalias and replace it in place, rather than appending. - Delimit generated regions with explicit markers (e.g.
# >>> clustrix managed >>>/# <<< clustrix managed <<<) so the tool can rewrite only its own section and users can see what it owns. - Consider writing to a dedicated
~/.ssh/clustrix_configand having users add a singleInclude clustrix_configline, so clustrix never touches the main file. - In the test suite, redirect all SSH-config writes to a
tmp_pathfixture. No test should be able to modify~/.ssh/config. - Optionally ship a
clustrix ssh-config --prunecommand to clean up configs already affected.
Environment
- clustrix installed from source (repo
master) - macOS, OpenSSH client
- Lingua principale
- Python
- Stelle
- 10
- Fork
- 4
- Merge medio
- 15h 10m
- PR unite (30g)
- 2
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ContextLab/clustrix
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
ContextLab/clustrix#170 ·
-
enhancement epic
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
ContextLab/clustrix#160 ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
ContextLab/clustrix#155 · 1 commento ·
-
enhancement
Difficoltà 5/5 Più di una settimana Idoneità per principianti 42/100
ContextLab/clustrix#151 · 5 commenti ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 25/100
ContextLab/clustrix#146 · 2 commenti ·
Tutte le issue di ContextLab/clustrix
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
anthropics/skills#1811 · 1 commento ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
speaches-ai/speaches#678 ·
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
datalayer/mcp-compose#42 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
conda-forge/spacy-feedstock#177 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
UKGovernmentBEIS/inspect_evals#2523 ·