From 5fa67b9148d02b29f5731db1d729a79b7675f43b Mon Sep 17 00:00:00 2001 From: dasmodem Date: Tue, 27 Aug 2013 21:05:55 -0400 Subject: [PATCH] Added checks to cross-domain-policy-audit.js to avoid NPE due to responseChecks being called before there are responses to process. --- .../modules/injection/cross-domain-policy-audit.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/scanner/modules/injection/cross-domain-policy-audit.js b/scripts/scanner/modules/injection/cross-domain-policy-audit.js index 7c51db72..a06b7088 100644 --- a/scripts/scanner/modules/injection/cross-domain-policy-audit.js +++ b/scripts/scanner/modules/injection/cross-domain-policy-audit.js @@ -11,7 +11,17 @@ function initialize(ctx) { } function process(req, res, ctx) { - ctx.responseChecks(req, res); + if (ctx.hasModuleFailed()) return; + + if (res.fetchFail) { + ctx.error(req, res, "During cross-domain policy auditor checks"); + ctx.setModuleFailed(); + return; + } + + if (ctx.allResponsesReceived()) { + ctx.responseChecks(req, res); + } }