[Pkg-mozext-commits] [requestpolicy] 212/280: Block all requests with unknown schemes (see #447)
David Prévot
taffit at moszumanska.debian.org
Sat May 2 20:30:29 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository requestpolicy.
commit 36b310c21d895cf15702bba5b994163e4711b5e5
Author: Martin Kimmerle <dev at 256k.de>
Date: Tue Feb 10 02:47:23 2015 +0100
Block all requests with unknown schemes (see #447)
---
src/content/lib/request-processor.jsm | 6 ++++--
src/content/lib/request.jsm | 4 +++-
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/content/lib/request-processor.jsm b/src/content/lib/request-processor.jsm
index c01bd1d..01a7d37 100644
--- a/src/content/lib/request-processor.jsm
+++ b/src/content/lib/request-processor.jsm
@@ -584,8 +584,10 @@ let RequestProcessor = (function(self) {
}
- if (request.checkURISchemes().shouldLoad === true) {
- return CP_OK;
+
+ let uriSchemeShouldLoadResult = request.checkURISchemes().shouldLoad;
+ if (uriSchemeShouldLoadResult !== null) {
+ return uriSchemeShouldLoadResult === true ? CP_OK : CP_REJECT;
}
diff --git a/src/content/lib/request.jsm b/src/content/lib/request.jsm
index a6b6185..b5929c6 100644
--- a/src/content/lib/request.jsm
+++ b/src/content/lib/request.jsm
@@ -297,6 +297,7 @@ NormalRequest.prototype.checkURISchemes = function() {
*
* TODO: solve this problem and remove this workaround.
*/
+ let unknownSchemesDetected = false;
let uris = [this.aContentLocation, this.aRequestOrigin];
for (let i = 0; i < 2; ++i) {
let uri = uris[i];
@@ -335,6 +336,7 @@ NormalRequest.prototype.checkURISchemes = function() {
}
// if we get here, the scheme is unknown. try to show a notification.
+ unknownSchemesDetected = true;
Logger.warning(Logger.TYPE_CONTENT,
"uncatched scheme '" + scheme + "'. The request is from <" +
this.originURI + "> to <" + this.destURI + "> ");
@@ -354,7 +356,7 @@ NormalRequest.prototype.checkURISchemes = function() {
}
}
- return {shouldLoad: null};
+ return {shouldLoad: unknownSchemesDetected ? false : null};
};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/requestpolicy.git
More information about the Pkg-mozext-commits
mailing list