mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
Prevent XML from web3 injections.
This commit is contained in:
parent
8d5b2478e3
commit
8a5eacd35f
@ -69,6 +69,18 @@ function setupStreams(){
|
||||
}
|
||||
|
||||
function shouldInjectWeb3(){
|
||||
var shouldInject = (window.location.href.indexOf('.pdf') === -1)
|
||||
return shouldInject
|
||||
return isAllowedSuffix(window.location.href)
|
||||
}
|
||||
|
||||
function isAllowedSuffix(testCase) {
|
||||
var prohibitedTypes = ['xml','pdf']
|
||||
var currentUrl = window.location.href
|
||||
var currentRegex
|
||||
for (let i = 0; i < prohibitedTypes.length; i++) {
|
||||
currentRegex = new RegExp(`\.${prohibitedTypes[i]}$`)
|
||||
if (currentRegex.test(currentUrl)) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user