SSH config writes are not idempotent, and tests write fixture hosts into the user's real ~/.ssh/config (164 duplicate blocks observed)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 52/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- python
- Lĩnh vực
- networking, testing
Hướng nghiên cứu
Xác định đường dẫn ghi cấu hình SSH và các test tạo fixture my_cluster; trước tiên xác minh những test nào có thể truy cập ~/.ssh/config. Được xem là hoàn tất khi các lần ghi lặp lại không tạo ra các khối host trùng lặp, các mục được tạo được cô lập an toàn hoặc có thể thay thế, và các test sử dụng cấu hình tạm thời trong khi vẫn giữ nguyên các mục thực của người dùng.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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
- Ngôn ngữ chính
- Python
- Star
- 10
- Fork
- 4
- Merge trung bình
- 15 giờ 10 phút
- Pull request đã merge (30 ngày)
- 2
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ContextLab/clustrix
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
ContextLab/clustrix#170 ·
-
enhancement epic
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
ContextLab/clustrix#160 ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
ContextLab/clustrix#155 · 1 bình luận ·
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 42/100
ContextLab/clustrix#151 · 5 bình luận ·
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
ContextLab/clustrix#146 · 2 bình luận ·
Tất cả issue của ContextLab/clustrix
Issue tương tự
-
bug confirmed issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
open-webui/open-webui#30750 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 bình luận ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
good first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 90/100