Non-correct url's transformation with traversal directory symbols (../)

View: New views
2 Messages — Rating Filter:   Alert me  

Non-correct url's transformation with traversal directory symbols (../)

by Parkin Roman :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi all,

I have sample file (links.html)

Content
----------------------------
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>

<body>
<a href="http://pit.dirty.ru/dirty/1/2009/09/17/2/../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg">ShouldTest</a>
</body>
</html>

--------------------------

Url link is specific and contains '../' after '/2/' - "non-existed" folder. In browsers I can click on link and jpg is loaded

Current webtest version uses 2.6 HtmlUnit

I execute the following test:

<invoke url="file://D:/Public/link.html" />
<clickLink label="ShouldTest" />

I a results I got 404 error

Debug log:

[clickLink] DEBUG (com.canoo.webtest.steps.request.ClickLink) - Clicking on link with href: http://pit.dirty.ru/dirty/1/2009/09/17/2/../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg
[clickLink] DEBUG (com.gargoylesoftware.htmlunit.html.HtmlAnchor) - Getting page for http://pit.dirty.ru/dirty/1/2009/09/17/2/../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg, derived from href 'http://pit.dirty.ru/dirty/1/2009/09/17/2/../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg', using the originating URL file://D:/Public/link.html
[clickLink] DEBUG (com.gargoylesoftware.htmlunit.html.HtmlElement) - Firing Event beforeunload (Current Target: HTMLElement for HtmlHtml[<html xmlns="http://www.w3.org/1999/xhtml">]);
[clickLink] DEBUG (com.gargoylesoftware.htmlunit.WebClient) - Get page for window named '', using WebRequestSettings[<url="http://pit.dirty.ru/dirty/17/18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg", GET, EncodingType[name=application/x-www-form-urlencoded], [], {Accept-Language=en-us, Referer=file://D:/Public/link.html, Accept=*/*}, null>]
[clickLink] DEBUG (com.gargoylesoftware.htmlunit.WebClient) - Load response for http://pit.dirty.ru/dirty/17/18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg

Find URL:   http://pit.dirty.ru/dirty/1/2009/09/17/2/../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg
Open URL: http://pit.dirty.ru/dirty/17/18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg


The same is reproduced then URL is contained ../../

Find URL:   http://pit.dirty.ru/dirty/1/2009/09/17/2/1/../../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg
Open URL: http://pit.dirty.ru/dirty/17/../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg

Try webtest release with HtmlUnit 2.4 - No problems found, all correct opened

--
Best regards,
Roman Parkin
Testing Team Lead
Texuna Technologies Ltd
This email is confidential and may also be privileged. If you are not the intended recipient please notify us immediately and delete this message from your system.
Help us to be environmentally responsible. Please do not print this email unless you need to.
_______________________________________________ WebTest mailing list WebTest@... http://lists.canoo.com/mailman/listinfo/webtest

Re: Non-correct url's transformation with traversal directory symbols (../)

by Marc Guillemot :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I think that this problem of url normalization has been fixed in
HtmlUnit since release 2.6. I want to integrate a recent 2.7 snapshot in
WebTest in the coming days. It should fix you problem.

Cheers,
Marc.

Parkin Roman a écrit :

> Hi all,
>
> I have sample file (links.html)
>
> Content
> ----------------------------
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
>
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; " />
> <title>Untitled Document</title>
> </head>
>
> <body>
> <a
> href="http://pit.dirty.ru/dirty/1/2009/09/17/2/../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg">ShouldTest</a>
> </body>
> </html>
>
> --------------------------
>
> Url link is specific and contains '../' after '/2/' - "non-existed"
> folder. In browsers I can click on link and jpg is loaded
>
> Current webtest version uses 2.6 HtmlUnit
>
> I execute the following test:
>
> <invoke url="file://D:/Public/link.html" />
> <clickLink label="ShouldTest" />
>
> I a results I got 404 error
>
> Debug log:
>
> [clickLink] DEBUG (com.canoo.webtest.steps.request.ClickLink) - Clicking
> on link with href:
> http://pit.dirty.ru/dirty/1/2009/09/17/2/../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg
> [clickLink] DEBUG (com.gargoylesoftware.htmlunit.html.HtmlAnchor) -
> Getting page for
> http://pit.dirty.ru/dirty/1/2009/09/17/2/../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg,
> derived from href
> 'http://pit.dirty.ru/dirty/1/2009/09/17/2/../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg',
> using the originating URL file://D:/Public/link.html
> [clickLink] DEBUG (com.gargoylesoftware.htmlunit.html.HtmlElement) -
> Firing Event beforeunload (Current Target: HTMLElement for
> HtmlHtml[<html xmlns="http://www.w3.org/1999/xhtml">]);
> [clickLink] DEBUG (com.gargoylesoftware.htmlunit.WebClient) - Get page
> for window named '', using
> WebRequestSettings[<url="http://pit.dirty.ru/dirty/17/18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg",
> GET, EncodingType[name=application/x-www-form-urlencoded], [],
> {Accept-Language=en-us, Referer=file://D:/Public/link.html, Accept=*/*},
> null>]
> [clickLink] DEBUG (com.gargoylesoftware.htmlunit.WebClient) - Load
> response for
> http://pit.dirty.ru/dirty/17/18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg
>
> Find URL:  
> http://pit.dirty.ru/dirty/1/2009/09/17/2/../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg
> Open URL:
> http://pit.dirty.ru/dirty/17/18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg
>
>
> The same is reproduced then URL is contained ../../
>
> Find URL:  
> http://pit.dirty.ru/dirty/1/2009/09/17/2/1/../../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg
> Open URL:
> http://pit.dirty.ru/dirty/17/../18243-192009-16a7decc94fe564e251aac8a23843d3c.jpg
>
> Try webtest release with HtmlUnit 2.4 - No problems found, all correct
> opened
>
> --
> Best regards,
> *Roman Parkin*
> Testing Team Lead
> *Texuna Technologies Ltd <http://www.texunatech.com>*
> This email is confidential and may also be privileged. If you are not
> the intended recipient please notify us immediately and delete this
> message from your system.
> Help us to be environmentally responsible. Please do not print this
> email unless you need to.
> _______________________________________________ WebTest mailing list
> WebTest@... http://lists.canoo.com/mailman/listinfo/webtest

_______________________________________________
WebTest mailing list
WebTest@...
http://lists.canoo.com/mailman/listinfo/webtest