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

HTTP logging truncates catch-all route parameters in the formatted request path

Abierto Apto para principiantes
#7,883 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

@johnkaram02 ya está trabajando en esto.

Desde el 23/10/2026.

  • #7884 de @johnkaram02 — abierto

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
csharp
Área
backend

Línea de trabajo

Empieza leyendo HttpRouteFormatter.Format y compara su tratamiento de las rutas catch-all con HttpRouteParser.TryExtractParameters, que, según indica el issue, ya gestiona este caso. Usa la reproducción a nivel de unidad del issue para comprobar la salida formateada para {*path} y {**path}. La tarea estará completa cuando el formatter conserve todos los segmentos restantes de la ruta y genere la ruta esperada redacted.

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

Descripción

area-telemetry untriaged
Description

When HTTP logging uses the formatted path mode, which is the default (IncomingPathLoggingMode.Formatted for AddHttpLoggingRedaction and OutgoingPathLoggingMode.Formatted for AddExtendedHttpClientLogging), the request path is built by the internal HttpRouteFormatter. For a route with a catch-all parameter such as {*path} or {**path}, the formatter takes only the first path segment of the value and drops the rest of the path.

#5466 fixed the same problem in HttpRouteParser.TryExtractParameters, which the structured path mode uses. HttpRouteFormatter.Format still ignores Segment.IsCatchAll.

As a result:

  • A redactor receives only the first segment, so files/a/1 and files/a/2 produce the same redacted value.
  • When the catch-all parameter isn't redacted, the logged path is cut short (for example, api/[REDACTED]/files/a instead of api/[REDACTED]/files/a/b/c).
Reproduction steps

Unit-level repro against the internal formatter, using the FakeRedactorProvider from Microsoft.Extensions.Compliance.Testing:

var redactorProvider = new FakeRedactorProvider(new FakeRedactorOptions { RedactionFormat = "Redacted:{0}" });
var formatter = new HttpRouteFormatter(new HttpRouteParser(redactorProvider), redactorProvider);

var parametersToRedact = new Dictionary<string, DataClassification>
{
    { "userId", FakeTaxonomy.PrivateData },
    { "path", FakeTaxonomy.PrivateData },
};

formatter.Format("api/{userId}/files/{*path}", "api/user1/files/a/b/c", HttpRouteParameterRedactionMode.Strict, parametersToRedact);

From the code, an ASP.NET Core app that maps app.MapGet("/api/{userId}/files/{*path}", ...) and calls AddHttpLoggingRedaction() goes through the same formatter. I reproduced it with the unit-level example above, not in a running app.

Expected behavior

api/Redacted:user1/files/Redacted:a/b/c

Actual behavior

api/Redacted:user1/files/Redacted:a

Regression?

No.

Known workarounds

From the code, setting RequestPathLoggingMode to Structured should avoid it, since that mode uses HttpRouteParser, which handles catch-all parameters.

Configuration

Current main, .NET 10. Found by reading the code and confirmed with a unit test.

Other information

The formatter can apply the same rule the parser already uses: a catch-all parameter takes the rest of the path.

Lenguaje dominante
C#
Estrellas
3.3k
Forks
914
Merge medio
2 d 7 h
PR fusionados (30 d)
42

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

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 dotnet/extensions

Todos los issues de dotnet/extensions

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.