Skip to content

UriTemplate parser fails on Regular Expressions with quantifiers [SPR-13624] #18202

@spring-projects-issues

Description

@spring-projects-issues

Thorsten Schoel opened SPR-13624 and commented

UriTemplate allows for template variables to define a matching pattern.
These patterns are regular expressions. UriTemplate's inner class Pattern makes use
of a Regular Expression itself to identify variables in the template string. This Regular
Expression ("\\{([^/]+?)\\}") will match anything between a pair of curly brackets, where
a pair is an opening bracket and the next closing bracket. The problem here is that no
balancing is performed and thus template Regular Expressions containing a closing
curly bracket will lead to wrong parsing. Examples are Regular Expressions containing
literal brackets (\}) or certain quantifiers ({n}, {n,}, {,n}, or {n,m}), such as
"/path/{var:\\d{8}}".

Affects: 4.2.2

Issue Links:

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)status: duplicateA duplicate of another issue

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions