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

Issue 2713413002: Blink bindings: use v8 to enforce method call access checks (Closed)

Created:
3 years, 9 months ago by dcheng
Modified:
3 years, 9 months ago
Reviewers:
haraken, Yuki
CC:
chromium-reviews, blink-reviews, kinuko+watch, blink-reviews-bindings_chromium.org, yhirano
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Blink bindings: use v8 to enforce method call access checks Current, method calls on cross-origin interfaces perform manual access checks in the generated bindings. However, v8 also has the capability to perform the access check itself if the function template specifies SetAcceptsAnyReceiver(false). Using SetAcceptsAnyReceiver(false) has several advantages: - Removes the need for the EventTarget performance hack, since the fast path for same context access is simply a pointer comparison. - Removes the need for the complicated binding template logic to handle DOMWindow/LocalDOMWindow. - Enforces access checks more consistently throughout the bindings - Reduces the amount of generated bindings code - Makes the access check failure more consistent for a detached window: when a frame is removed from the DOM, v8 allows the access, while the custom Blink method call access check denies it. This was a behavior difference between accessors and methods, and now behaves the same for both. Note that there are still some differences, which will be resolved by a followup patch to base access checks off DOMWindow instead of Frame. The main disadvantage is that the thrown security error is less precise: however, this is already a problem for every other cross-origin access. The right solution is to resolve the longstanding TODO to plumb through object/property information from v8 in the failed access check callback. BUG=none Review-Url: https://codereview.chromium.org/2713413002 Cr-Commit-Position: refs/heads/master@{#453397} Committed: https://chromium.googlesource.com/chromium/src/+/4bf51e553baa31ca6b1ab7e45f8dffc9ca114641

Patch Set 1 #

Patch Set 2 : . #

Patch Set 3 : rebase #

Patch Set 4 : . #

Total comments: 11

Patch Set 5 : comment #

Patch Set 6 : rebase #

Patch Set 7 : Restore comment #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+506 lines, -510 lines) Patch
M third_party/WebKit/LayoutTests/http/tests/fetch/chromium/discarded-window.html View 1 2 3 1 chunk +20 lines, -12 lines 1 comment Download
M third_party/WebKit/LayoutTests/http/tests/security/aboutBlank/xss-DENIED-set-opener-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-call.html View 1 1 chunk +27 lines, -27 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-call-expected.txt View 1 1 chunk +27 lines, -28 lines 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/cross-frame-access-dispatchEvent-expected.txt View 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/LayoutTests/http/tests/security/promise-realm.html View 1 2 3 1 chunk +2 lines, -7 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.h View 5 chunks +36 lines, -18 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp View 1 2 3 4 2 chunks +7 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl View 1 2 3 4 5 6 2 chunks +5 lines, -33 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackFunctions.cpp View 1 1 chunk +8 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestException.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexed.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexedGlobal.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexedPrimaryGlobal.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp View 1 5 chunks +51 lines, -51 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface2.cpp View 1 2 chunks +15 lines, -15 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface3.cpp View 1 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCheckSecurity.cpp View 1 2 chunks +1 line, -6 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp View 1 2 chunks +10 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp View 1 1 chunk +3 lines, -3 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceOriginTrialEnabled.cpp View 1 1 chunk +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceSecureContext.cpp View 1 2 chunks +6 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp View 1 3 4 5 3 chunks +238 lines, -238 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperations.cpp View 1 1 chunk +1 line, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.cpp View 1 1 chunk +8 lines, -8 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface2Partial.cpp View 1 2 chunks +2 lines, -2 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp View 1 2 chunks +16 lines, -16 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp View 1 2 chunks +4 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/core/frame/DOMWindowTimers.cpp View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/modules/fetch/GlobalFetch.cpp View 1 2 3 1 chunk +4 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/tests/WebFrameTest.cpp View 1 2 3 4 5 1 chunk +2 lines, -3 lines 0 comments Download

