Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3980)

Unified Diff: Source/devtools/scripts/check_injected_script_source.py

Issue 470543002: DevTools: Don't allow native global functions in injected script. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: rebased Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/inspector/InjectedScriptSource.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/devtools/scripts/check_injected_script_source.py
diff --git a/Source/devtools/scripts/check_injected_script_source.py b/Source/devtools/scripts/check_injected_script_source.py
index 18d1e8a542888f8eca3b0b7f923eb6e767c732b2..0119988318688d944d9f23e01be939de7ad66549 100755
--- a/Source/devtools/scripts/check_injected_script_source.py
+++ b/Source/devtools/scripts/check_injected_script_source.py
@@ -45,12 +45,18 @@ def validate_injected_script(fileName):
"apply", "bind", "call", "isGenerator", "toSource",
])
+ global_functions = "|".join([
+ "eval", "uneval", "isFinite", "isNaN", "parseFloat", "parseInt", "decodeURI", "decodeURIComponent",
+ "encodeURI", "encodeURIComponent", "escape", "unescape",
+ ])
+
# Black list:
# - Object.prototype.toString()
# - Array.prototype.*
# - Function.prototype.*
# - Math.*
- black_list_call_regex = re.compile(r"\bMath\.\w+\(|\.(toString|" + proto_functions + r")\(")
+ # - Global functions
+ black_list_call_regex = re.compile(r"\bMath\.\w+\(|\.(toString|" + proto_functions + r")\(|[^\.]\b(" + global_functions + r")\(")
errors_found = False
for i, line in enumerate(lines):
« no previous file with comments | « Source/core/inspector/InjectedScriptSource.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698