dev-mode key pair and healthcheck without a config file read a variable that is not UTF-8 as unset

Đang mở Phù hợp với người mới
#1,350 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 3 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
75/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
authentication, cli

Hướng nghiên cứu

Hai bộ đọc coi các giá trị môi trường không phải UTF-8 là chưa được đặt: closure non_empty trong resolve_with tại crates/server/src/dev_credentials.rs, và các lời gọi std::env::var trong resolve_target tại crates/app/src/cmd_healthcheck.rs. Bắt đầu từ công tắc vô hiệu hóa EXTENDDB_DEV_DISABLE_EXAMPLE_CREDENTIAL, công tắc này đã từ chối giá trị như vậy kèm thông báo nêu tên biến, rồi so sánh. Hoàn thành khi một giá trị không phải UTF-8 ở một trong hai bộ đọc tạo ra lỗi nêu tên biến, và các đường xử lý lỗi hiện có vẫn giữ nguyên.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug

What happens

Two readers of ExtendDB variables read the process environment with their own code instead of the configuration loader. Both treat a value that is not UTF-8 as unset, and no message says that the value is not UTF-8. For an EXTENDDB__ variable, the configuration loader refuses such a value with an error that names it (#977).

Measured on 21 November 2026 with the dev-mode SQLite binary (--features sqlite-memory,dev-mode) of the fix for #977. Each case ran twice and gave the same answer both times.

The dev-mode key pair

A dev-mode build reads EXTENDDB_DEV_ACCESS_KEY_ID and EXTENDDB_DEV_SECRET_ACCESS_KEY as unset when their values are not UTF-8.

env $'EXTENDDB_DEV_ACCESS_KEY_ID=\xff' $'EXTENDDB_DEV_SECRET_ACCESS_KEY=\xfe' extenddb serve --foreground --port 18991

At 20:53 UTC, both runs served /health, and a ListTables signed with the documented example pair got HTTP 200. The startup output named only the example pair under "Sign requests with".

With only EXTENDDB_DEV_ACCESS_KEY_ID not UTF-8 and EXTENDDB_DEV_SECRET_ACCESS_KEY=abc, both runs at 20:58 UTC exited 1 with this message. The message says that the access key variable is not set:

Error: EXTENDDB_DEV_SECRET_ACCESS_KEY is set but EXTENDDB_DEV_ACCESS_KEY_ID is not; set both to seed an additional dev credential, or neither.

resolve_with in crates/server/src/dev_credentials.rs reads each variable of the pair through the non_empty closure. The closure maps a value that is not UTF-8 to None (.and_then(|v| v.into_string().ok())). The disable switch EXTENDDB_DEV_DISABLE_EXAMPLE_CREDENTIAL refuses such a value with a message that names it.

Healthcheck without a config file

With no config file, resolve_target in crates/app/src/cmd_healthcheck.rs reads EXTENDDB__SERVER__PORT and EXTENDDB__SERVER__BIND_ADDR with std::env::var. It treats Err(_) as unset. std::env::var also returns Err for a value that is not UTF-8. Its comment says that it reports a bad port instead of using the default port.

extenddb healthcheck --config <a path that does not exist>, with nothing on port 18443, at 20:52 UTC:

Environment Answer
EXTENDDB__SERVER__PORT=abc exit 1, healthcheck failed: EXTENDDB__SERVER__PORT 'abc' is not a valid port: invalid digit found in string
EXTENDDB__SERVER__PORT holds the byte 0xFF exit 1, healthcheck failed: Cannot connect to 127.0.0.1:18443: Connection refused (os error 111)
EXTENDDB__SERVER__BIND_ADDR holds the byte 0xFF exit 1, the same Cannot connect to 127.0.0.1:18443

The byte 0xFF in the port gives the answer of an unset port. The probe goes to the default port, and the message does not name the variable.

On main, any variable that is not UTF-8 stops serve with a panic before it reads the key pair (#977). Neither reader changes in the fix for #977.

Expected

Each reader refuses a value that is not UTF-8 with a message that names the variable, as the disable switch and the configuration loader do.

Ngôn ngữ chính
Rust
Star
517
Fork
60
Merge trung bình
3 ngày 21 giờ
Pull request đã merge (30 ngày)
116

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ExtendDB/extenddb

Tất cả issue của ExtendDB/extenddb

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.