diff --git a/core/interceptor.js b/core/interceptor.js index 78cb9aedde064060516264e197d23ec74ed16432..57ce92afef9f200343eb3595c07a34af20b3b0bc 100644 --- a/core/interceptor.js +++ b/core/interceptor.js @@ -31,7 +31,7 @@ const HTTP_EXPRESSION = /^http?:\/\//; interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) { - let validCandidate, targetDetails, targetPath; + let validCandidate, tabDomain, targetDetails, targetPath; validCandidate = requestAnalyzer.isValidCandidate(requestDetails, tab); @@ -42,6 +42,31 @@ interceptor.handleRequest = function (requestDetails, tabIdentifier, tab) { }; } + try { + tabDomain = tab.url.match(WEB_DOMAIN_EXPRESSION)[1]; + tabDomain = requestAnalyzer._normalizeDomain(tabDomain); + } catch (exception) { + tabDomain = 'example.org'; + } + + // Temporary list of undetectable tainted domains. + let undetectableTaintedDomains = { + 'cdnjs.com': true, + 'dropbox.com': true, + 'minigames.mail.ru': true, + 'report-uri.io': true, + 'securityheaders.io': true, + 'stefansundin.github.io': true, + 'udacity.com': true + }; + + if (undetectableTaintedDomains[tabDomain] || /yandex\./.test(tabDomain)) { + + if (tabDomain !== 'yandex.ru') { + return interceptor._handleMissingCandidate(requestDetails.url); + } + } + targetDetails = requestAnalyzer.getLocalTarget(requestDetails); targetPath = targetDetails.path;