1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Prevent manually connecting to extension UI (#8893)

The `activeTab.id` property is relied upon in the connected sites modal
to prevent the user from manually connecting to the MetaMask extension
itself. Unfortunately the `id` property was never set.

`id` is now set on the `activeTab` state, so manually connecting to the
extension UI is now impossible.
This commit is contained in:
Mark Stacey 2020-07-02 18:26:45 -03:00 committed by GitHub
parent d9a27fcf52
commit b25f4bbe4a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -83,7 +83,7 @@ async function queryCurrentActiveTab (windowType) {
extension.tabs.query({ active: true, currentWindow: true }, (tabs) => { extension.tabs.query({ active: true, currentWindow: true }, (tabs) => {
const [activeTab] = tabs const [activeTab] = tabs
const { title, url } = activeTab const { id, title, url } = activeTab
const { origin, protocol } = url ? new URL(url) : {} const { origin, protocol } = url ? new URL(url) : {}
if (!origin || origin === 'null') { if (!origin || origin === 'null') {
@ -91,7 +91,7 @@ async function queryCurrentActiveTab (windowType) {
return return
} }
resolve({ title, origin, protocol, url }) resolve({ id, title, origin, protocol, url })
}) })
}) })
} }