Bug 126366 - this|window.status rewrite fails to account for escaped '"s
Summary: this|window.status rewrite fails to account for escaped '"s
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: privoxy
Version: 1
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Karsten Hopp
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2004-06-20 10:19 UTC by Anduin Withers
Modified: 2007-11-30 22:10 UTC (History)
0 users

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2005-09-08 12:09:15 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Anduin Withers 2004-06-20 10:19:40 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET 
CLR 1.0.3705; .NET CLR 1.1.4322)

Description of problem:
When privoxy is rewriting changes to (this|window).status it will 
create invalid javascript if the original string attempts to escape 
the quote charater.

Version-Release number of selected component (if applicable):
privoxy-3.0.3-1

How reproducible:
Always

Steps to Reproduce:
1. Create a simple file to run through the proxy, one like this works:

<?php
    print("<a href=\"bugzilla.redhat.com\" target=\"new\" 
onmouseover=\"window.status = 'bug\'s'\">broken</a>\n<br>\n");
    print("<a href=\"bugzilla.redhat.com\" target=\"new\" 
onmouseover=\"window.status = 'bugs'\">works</a>\n");
?>

2. Load the page through the proxy.

3. Note the bad output caused by the escape character unaware match 
in /etc/privoxy/default.filter
    

Additional info:

Comment 1 Anduin Withers 2004-06-20 20:20:33 UTC
Oh yeah, here is the fix I'm using:

s/(\W\s*)((this|window)\.(default)?status)\s*=\s*((['"]).*?(?<!\\)\6)/
$1if(typeof(this.href) != 'undefined') $2 = $5 + ' URL: ' + 
this.href;else return false/ig

Note the (?<!\\) before \6 so it matches the full string.

Comment 2 Karsten Hopp 2005-09-08 12:09:15 UTC
fix added to the rawhide package, thanks!


Note You need to log in before you can comment on or make changes to this bug.