Repository navigation
Aster.AspNetCore: decode escaped IDs in route values - #241
Merged
Merged
Conversation
Servers decode every escape in a path except %2F, so an ID escaped as one segment (a/b -> a%2Fb) reached the services as "a%2Fb" and every ID-routed endpoint returned 404. Each definition, aspect and resource endpoint that takes an ID now decodes its route value: from the raw request target when the server exposes one, so an ID holding the text "%2F" (sent as %252F) is not decoded twice, and otherwise by reading %2F as '/'. The route table is unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RYFktRCcspUcnjegpt54xF
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RYFktRCcspUcnjegpt54xF
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #239. Program #58.
Problem
Core accepts
/in definition, aspect and resource IDs. Clients escape such an ID as one path segment (a/b→a%2Fb). ASP.NET Core decodes every escape in the path except%2F, so the endpoints receiveda%2Fb. Every lookup by ID then returned 404, and so did writes, versions, activation and schema export.Change
AsterRouteIds.Decode, runs at the 9 endpoints that take an ID:%passes through unchanged./(a%2Fb) from the literal text%2F(a%252Fb), because the server has already decoded both toa%2Fb.%2Fas/.Aster.Elsa.Studioclient are unchanged.wiki/AspNetCore-Endpoints.md.Aster.Elsa.Agentstest added in Elsa agents: keep references to deleted agents saveable; refuse saves to deleted agents #235. The Release build of the solution now has 0 warnings.Verification
%2F/%2f.%25is decoded, so%252Farrives as%2F.Resources_IdsWithReservedCharacters_RoundTripThroughEscapedPathsDefinitionsAndAspects_IdsWithReservedCharacters_RoundTripThroughEscapedPathsResources_IdsWithReservedCharacters_RoundTripUnderAPathBase/,%,+, space,#,?&=, unicode, and literal%2F(Kestrel only)./, as a 404). With the raw-target step removed, the 4 literal-%2Fcases fail.Aster.AspNetCore.Tests: 76/76 on net8.0, net9.0 and net10.0.Aster.Elsa.Studio.Tests: 99/99 on each framework.Generated by Claude Code
Summary by CodeRabbit
Bug Fixes
%2Fvalues when requests are sent through compatible hosting configurations.Documentation
Tests