Closed
Bug 1286712
Opened 8 years ago
Closed 8 years ago
Some content script API parameters are not validated (runtime, i18n)
Categories
(WebExtensions :: Untriaged, defect, P3)
WebExtensions
Untriaged
Tracking
(firefox50 affected, firefox51 verified)
VERIFIED
FIXED
People
(Reporter: robwu, Assigned: robwu)
References
Details
(Whiteboard: triaged)
Attachments
(3 files)
1. Load the attached extension.
2. Visit example.com (the content script calls several APIs with an invalid method signature).
3. Open the console of the tab and look at the printed messages.
Expected:
OK: Got expected error: Error: Incorrect argument types for storage.StorageArea.get.
OK: Got expected error: Error: Incorrect argument types for runtime.connect.
OK: Got expected error: Error: Incorrect argument types for runtime.sendMessage.
OK: Got expected error: Error: Incorrect argument types for i18n.
Actual:
OK: Got expected error: Error: Incorrect argument types for storage.StorageArea.get.
FAIL: Expected a parameter validation error for runtime.connect API
FAIL: Expected a parameter validation error for runtime.sendMessage API
FAIL: Expected a parameter validation error for i18n API
Note: The background page seems to not validate chrome.runtime.sendMessage's parameters. When I run the content script as a background script, the background console contains:
OK: Got expected error: Error: Incorrect argument types for storage.StorageArea.get.
OK: Got expected error: Error: Incorrect argument types for runtime.connect.
FAIL: Expected a parameter validation error for runtime.sendMessage API
OK: Got expected error: Error: Incorrect argument types for i18n.
Extra info:
There is a unit test for validating the params of runtime.connect in background pages, this test can be re-used for content scripts when you fix the bug.
toolkit/components/extensions/test/mochitest/test_ext_background_runtime_connect_params.html
Updated•8 years ago
|
Priority: -- → P3
Whiteboard: triaged
Assignee | ||
Comment 1•8 years ago
|
||
The validation issues for connect and i18n will be resolved by bug 1287007.
Schema-based parameter validation is disabled for runtime.sendMessage due to the allowAmbiguousOptionalArguments flag, so that has to be addressed separately.
Depends on: 1287007
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Updated•8 years ago
|
Attachment #8782268 -
Flags: review?(wmccloskey)
Attachment #8782269 -
Flags: review?(wmccloskey)
Assignee | ||
Comment 4•8 years ago
|
||
Comment 5•8 years ago
|
||
mozreview-review |
Comment on attachment 8782268 [details]
Bug 1286712 - Validate runtime.sendMessage parameters
https://reviewboard.mozilla.org/r/72464/#review70468
::: toolkit/components/extensions/test/xpcshell/test_ext_runtime_sendMessage_errors.js:9
(Diff revision 1)
> +
> +add_task(function* test_sendMessage_error() {
> + function background() {
> + let circ = {};
> + circ.circ = circ;
> + let testCases = [
Can you do some tests passing in undefined?
Attachment #8782268 -
Flags: review?(wmccloskey) → review+
Comment 6•8 years ago
|
||
mozreview-review |
Comment on attachment 8782269 [details]
Bug 1286712 - Remove unused ExtensionContext and GlobalManager globals
https://reviewboard.mozilla.org/r/72466/#review70474
Attachment #8782269 -
Flags: review?(wmccloskey) → review+
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Updated•8 years ago
|
Keywords: checkin-needed,
leave-open
Assignee | ||
Updated•8 years ago
|
Assignee: nobody → rob
Status: NEW → ASSIGNED
Comment hidden (mozreview-request) |
Comment hidden (mozreview-request) |
Assignee | ||
Comment 12•8 years ago
|
||
Updated commit description as requested.
Also updated dependency - with the fixes for bug 1287010, this bug would be fixed as well.
Keywords: checkin-needed
Comment 13•8 years ago
|
||
Pushed by ryanvm@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/99d6e016dcef
Validate runtime.sendMessage parameters r=billm
https://hg.mozilla.org/integration/autoland/rev/7ad45b51d189
Remove unused ExtensionContext and GlobalManager globals r=billm
Keywords: checkin-needed
Comment 14•8 years ago
|
||
bugherder |
Assignee | ||
Comment 15•8 years ago
|
||
Verified fixed in Firefox 51.0a1 (2016-08-25) using the manual test from the report.
The test case still shows "FAIL: Expected a parameter validation error for runtime.sendMessage API", but that's because it only tests for synchronously thrown errors. The global console shows "Error: runtime.sendMessage received too many arguments", which is what I'd expect.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Comment 16•8 years ago
|
||
I’ve also confirm that the expected results mentioned in Comment 15 are encountered in Firefox 51.0a1 (2016-09-12) under Windows 10 64-bit.
Status: RESOLVED → VERIFIED
status-firefox51:
--- → verified
Updated•7 years ago
|
Keywords: leave-open
Updated•6 years ago
|
Product: Toolkit → WebExtensions
You need to log in
before you can comment on or make changes to this bug.
Description
•