Skip to content

HttpRouteParser incorrectly handles catch-all routes #5466

@dariusclay

Description

@dariusclay

Description

The HttpRouteParser.TryExtractParameters method in the Microsoft.Extensions.Telemetry library does not handle route parameters that are marked as catch-all. This can lead to either truncated export of the route parameter in structured logging, or misleading redacted data in the output.

Reproduction Steps

  1. Create a route with a catch-all parameter, for example: {*catchall}
  2. Use the HttpRouteParser to parse this route.
  3. Observe the parsing result.

Expected behavior

The HttpRouteParser should correctly handle and parse catch-all route parameters.

Actual behavior

The HttpRouteParser fails to correctly parse routes with catch-all parameters, leading to incorrect logs.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

When redaction is configured, redacted values may be unintuitive because only the first segment of the catch-all route is used.

For example, the following produces the same results since only the segment /1 is taken into account.

redaction: HmacRedactor

route template: path/with/{*catchAll}

requests:

  • path/with/1/2/3
  • path/with/1/2
  • path/with/1
  • path/with/1/some/data

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions