Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

`Authority::from_static` does not perform adequate validation

Offen
#879 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
52/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
rust

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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

Vorherrschende Sprache
Rust
Sterne
1.4k
Forks
385
Ø Merge
1 T. 5 Std.
Gemergte PRs (30 T.)
2

Entwicklungsumgebung

Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus hyperium/http

Alle Issues in hyperium/http

Ähnliche Issues

Weitere Issues zu Rust

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.