Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HttpRouteParser incorrectly handles catch-all routes #5466

Open
dariusclay opened this issue Oct 3, 2024 · 0 comments
Open

HttpRouteParser incorrectly handles catch-all routes #5466

dariusclay opened this issue Oct 3, 2024 · 0 comments
Assignees
Labels
bug This issue describes a behavior which is not expected - a bug.

Comments

@dariusclay
Copy link
Contributor

dariusclay commented Oct 3, 2024

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
@dariusclay dariusclay added untriaged bug This issue describes a behavior which is not expected - a bug. labels Oct 3, 2024
@dariusclay dariusclay self-assigned this Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue describes a behavior which is not expected - a bug.
Projects
None yet
Development

No branches or pull requests

1 participant