Path building re-parses every intermediate on each budgeted call (unbudgeted CPU cost)
Los mantenedores suelen responder en 1 día
@batmnnn ya está trabajando en esto.
Desde el 23/10/2026.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 72/100
- Tipo de issue
- Refactorización
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- rust
- Área
- cryptography
Línea de trabajo
Start at src/verify_cert.rs, in build_chain_inner/PathBuilder where the issue links lines 149-150: each recursive step calls Cert::from_der over all intermediate_certs before the issuer comparison. Hoist that parsing into a Vec<Cert> built once at the start of build_chain (skipping or recording parse failures), keeping Budget semantics unchanged. Read the Budget definition and the test_too_many_path_calls regression test first, then run cargo test to confirm budget and path-building tests still pass; done means intermediates are parsed once and the per-recursion step is only a name comparison.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
While reviewing rustls-webpki 0.103.15 we noticed that path building re-parses every peer-supplied intermediate on each budgeted path-building call, and that this parsing is not itself counted against the budget.
Where. In build_chain_inner (ChainOptions in 0.103.15, PathBuilder on main), every recursive step iterates over all of intermediate_certs and calls Cert::from_der on each one before the issuer comparison (0.103.15 src/verify_cert.rs:108; on current main at https://github.com/rustls/webpki/blob/3d0adc46704c1d985a9fefe2034650488d96d49e/src/verify_cert.rs#L149-L150). The Budget (the RUSTSEC-2023-0053 fix) limits build-chain calls and signature checks, but the per-call parse of each intermediate is outside it.
Cost. This is bounded: at most the 200,000-call budget times the bytes of intermediates, and rustls caps the Certificate message at 64 KiB. In practice, a filler-padded chain that fits in a 64 KiB handshake message costs about 0.5-1 s of CPU per handshake on our hardware (worst measured 758 ms). Plain degenerate chains (the test_too_many_path_calls shape) stop within about 66 ms. So a malicious TLS server can make a client spend up to roughly a second of CPU per connection attempt before the handshake fails.
Suggestion (hardening, not a vulnerability report). Parse the intermediates once per build_chain (for example into a Vec<Cert> up front, skipping or remembering the ones that fail to parse) and reuse the parsed certificates in each recursive step. That would make the per-call cost an issuer-name comparison rather than a full DER parse, without changing the budget semantics.
We are filing this as an enhancement idea only; we know the budget is a deliberate, tested design copied from mozilla::pkix, and we are not asking for a change to it.
- Lenguaje dominante
- Rust
- Estrellas
- 166
- Forks
- 111
- Merge medio
- 3 h 39 min
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de rustls/webpki
-
Improve error message when denying subject name due to wildcard in public suffixQuizá libre de nuevo @ctz la tomó hace 73 días y no hay ningún pull request abierto. Abierto
rustls/webpki#532 · 1 reacción · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Consider all candidate CRLsQuizá libre de nuevo @cpu la tomó hace 78 días y no hay ningún pull request abierto. Abierto
rustls/webpki#526 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
Add opt-in support for ignoring URI name constraintsPosiblemente ocupada @djc la tomó hace 128 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
rustls/webpki#514 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 48/100
rustls/webpki#505 · 5 comentarios ·
Los mantenedores suelen responder en 1 día
-
Email Name ConstraintsAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
rustls/webpki#445 · 4 comentarios ·
Los mantenedores suelen responder en 1 día
Todos los issues de rustls/webpki
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
n0-computer/iroh#4669 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
rubys/roundhouse#1950 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
cloudflare/workers-rs#1130 ·
Los mantenedores suelen responder en 11 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
vfarcic/dot-agent-deck#2160 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
RustCrypto/utils#1597 ·
Los mantenedores suelen responder en 1 día