`Authority::from_static` does not perform adequate validation
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 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ệ
- rust
- Lĩnh vực
- backend-api-design
Hướng nghiên cứu
Start by reading Authority::from_static and the validation path used by parsing, then compare how both handle the provided https://127.0.0.1 example. The issue identifies no file or test, so locate the relevant URI authority tests and check what behavior they cover. Done means from_static rejects the invalid authority consistently with parsing, with regression coverage.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
http 1.3.1 (latest)
Platform
Linux 7.0.0-31
Summary
I'm not sure if this is a documentation issue or a behavioral issue (probably be the latter), but Authority::from_static does not perform proper validation of the provided authority string; it only checks whether each individual byte is valid.
Consider the following code (playground):
use http::uri::Authority;
fn main() {
// panics
// dbg!("https://127.0.0.1".parse::<Authority>().unwrap());
// produces "valid" authority
dbg!(Authority::from_static("https://127.0.0.1"));
}
This code was introduced in a seemingly faulty attempt (here) to make from_static const.
I doubt this is intentional, but if it is, the method should be called from_static_danger_only_validate_bytes or so, and the docs should provide more warning.
Code Sample
Expected Behavior
Both methods should fail, not just parse
Actual Behavior
from_static does not perform sufficient validation.
Additional Context
No response
- Ngôn ngữ chính
- Rust
- Star
- 1.4k
- Fork
- 385
- Merge trung bình
- 1 ngày 5 giờ
- Pull request đã merge (30 ngày)
- 2
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 hyperium/http
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 58/100
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 62/100
Tất cả issue của hyperium/http
Issue tương tự
-
Stack overflow in `check bans` with `include-dependencies = true` and a dev-dependency cycleĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
EmbarkStudios/cargo-deny#910 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
tursodatabase/turso#10054 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
build: Update rust versionCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởdependencies
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
ibm-granite-community/granite-cli#229 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
setTargetAtTime booked ahead of time starts its curve early (values blow up before start_time)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
orottier/web-audio-api-rs#658 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
aosama/astronomical#1318 ·
Maintainer thường phản hồi trong vòng 1 ngày