[MAGNOLIA-549] Regex Problem with VirtualURIMapping Created: 17/Sep/05  Updated: 23/Jan/13  Resolved: 30/Nov/05

Status: Closed
Project: Magnolia
Component/s: core
Affects Version/s: 2.1 Final
Fix Version/s: 3.0 Beta 1

Type: Bug Priority: Major
Reporter: Stojan Peshov Assignee: Sameer Charles
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

WindowsXP, jdk1.5, tomcat1.5.9


Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:

 Description   

I have this site structure
en
\ - homepage
\ - somepage
:
I don't show en node in menu, neither in sitemap
,but /en is still available for browsing (normally)
I tried to disable this by adding an entry in VirtualUriMapping like this:
fromUri: /en
toUri: /en/homepage.html
but i can still browse /mk.html
so I added another entry
fromUri: /en.*
toUri: /en/homepage.html
and this caused Exception (I guess because of the loop)
/en.* is considered as /en* (without dot)
to ensure this I tried /en.h* also (it was the same)
and /en.ht* and /en.htm* (this passed)
I debugged a little and figure out that the possible problem might be regex pattern
that is replaced for the wildcard *

and the most interesting was that /en.whatever also lets me browse the /en
without any VirtualUriMappings
i can't think of any possible security issues caused by this,
but yet this is not such a good thing...



 Comments   
Comment by Sameer Charles [ 30/Nov/05 ]

VirtualURIMapping follows Regular Expressions
where (.) dot matches any charater except a line break.

------------------------------------------------------------------
tried to disable this by adding an entry in VirtualUriMapping like this:
fromUri: /en
toUri: /en/homepage.html
but i can still browse /mk.html

> see my comments below

so I added another entry
fromUri: /en.*
toUri: /en/homepage.html
and this caused Exception (I guess because of the loop)
/en.* is considered as /en* (without dot)

> its because (.) dot replaces "any" single character

to ensure this I tried /en.h* also (it was the same)

> this will match to /en[ DOT MATCHED TO / ]h*
> and your URI is /en/homepage.html
> that's why it was the same

and /en.ht* and /en.htm* (this passed)

> sure
> this will match to /en/htttttt.html or /en/html.html

Generated at Mon Feb 12 03:18:31 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.