bug: YAML parse error in config is silently swallowed, login overwrites all other contexts
Maintainer thường phản hồi trong vòng 1 ngày
@Sarthak-Shreshtha01 đang làm issue này rồi.
Từ ngày 8/10/2026.
- #574 của @Sarthak-Shreshtha01 — đang mở
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 76/100
Hướng nghiên cứu
Bắt đầu với localconfig.go quanh dòng 103 và so sánh cách ReadLocalConfig và ReadLocalWatchConfig xử lý lỗi từ configUtil.UnmarshalLocalFile. Sau đó đọc config_test.go và thêm kiểm thử YAML không hợp lệ cho cả hai hàm đọc. Hoàn thành khi lỗi phân tích cú pháp được trả về thay vì bị coi là cấu hình rỗng, trong khi tệp bị thiếu vẫn trả về nil, nil.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
A tab instead of spaces — or any YAML syntax error — in the config file causes ReadLocalConfig to return an empty config with no error, making every command behave as if the user has never logged in.
The dangerous part: login sees the empty config, treats it as a fresh install, and writes a brand-new file over it. Every other context, server, user and refresh token in the file is gone with no warning.
Root cause
localconfig.go line 103:
err = configUtil.UnmarshalLocalFile(path, &config)
if os.IsNotExist(err) {
return nil, nil
}
err = ValidateLocalConfig(config) // parse error is silently overwritten here
Only os.IsNotExist is handled. A YAML parse error falls through and gets immediately overwritten by ValidateLocalConfig. Same bug in ReadLocalWatchConfig.
To reproduce
- Put a tab on any indented line in
~/.config/microcks/config - Run
microcks context→ reports "no contexts defined" instead of a parse error - Run
microcks login <any-server>→ the file is truncated and rewritten. All previous contexts are gone.
Fix
if err != nil {
return nil, fmt.Errorf("reading config %s: %w", path, err)
}
Same in ReadLocalWatchConfig. After this, nil, nil keeps its only meaning — file doesn't exist — and fresh-install logic stays untouched.
There is no test for malformed input in config_test.go, which is how this went unnoticed.
- Ngôn ngữ chính
- Go
- Star
- 58
- Fork
- 72
- Merge trung bình
- 1 ngày 11 giờ
- Pull request đã merge (30 ngày)
- 27
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc 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 microcks/microcks-cli
-
Default configuration path falls back to the current directory when the home directory cannot be determinedCó thể đã có người làm @Sarthak-Shreshtha01 đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
microcks/microcks-cli#583 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
microcks/microcks-cli#573 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
import-dir uploads secondary artifacts before their primary API definitionCó thể đã có người làm @doraem-on đã nhận 13 ngày trước. Đang mởcomponent/cli kind/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
microcks/microcks-cli#561 · 4 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
TEST: `ConnectAndGetToken` Returns Error on Non-200 ResponseCó thể đã có người làm @aniket866 đã nhận 16 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
microcks/microcks-cli#554 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Empty `AuthToken` Causes Cryptic JWT Parse ErrorCó thể đã có người làm @aniket866 đã nhận 16 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
microcks/microcks-cli#551 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của microcks/microcks-cli
Issue tương tự
-
copilot-api domain:platform go
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
docs: clarify gh api -f vs -F and @-file expansion in the gh skillCó thể đã có người làm @MatiasOlivera đã nhận hôm nay. Đang mởenhancement
Độ khó 2/5 Nửa ngày Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
aws/aws-advanced-go-wrapper#612 ·
-
Say in the changelog that the text-index update cannot be rolled backCó thể đã có người làm @praetorianer777 đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
praetorianer777/GoTome#275 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
SAP/crossplane-provider-btp#1118 ·
Maintainer thường phản hồi trong vòng 1 ngày