Messages

Total messages: 30 (22 generated)
dcheng
https://codereview.chromium.org/2713413002/diff/60001/third_party/WebKit/LayoutTests/http/tests/fetch/chromium/discarded-window.html File third_party/WebKit/LayoutTests/http/tests/fetch/chromium/discarded-window.html (right): https://codereview.chromium.org/2713413002/diff/60001/third_party/WebKit/LayoutTests/http/tests/fetch/chromium/discarded-window.html#newcode23 third_party/WebKit/LayoutTests/http/tests/fetch/chromium/discarded-window.html:23: assert_equals(e.message, "Failed to execute 'fetch' on 'Window': The global ...
3 years, 9 months ago (2017-02-27 05:34:19 UTC) #13
haraken
LGTM. https://codereview.chromium.org/2713413002/diff/60001/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp File third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp (right): https://codereview.chromium.org/2713413002/diff/60001/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp#newcode370 third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp:370: // TODO(dcheng): Does this need an access check? ...
3 years, 9 months ago (2017-02-27 05:49:25 UTC) #14
dcheng
https://codereview.chromium.org/2713413002/diff/60001/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp File third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp (right): https://codereview.chromium.org/2713413002/diff/60001/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp#newcode370 third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp:370: // TODO(dcheng): Does this need an access check? On ...
3 years, 9 months ago (2017-02-27 07:52:26 UTC) #18
haraken
On 2017/02/27 07:52:26, dcheng wrote: > https://codereview.chromium.org/2713413002/diff/60001/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp > File third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp (right): > > https://codereview.chromium.org/2713413002/diff/60001/third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp#newcode370 > ...
3 years, 9 months ago (2017-02-27 07:53:57 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2713413002/120001
3 years, 9 months ago (2017-02-27 22:09:05 UTC) #25
commit-bot: I haz the power
Committed patchset #7 (id:120001) as https://chromium.googlesource.com/chromium/src/+/4bf51e553baa31ca6b1ab7e45f8dffc9ca114641
3 years, 9 months ago (2017-02-27 23:53:14 UTC) #28
Yuki
LGTM. https://codereview.chromium.org/2713413002/diff/120001/third_party/WebKit/LayoutTests/http/tests/fetch/chromium/discarded-window.html File third_party/WebKit/LayoutTests/http/tests/fetch/chromium/discarded-window.html (right): https://codereview.chromium.org/2713413002/diff/120001/third_party/WebKit/LayoutTests/http/tests/fetch/chromium/discarded-window.html#newcode19 third_party/WebKit/LayoutTests/http/tests/fetch/chromium/discarded-window.html:19: assert_true(false, "This Promise must always be rejected."); nit: ...
3 years, 9 months ago (2017-03-01 08:36:17 UTC) #29
Yuki
3 years, 9 months ago (2017-03-01 08:40:11 UTC) #30
Message was sent while issue was closed.
https://codereview.chromium.org/2713413002/diff/60001/third_party/WebKit/Sour...
File third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp (right):

https://codereview.chromium.org/2713413002/diff/60001/third_party/WebKit/Sour...
third_party/WebKit/Source/bindings/core/v8/V8DOMConfiguration.cpp:370: //
TODO(dcheng): Does this need an access check?
On 2017/02/27 07:52:26, dcheng wrote:
> On 2017/02/27 05:49:25, haraken wrote:
> > On 2017/02/27 05:34:19, dcheng wrote:
> > > I don't think it does, since I think this implies a static method?
> > 
> > Agreed. We won't need the access check. I'm okay with adding the check just
in
> > case though.
> > 
> 
> Hmm... it's not possible to do an access check in that case though, since
there
> is no |impl|. I will just remove the TODO and write a comment why an access
> check is not necessary in this case.

Just FYI, the spec doesn't require any access check here because the property is
a data property.  There is no way to perform a security check when just getting
a data property.

Powered by Google App Engine
This is Rietveld 408576698