Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

`Authority::from_static` does not perform adequate validation

オープン
#879 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
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 を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

hyperium/http のほかの issue

hyperium/http の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。