HTTP logging truncates catch-all route parameters in the formatted request path
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
Research direction
Start by reading HttpRouteFormatter.Format and compare its catch-all handling with HttpRouteParser.TryExtractParameters, which the issue says already handles this case. Use the unit-level reproduction in the issue to check formatted output for {*path} and {**path}. Done means the formatter preserves all remaining path segments and produces the expected redacted path.
Written by the indexing model from the issue text.
Description
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/1andfiles/a/2produce the same redacted value. - When the catch-all parameter isn't redacted, the logged path is cut short (for example,
api/[REDACTED]/files/ainstead ofapi/[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.
- Dominant language
- C#
- Stars
- 3.3k
- Forks
- 914
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 42
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/extensions
-
Managed DNS resolver ignores tab-separated nameserver lines in /etc/resolv.confPossibly taken @johnkaram02 claimed this today. Openneeds-area-label untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dotnet/extensions#7881 ·
Maintainers usually reply within 1 day
-
[Microsoft.Extensions.AI.OpenAI] AsOpenAIStreamingChatCompletionUpdatesAsync writes finish_reason "stop" on every chunk with a null FinishReasonPossibly taken @nurullahturkoglu claimed this 3 days ago. Openarea-ai untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
dotnet/extensions#7863 ·
Maintainers usually reply within 1 day
-
Outgoing HttpClient LatencyInfo enricher value has incomplete escapingPossibly taken @zjdangge claimed this 4 days ago. Openarea-telemetry untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
dotnet/extensions#7757 · 1 comment ·
Maintainers usually reply within 1 day
-
OpenAIResponsesChatClient.ToChatMessages never surfaces reasoning.content — only reads GetSummaryText()Possibly taken @LouisDeconinck claimed this 40 days ago. Openarea-ai untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 86/100
dotnet/extensions#7714 · 1 reaction ·
Maintainers usually reply within 1 day
-
[Microsoft.Extensions.AI] AIFunctionFactory does not tolerate a JsonElement of ValueKind String as a JSON-stringified argument (gap in #6572)May be free again A pull request for this issue was closed without being merged. Openarea-ai enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
dotnet/extensions#7626 · 4 comments ·
Maintainers usually reply within 1 day
All issues in dotnet/extensions
Similar issues
-
area-multitenancy area-security p1-recommended priority-high technical-debt
Difficulty 2/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
kind/enhancement Provider Upgrade pulumi/pulumi-azure R1 Task
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
pulumi/pulumi-azure#3669 ·
-
type/bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
webclient does not startPossibly taken @PawelTroka claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PawelTroka/Computator.NET#257 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
eriknihlen/OpenAC#255 ·
Maintainers usually reply within 1 day