Skip to content

Commit dfddd88

Browse files
committed
[Paste2.org] Fix bad regexp.
Also, expand trivial-validate to catch this case. Fixes EFForg#2220
1 parent c46c9ec commit dfddd88

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/chrome/content/rules/Paste2.org-falsemixed.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
<!-- (avoiding cf_clearance <= mixed content)
1414
-->
15-
<securecookie host="^\.paste2\.org$" name="^(?:__cfduid|__qca$" />
15+
<securecookie host="^\.paste2\.org$" name="^(?:__cfduid|__qca)$" />
1616

1717

1818
<rule from="^http:"

utils/trivial-validate.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ def fail(s):
3232

3333
# Precompile xpath expressions that get run repeatedly.
3434
xpath_exclusion_pattern = etree.XPath("/ruleset/exclusion/@pattern")
35-
xpath_cookie_pattern = etree.XPath("/ruleset/securecookie/@host")
35+
xpath_cookie_host_pattern = etree.XPath("/ruleset/securecookie/@host")
36+
xpath_cookie_name_pattern = etree.XPath("/ruleset/securecookie/@name")
3637

3738
# Load lists of ruleset names whitelisted for downgrade & duplicate rules
3839
thispath = os.path.dirname(os.path.realpath(__file__))
@@ -44,8 +45,9 @@ def fail(s):
4445

4546
def test_bad_regexp(tree, rulename, from_attrib, to):
4647
# Rules with invalid regular expressions.
47-
"""The 'from' rule contains an invalid extended regular expression."""
48-
patterns = from_attrib + xpath_exclusion_pattern(tree) + xpath_cookie_pattern(tree)
48+
"""The rule contains an invalid extended regular expression."""
49+
patterns = (from_attrib + xpath_exclusion_pattern(tree) +
50+
xpath_cookie_host_pattern(tree) + xpath_cookie_name_pattern(tree))
4951
for pat in patterns:
5052
try:
5153
re.compile(pat)

0 commit comments

Comments
 (0)