Default configuration path falls back to the current directory when the home directory cannot be determined
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đá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 tại pkg/config/localconfig.go, ở DefaultConfigDir và DefaultLocalConfigPath, rồi lần theo cách các lệnh như context list tải cấu hình cục bộ mặc định. Kiểm tra cách xử lý lỗi tra cứu thư mục home và cách hành vi được chọn áp dụng cho cả thao tác đọc lẫn ghi. Hoàn tất khi lỗi tra cứu thư mục home không còn tạo ra đường dẫn cấu hình tương đối với thư mục hiện tại, và CLI báo lỗi rõ ràng hoặc dùng phương án dự phòng có chủ đích.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
When MICROCKS_CONFIG_DIR is unset and the CLI cannot determine the user's home directory, DefaultConfigDir in pkg/config/localconfig.go discards the error returned by getHomeDir() and returns an empty string with no error.
DefaultLocalConfigPath then constructs the configuration path using this empty directory. Instead of returning an error or selecting a documented fallback, the resulting path can be the relative path config.
This creates an unexpected dependency on the process's current working directory. Commands that load or save local configuration may consequently resolve the configuration file relative to whichever directory the CLI was launched from, rather than using a stable, user-specific configuration directory.
Depending on the command and its execution path, this could cause the CLI to read an unintended file, create configuration in an unexpected location, or fail in a way that obscures the underlying problem. If the relative file contains authentication data, using an unintended location could also create a credential-handling risk.
Expected behavior
The CLI should not silently accept an empty configuration directory after home-directory resolution fails.
It should either:
Return a clear, actionable error indicating that the home directory could not be determined; or
Use a documented and deliberate fallback location that does not unexpectedly resolve to a file in the current working directory.
The selected behavior should be consistent for commands that read and write the default configuration.
Actual behavior
The error from getHomeDir() is discarded, and DefaultConfigDir returns an empty path with a nil error. DefaultLocalConfigPath can consequently resolve to the relative path config, allowing subsequent file operations to depend on the current working directory.
How to Reproduce?
-
Build the CLI or a small diagnostic program against the affected source.
-
Create and switch to a temporary working directory that does not contain an existing configuration file.
-
Unset MICROCKS_CONFIG_DIR and the relevant home-directory environment variables. On Windows, unset USERPROFILE; on Unix-like systems, unset HOME.
-
Call config.DefaultLocalConfigPath() or run a CLI command that loads the default local configuration, such as context list.
-
Inspect the resolved path and the command's behavior.
For a direct path-resolution check, call DefaultLocalConfigPath() and print both its returned path and error. Under the affected conditions, the expected reproduction is a relative path such as config with no reported error.
To verify actual file access separately, place a harmless, deliberately malformed test configuration file named config in the temporary working directory and run a command that loads the local configuration. A parsing error can help demonstrate that the relative file is being read. Do not use real configuration files or credentials for this test.
Microcks version or git rev
main
Install method (docker-compose, helm chart, operator, docker-desktop extension,...)
CLI
Additional information
No response
- Ngôn ngữ chính
- Go
- Star
- 57
- Fork
- 73
- Merge trung bình
- 1 ngày 9 giờ
- Pull request đã merge (30 ngày)
- 28
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
-
Độ 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 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug: YAML parse error in config is silently swallowed, login overwrites all other contextsCó thể đã có người làm @Sarthak-Shreshtha01 đã nhận 4 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 76/100
microcks/microcks-cli#572 · 5 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 11 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 · 3 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 14 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 14 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 ·
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ự
-
unbounded value for n in `/v1/logs` can panic/OOMCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởsmall item
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
canonical/pebble#1127 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[schema-coverage] elasticstack_elasticsearch_synonym_set (data source)Có thể đã có người làm @github-actions đã nhận hôm nay. Đang mởacceptance-tests phase-coding schema-coverage testing triaged
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 81/100
elastic/terraform-provider-elasticstack#5211 ·
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 89/100
open-policy-agent/opa#9366 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
defect
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
nats-io/nats-server#8752 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement needs-acceptance wg/router-models-inference-runtime
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
vllm-project/semantic-router#5015 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày