Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #204 from AutomatedTester/marionette

Bug 741812 - add Marionette to review items
  • Loading branch information...
commit 4a40a7cd179c4d4eaa0a23d7ff9f8969456adfa2 2 parents 7aa5f1f + 513adb0
Matt Basta authored
Showing with 47 additions and 0 deletions.
  1. +10 −0 tests/test_regex.py
  2. +37 −0 validator/testcases/regex.py
10 tests/test_regex.py
View
@@ -13,6 +13,16 @@ def test_valid():
"Tests a valid string in a JS bit"
assert not _do_test_raw("var x = 'network.foo';").failed()
+def test_marionette_preferences_and_references_fail():
+ "Tests that check for marionette. Added in bug 741812"
+
+ assert _do_test_raw("var x = 'marionette.defaultPrefs.port';").failed()
+ assert _do_test_raw("var x = 'marionette.defaultPrefs.enabled';").failed()
+ assert _do_test_raw("var x = 'marionette.force-local';").failed()
+ assert _do_test_raw("var x = '@mozilla.org/marionette;1';").failed()
+ assert _do_test_raw("var x = '{786a1369-dca5-4adc-8486-33d23c88010a}';").failed()
+ assert _do_test_raw("var x = 'MarionetteComponent';").failed()
+ assert _do_test_raw("var x = 'MarionetteServer';").failed()
def test_basic_regex_fail():
"Tests that a simple Regex match causes a warning"
37 validator/testcases/regex.py
View
@@ -210,6 +210,43 @@ def js_tests(self):
@register_generator
+class MarionetteInPrefsRegexTests(RegexTestGenerator):
+ """
+ These regex tests will ensure that the developer is not switching on
+ Marionette prefs
+
+ Added from bug 741812
+ """
+
+ MARIONETTE_REFERENCES = {"@mozilla.org/marionette;1": 741812,
+ "{786a1369-dca5-4adc-8486-33d23c88010a}": 741812,
+ "MarionetteComponent": 741812,
+ "MarionetteServer": 741812}
+
+ MARIONETTE_PREFS = {"marionette.force-local": 741812,
+ "marionette.defaultPrefs.enabled": 741812,
+ "marionette.defaultPrefs.port": 741812}
+ @classmethod
+ def applicable(cls, err, filename, document):
+ return bool(re.match(r"defaults/preferences/.+\.js", filename))
+
+ def tests(self):
+ for ref, bug in self.MARIONETTE_REFERENCES.items():
+ yield self.get_test(
+ bug,
+ ref,
+ "Marionette references are not allowed as it could lead to"
+ "the browser not being secure. Please remove them.")
+
+ for ref, bug in self.MARIONETTE_PREFS.items():
+ yield self.get_test(
+ bug,
+ ref,
+ "Marionette preferences are not allowed as it could lead to"
+ "the browser not being secure. Please remove them.")
+
+
+@register_generator
class PasswordsInPrefsRegexTests(RegexTestGenerator):
"""
These regex tests will ensure that the developer is not storing passwords
Please sign in to comment.
Something went wrong with that request. Please try again.