WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
66720
chromium WebFrameImpl - don't load javascript URLs against chrome internal pages.
https://bugs.webkit.org/show_bug.cgi?id=66720
Summary
chromium WebFrameImpl - don't load javascript URLs against chrome internal pa...
Thomas Sepez
Reported
2011-08-22 14:58:42 PDT
Running JS against a chrome:// page risks sensitive information. Add a safeguard against malicious bookmarklets and the like to WebKit/Source/WebKit/chromium/src/WebFrameImpl.cpp
Attachments
Patch
(7.51 KB, patch)
2011-08-22 15:19 PDT
,
Thomas Sepez
no flags
Details
Formatted Diff
Diff
Patch
(9.58 KB, patch)
2011-08-22 17:12 PDT
,
Thomas Sepez
no flags
Details
Formatted Diff
Diff
Patch
(10.89 KB, patch)
2011-08-23 09:27 PDT
,
Thomas Sepez
no flags
Details
Formatted Diff
Diff
Patch
(12.14 KB, patch)
2011-08-23 09:42 PDT
,
Thomas Sepez
no flags
Details
Formatted Diff
Diff
Patch
(12.41 KB, patch)
2011-08-24 10:22 PDT
,
Thomas Sepez
no flags
Details
Formatted Diff
Diff
Patch
(12.98 KB, patch)
2011-08-24 11:55 PDT
,
Thomas Sepez
no flags
Details
Formatted Diff
Diff
Show Obsolete
(5)
View All
Add attachment
proposed patch, testcase, etc.
Thomas Sepez
Comment 1
2011-08-22 15:19:05 PDT
Created
attachment 104751
[details]
Patch
Adam Barth
Comment 2
2011-08-22 15:46:36 PDT
Comment on
attachment 104751
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=104751&action=review
> Source/WebKit/chromium/src/WebFrameImpl.cpp:2291 > + // Protect privileged pages against bookmarklets and other javascript > + // manipulations. > + if (m_frame->document()->url().protocolIs("chrome") > + || m_frame->document()->url().protocolIs("chrome-extension")) > + return;
We shouldn't have these string literals in this code. Isn't there something in SchemeRegistry we could use?
Thomas Sepez
Comment 3
2011-08-22 16:00:36 PDT
Didn't see an appropriate shouldTreatScheme... method in SchemeRegistry.h. Also didn't see the literal "chrome" anywhere under webkit :( ... would this be added to a SchemeRegistry category outside of webkit by the browser itself? eg, $ find . -name \*.h -exec grep '"chrome' {} /dev/null \; ./Source/WebKit/chromium/base/logging.h:// "chromeos" directory. $ find . -name \*.cpp -exec grep '"chrome' {} /dev/null \; ./Source/WebKit/chromium/src/BackForwardListChromium.cpp:const char backForwardNavigationScheme[] = "chrome-back-forward"; ./Source/WebKit/chromium/src/WebFrameImpl.cpp: if (m_frame->document()->url().protocolIs("chrome") ./Source/WebKit/chromium/src/WebFrameImpl.cpp: || m_frame->document()->url().protocolIs("chrome-extension")) ./Source/WebKit/chromium/tests/WebFrameTest.cpp: chromeURL("chrome://"
Adam Barth
Comment 4
2011-08-22 16:02:20 PDT
You can add a new type to SchemeRegistry.h. Chrome registers a bunch of schemes at with SchemeRegistry when it initializes WebKit.
Thomas Sepez
Comment 5
2011-08-22 17:12:39 PDT
Created
attachment 104770
[details]
Patch
Thomas Sepez
Comment 6
2011-08-22 17:15:56 PDT
Ok, but feels kind of wrong since only the chromium code path checks this particular registry.
Thomas Sepez
Comment 7
2011-08-22 17:33:21 PDT
Probably needs to get wrapped in a WebSecurityPolicy method ???
Adam Barth
Comment 8
2011-08-22 17:37:51 PDT
> Ok, but feels kind of wrong since only the chromium code path checks this particular registry.
Yeah, you should probably check this in ScriptController::executeIfJavaScriptURL also.
> Probably needs to get wrapped in a WebSecurityPolicy method ???
Yep!
Thomas Sepez
Comment 9
2011-08-23 09:27:41 PDT
Created
attachment 104857
[details]
Patch
Thomas Sepez
Comment 10
2011-08-23 09:32:01 PDT
would ScriptController::executeIfJavaScriptURL affect <a href="javascript:"> cases, or only navigation from the browser itself? Current patch only applies this test as before.
Thomas Sepez
Comment 11
2011-08-23 09:42:17 PDT
Created
attachment 104860
[details]
Patch
Thomas Sepez
Comment 12
2011-08-23 09:42:51 PDT
Patch with two ChangeLogs. For review. Thanks.
Adam Barth
Comment 13
2011-08-24 10:05:32 PDT
Comment on
attachment 104860
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=104860&action=review
> Source/WebCore/ChangeLog:8 > + No new tests. (OOPS!)
This line will prevent this change from landing. You should replace it with a line that says you wrote a Chromium WebKit API unit test.
> Source/WebCore/ChangeLog:9 > +
It would be nice to put some more explanation in the ChangeLog as to why we're making this change and whether we think this registry is useful for WebCore's JavaScript URL implementation.
> Source/WebCore/platform/SchemeRegistry.cpp:107 > +static URLSchemesMap& notAllowingJavascriptURLsSchemes()
This name seems slightly tortured, but I can see how it fits the pattern.
Adam Barth
Comment 14
2011-08-24 10:06:32 PDT
> would ScriptController::executeIfJavaScriptURL affect <a href="javascript:"> cases, or only navigation from the browser itself? Current patch only applies this test as before.
Only the <a href="javascript:"> case. I think it's fine to handle that case in a separate patch, but we should say that in the ChangeLog entry.
Adam Barth
Comment 15
2011-08-24 10:06:59 PDT
+fishd for WebKit API review.
Thomas Sepez
Comment 16
2011-08-24 10:22:08 PDT
Created
attachment 105013
[details]
Patch
Thomas Sepez
Comment 17
2011-08-24 10:23:01 PDT
Reworked comments in change log in latest patch.
WebKit Review Bot
Comment 18
2011-08-24 11:09:12 PDT
Comment on
attachment 105013
[details]
Patch Rejecting
attachment 105013
[details]
from commit-queue. Failed to run "['./Tools/Scripts/webkit-patch', '--status-host=queues.webkit.org', '--bot-id=ec2-cq-03', '--port..." exit_code: 2 Last 500 characters of output: at 63 (offset 3 lines). Hunk #4 succeeded at 98 (offset 3 lines). Hunk #5 succeeded at 119 (offset 3 lines). Hunk #6 succeeded at 145 (offset 3 lines). Hunk #7 succeeded at 191 with fuzz 1 (offset 24 lines). 1 out of 7 hunks FAILED -- saving rejects to file Source/WebKit/chromium/tests/WebFrameTest.cpp.rej patching file Source/WebKit/chromium/tests/data/history.html Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', u'--reviewer', u'Darin Fisher', u'--for..." exit_code: 1 Full output:
http://queues.webkit.org/results/9485272
Thomas Sepez
Comment 19
2011-08-24 11:55:09 PDT
Created
attachment 105033
[details]
Patch
Thomas Sepez
Comment 20
2011-08-24 11:56:10 PDT
Comment on
attachment 105033
[details]
Patch Merge conflict resolved.
Adam Barth
Comment 21
2011-08-24 13:52:49 PDT
Comment on
attachment 105033
[details]
Patch Forwarding fishd's r+.
WebKit Review Bot
Comment 22
2011-08-24 14:06:57 PDT
Comment on
attachment 105033
[details]
Patch Clearing flags on attachment: 105033 Committed
r93734
: <
http://trac.webkit.org/changeset/93734
>
WebKit Review Bot
Comment 23
2011-08-24 14:07:02 PDT
All reviewed patches have been landed. Closing bug.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug