Skip to content

Commit

Permalink
Merge pull request #111 from gnosisguild/prevent-injected-override
Browse files Browse the repository at this point in the history
prevent other extensions from overriding the injected provider
  • Loading branch information
jfschwarz authored Jun 4, 2024
2 parents aadb408 + 1bac96f commit 27a2b77
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion extension/src/injection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,18 @@ if (window.ethereum) {

// inject bridged ethereum provider
const injectedProvider = new InjectedProvider()
window.ethereum = injectedProvider
Object.defineProperties(window, {
ethereum: {
get() {
return injectedProvider
},
set() {
// do nothing
},
configurable: false,
},
})

console.log('injected into', document.title)

// establish message bridge for location requests
Expand Down

0 comments on commit 27a2b77

Please sign in to comment.