Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

`Authority::from_static` does not perform adequate validation

Abierto
#879 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
52/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
rust

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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

Lenguaje dominante
Rust
Estrellas
1.4k
Forks
385
Merge medio
1 d 5 h
PR fusionados (30 d)
2

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de hyperium/http

Todos los issues de hyperium/http

Issues similares

Más issues de Rust

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.