Prevent XML from web3 injections.

feature/default_network_editable
Kevin Serrano 8 years ago
parent 8d5b2478e3
commit 8a5eacd35f
No known key found for this signature in database
GPG Key ID: 7CC862A58D2889B4
  1. 16
      app/scripts/contentscript.js

@ -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…
Cancel
Save