Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: test/filterClasses.js

Issue 29806570: Noissue - Add a test to confirm an evil rewrite gets cancelled (Closed) Base URL: https://hg.adblockplus.org/adblockpluscore/
Patch Set: Created June 13, 2018, 4:46 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/filterClasses.js
===================================================================
--- a/test/filterClasses.js
+++ b/test/filterClasses.js
@@ -541,10 +541,20 @@
filterRelative.rewriteUrl("http://content.server/file/foo.txt?bar"),
"http://content.server/file/foo.txt/disable"
);
test.equal(
filterRelative.rewriteUrl("http://example.com/file/foo.txt?bar"),
"http://example.com/file/foo.txt/disable"
);
+ // Example from https://github.com/uBlockOrigin/uBlock-issues/issues/46#issuecomment-391190533
+ // The rewrite shouldn't happen.
+ let rewriteEvil = "/(^https?:\\/\\/[^/])/$script,rewrite=$1.evil.com";
+ let filterEvil = Filter.fromText(rewriteEvil);
+
+ test.equal(
+ filterEvil.rewriteUrl("https://www.adblockplus.org/script.js"),
+ "https://www.adblockplus.org/script.js"
+ );
+
test.done();
};
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld