2011-01-28 Adam Barth <abarth@webkit.org>
Reviewed by Daniel Bates.
Sketch out new XSS filter design (disabled by default)
https://bugs.webkit.org/show_bug.cgi?id=53205
This patch adds a basic sketch of the new XSS filter design. Rather
than watching scripts as they execute, in this design, we watch tokens
emitted by the tokenizer. We then map the tokens directly back into
input characters, which lets us skip all the complicated logic related
to HTML entities and double-decoding of JavaScript URLs.
This patch contains only the bare essentially machinery. I'll add more
in future patches and eventually remove the previous code once this
code is up and running correctly.
* Android.mk:
* CMakeLists.txt:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::HTMLDocumentParser):
(WebCore::HTMLDocumentParser::pumpTokenizer):
(WebCore::HTMLDocumentParser::sourceForToken):
* html/parser/HTMLDocumentParser.h:
* html/parser/XSSFilter.cpp: Added.
* html/parser/XSSFilter.h: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76980 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/WebCore.pro b/Source/WebCore/WebCore.pro
index 34804ba..ee0efcb 100644
--- a/Source/WebCore/WebCore.pro
+++ b/Source/WebCore/WebCore.pro
@@ -1039,6 +1039,7 @@
html/parser/HTMLViewSourceParser.cpp \
html/parser/TextDocumentParser.cpp \
html/parser/TextViewSourceParser.cpp \
+ html/parser/XSSFilter.cpp \
html/shadow/MediaControls.cpp \
html/shadow/SliderThumbElement.cpp \
inspector/ConsoleMessage.cpp \
@@ -1939,6 +1940,7 @@
html/parser/HTMLTokenizer.h \
html/parser/HTMLTreeBuilder.h \
html/parser/HTMLViewSourceParser.h \
+ html/parser/XSSFilter.h \
inspector/ConsoleMessage.h \
inspector/InjectedScript.h \
inspector/InjectedScriptHost.h \