Skip to content

4.x - Handle %2f in routing more consistently - #19539

Merged
markstory merged 1 commit into
4.xfrom
backport-19537
Jul 14, 2026
Merged

markstory merged 1 commit into
4.xfrom
backport-19537

Conversation

@markstory

Copy link
Copy Markdown
Member

Currently path prefix matching does not treat %2f as /, and Route has an option for it. In the past we've made changes in this area (#18050, #16110) to make urldecoding optional, and to intentionally decode urlencoding in path segments to support non-ascii applications.

We got a report on the security list for a potential issue where if an application enforced authorization within path prefixed scopes, and had fallback routes enabled, then one could potentially bypass the scoped middleware and hit the fallback routes which inconsistently handle %2f.

These changes align the behavior of urldecoding between RouteCollection and Route with a new shared internal function. I thought a function was better than exposing a static method on a public class.

Thanks to Rotem Reiss for reporting this issue.

@markstory markstory changed the title Handle %2f in routing more consistently 4.x - Handle %2f in routing more consistently Jul 12, 2026
Currently path prefix matching does not treat %2f as /, and `Route` has
an option for it. In the past we've made changes in this area
(#18050, #16110) to make urldecoding optional, and to intentionally
decode urlencoding in path segments to support non-ascii applications.

We got a report on the security list for a potential issue where *if*
an application enforced authorization within path prefixed scopes, and
had fallback routes enabled, then one could potentially bypass the scoped
middleware and hit the fallback routes which inconsistently handle %2f.

These changes align the behavior of urldecoding between RouteCollection
and Route with a new shared internal function. I thought a function was
better than exposing a static method on a public class.

Thanks to Rotem Reiss for reporting this issue.
@markstory
markstory merged commit 40d9023 into 4.x Jul 14, 2026
11 of 13 checks passed
@markstory
markstory deleted the backport-19537 branch July 14, 2026 03:03
markstory added a commit that referenced this pull request Jul 15, 2026
Handle %2f in routing more consistently

Currently path prefix matching does not treat %2f as /, and `Route` has
an option for it. In the past we've made changes in this area
(#18050, #16110) to make urldecoding optional, and to intentionally
decode urlencoding in path segments to support non-ascii applications.

We got a report on the security list for a potential issue where *if*
an application enforced authorization within path prefixed scopes, and
had fallback routes enabled, then one could potentially bypass the scoped
middleware and hit the fallback routes which inconsistently handle %2f.

These changes align the behavior of urldecoding between RouteCollection
and Route with a new shared internal function. I thought a function was
better than exposing a static method on a public class.

Thanks to Rotem Reiss for reporting this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant