Commit 32e6f432 authored by Lukasz Anforowicz's avatar Lukasz Anforowicz Committed by Commit Bot

Use MessageSender.origin to check if message came from first-run-dialog.

When an extension message is received, we check `MessageSender.id` to
disallow requests from unknown clients.  Unfortunately,
`MessageSender.id` is currently not trustworthy (issue 982361) and
therefore this CL switches to using `MessageSender.origin` instead.

Bug: 10321587
Change-Id: I3cc65cb4105cfc8caf0f98f5cd42cec5dacca4a3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2035864Reviewed-by: default avatarDavid Tseng <dtseng@chromium.org>
Commit-Queue: Łukasz Anforowicz <lukasza@chromium.org>
Cr-Commit-Position: refs/heads/master@{#738206}
parent 39804b20
...@@ -1353,10 +1353,10 @@ CommandHandler.onEditCommand_ = function(command) { ...@@ -1353,10 +1353,10 @@ CommandHandler.onEditCommand_ = function(command) {
*/ */
CommandHandler.init = function() { CommandHandler.init = function() {
ChromeVoxKbHandler.commandHandler = CommandHandler.onCommand; ChromeVoxKbHandler.commandHandler = CommandHandler.onCommand;
const firstRunId = 'jdgcneonijmofocbhmijhacgchbihela'; const firstRunOrigin = 'chrome-extension://jdgcneonijmofocbhmijhacgchbihela';
chrome.runtime.onMessageExternal.addListener(function( chrome.runtime.onMessageExternal.addListener(function(
request, sender, sendResponse) { request, sender, sendResponse) {
if (sender.id != firstRunId) { if (sender.origin != firstRunOrigin) {
return; return;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment