`Authority::from_static` does not perform adequate validation
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 52/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- rust
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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
- 主要言語
- Rust
- スター
- 1.4k
- フォーク
- 385
- 平均マージ
- 1日 5時間
- マージ済み PR(30日)
- 2
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
hyperium/http のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 58/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 62/100
似ている issue
-
area/infra good first issue type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
cristim/AztecCraft#92 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
charles-hood/DiagramCraft#51 ·
-
S: Untriaged T: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
libnyanpasu/clash-nyanpasu#5788 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
area:cli bug good first issue priority:medium
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信