extensions
extensions copied to clipboard
HttpRouteParser incorrectly handles catch-all routes
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
- Create a route with a catch-all parameter, for example: {*catchall}
- Use the HttpRouteParser to parse this route.
- 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/3path/with/1/2path/with/1path/with/1/some/data