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

Issue 2924683002: [Extensions Bindings] Avoid passing the event filter to JS (Closed)

Created:
3 years, 6 months ago by Devlin
Modified:
3 years, 6 months ago
Reviewers:
lazyboy, jbroman
CC:
chromium-apps-reviews_chromium.org, chromium-reviews, extensions-reviews_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

[Extensions Bindings] Avoid passing the event filter to JS Currently, in JS bindings, we pass the event filter to JS, and then pass it back to C++ to find matching event listeners. This can cause problems because the object could be tweaked by monkey-patching, and we aren't correctly checking. Instead of updating the checks to safely interact with the object, just avoid passing it to JS altogether. Instead, pass the ids of the relevant listeners directly to JS. This avoids the security issue and is also more performant. Add a regression test. BUG=702946 Review-Url: https://codereview.chromium.org/2924683002 Cr-Commit-Position: refs/heads/master@{#478742} Committed: https://chromium.googlesource.com/chromium/src/+/229f3b010af25c9bc38c01cfc7c403d8b5fdecf0

Patch Set 1 : rebase #

Patch Set 2 : remove extra '.' #

Total comments: 10

Patch Set 3 : lazyboy's + jbroman's #

Patch Set 4 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+109 lines, -106 lines) Patch
M chrome/browser/extensions/extension_bindings_apitest.cc View 9 chunks +17 lines, -9 lines 0 comments Download
A chrome/test/data/extensions/api_test/bindings/event_filter/background.js View 1 2 1 chunk +13 lines, -0 lines 0 comments Download
A chrome/test/data/extensions/api_test/bindings/event_filter/manifest.json View 1 chunk +8 lines, -0 lines 0 comments Download
M extensions/renderer/event_bindings.h View 1 2 3 3 chunks +9 lines, -2 lines 0 comments Download
M extensions/renderer/event_bindings.cc View 1 2 3 7 chunks +56 lines, -66 lines 0 comments Download
M extensions/renderer/js_extension_bindings_system.cc View 1 2 3 2 chunks +2 lines, -22 lines 0 comments Download
M extensions/renderer/resources/event.js View 1 2 3 1 chunk +4 lines, -7 lines 0 comments Download

Messages

Total messages: 42 (35 generated)
Devlin
Mind taking a look? Not strictly related to native bindings (and in fact automatically fixed ...
3 years, 6 months ago (2017-06-09 20:32:40 UTC) #23
lazyboy
lgtm once jbroman@'s happy. https://codereview.chromium.org/2924683002/diff/100001/chrome/test/data/extensions/api_test/bindings/event_filter/background.js File chrome/test/data/extensions/api_test/bindings/event_filter/background.js (right): https://codereview.chromium.org/2924683002/diff/100001/chrome/test/data/extensions/api_test/bindings/event_filter/background.js#newcode5 chrome/test/data/extensions/api_test/bindings/event_filter/background.js:5: Object.defineProperty(Object.prototype, 'windowExposedByDefault', nit: put a ...
3 years, 6 months ago (2017-06-10 00:22:09 UTC) #26
jbroman
lgtm https://codereview.chromium.org/2924683002/diff/100001/extensions/renderer/event_bindings.cc File extensions/renderer/event_bindings.cc (right): https://codereview.chromium.org/2924683002/diff/100001/extensions/renderer/event_bindings.cc#newcode130 extensions/renderer/event_bindings.cc:130: EventFilter& event_filter = g_event_filter.Get(); nit: const&? (use of ...
3 years, 6 months ago (2017-06-12 15:48:51 UTC) #27
Devlin
https://codereview.chromium.org/2924683002/diff/100001/chrome/test/data/extensions/api_test/bindings/event_filter/background.js File chrome/test/data/extensions/api_test/bindings/event_filter/background.js (right): https://codereview.chromium.org/2924683002/diff/100001/chrome/test/data/extensions/api_test/bindings/event_filter/background.js#newcode5 chrome/test/data/extensions/api_test/bindings/event_filter/background.js:5: Object.defineProperty(Object.prototype, 'windowExposedByDefault', On 2017/06/10 00:22:08, lazyboy wrote: > nit: ...
3 years, 6 months ago (2017-06-12 17:01:54 UTC) #32
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/2924683002/140001
3 years, 6 months ago (2017-06-12 20:23:23 UTC) #38
commit-bot: I haz the power
Committed patchset #4 (id:140001) as https://chromium.googlesource.com/chromium/src/+/229f3b010af25c9bc38c01cfc7c403d8b5fdecf0
3 years, 6 months ago (2017-06-12 20:29:28 UTC) #41
Devlin
3 years, 6 months ago (2017-06-13 00:11:41 UTC) #42
Message was sent while issue was closed.
A revert of this CL (patchset #4 id:140001) has been created in
https://codereview.chromium.org/2936673004/ by rdevlin.cronin@chromium.org.

The reason for reverting is: New test seems to be flaky on Mac...

https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Fchromium.mac%2FMac10.9_T....

Powered by Google App Engine
This is Rietveld 408576698