From dd9ad679f220bb53aaf17a88b6a106db3a797f69 Mon Sep 17 00:00:00 2001 From: Johnny Tordgeman Date: Wed, 3 Jul 2019 17:47:45 +0300 Subject: [PATCH 1/3] CustomBlockURL redirect fix --- PerimeterXModule/PxModule.cs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/PerimeterXModule/PxModule.cs b/PerimeterXModule/PxModule.cs index 0b7da60..7033071 100644 --- a/PerimeterXModule/PxModule.cs +++ b/PerimeterXModule/PxModule.cs @@ -68,6 +68,7 @@ public class PxModule : IHttpModule private readonly StringCollection useragentsWhitelist; private readonly StringCollection enforceSpecificRoutes; private readonly string cookieKey; + private readonly string customBlockUrl; private readonly byte[] cookieKeyBytes; private readonly string osVersion; private string nodeName; @@ -219,7 +220,7 @@ private void Application_BeginRequest(object source, EventArgs e) BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.IgnoreCase | BindingFlags.FlattenHierarchy); // Remove the ReadOnly property ro.SetValue(headers, false, null); - // Invoke the protected InvalidateCachedArrays method + // Invoke the protected InvalidateCachedArrays method hdr.InvokeMember("InvalidateCachedArrays", BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance, null, headers, null); @@ -442,13 +443,22 @@ private bool IsFilteredRequest(HttpContext context) return true; } - // whitelist routes prefix var url = context.Request.Url.AbsolutePath; + + // customblockUrl check + if (customBlockUrl != null) + { + if (url == customBlockUrl) { + return true; + } + } + + // whitelist routes prefix if (routesWhitelist != null) { foreach (var prefix in routesWhitelist) { - if (url.StartsWith(prefix) || url == pxContext.CustomBlockUrl) + if (url.StartsWith(prefix)) { return true; } @@ -539,7 +549,7 @@ private void HandleVerification(HttpApplication application) PxLoggingUtils.LogDebug(string.Format("Invalid request to {0}", application.Context.Request.RawUrl)); PostBlockActivity(pxContext); } - + SetPxhdAndVid(pxContext); // If implemented, run the customVerificationHandler. if (customVerificationHandlerInstance != null) @@ -565,7 +575,7 @@ private static void SetPxhdAndVid(PxContext pxContext) } /// - /// Uses reflection to check whether an IVerificationHandler was implemented by the customer. + /// Uses reflection to check whether an IVerificationHandler was implemented by the customer. /// /// If found, returns the IVerificationHandler class instance. Otherwise, returns null. private static IVerificationHandler GetCustomVerificationHandler(string customHandlerName) From a95fa8796bc24860537e523107e4c4ae732648c6 Mon Sep 17 00:00:00 2001 From: Barak Amar Date: Wed, 3 Jul 2019 18:00:13 +0300 Subject: [PATCH 2/3] Update PxModule.cs --- PerimeterXModule/PxModule.cs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/PerimeterXModule/PxModule.cs b/PerimeterXModule/PxModule.cs index 7033071..d5604ff 100644 --- a/PerimeterXModule/PxModule.cs +++ b/PerimeterXModule/PxModule.cs @@ -445,12 +445,9 @@ private bool IsFilteredRequest(HttpContext context) var url = context.Request.Url.AbsolutePath; - // customblockUrl check - if (customBlockUrl != null) - { - if (url == customBlockUrl) { - return true; - } + // custom block url check + if (customBlockUrl != null && url == customBlockUrl) { + return true; } // whitelist routes prefix From 10518648bb1474a26c9e59fbb69384f69e8c8242 Mon Sep 17 00:00:00 2001 From: Johnny Tordgeman Date: Wed, 3 Jul 2019 18:31:31 +0300 Subject: [PATCH 3/3] Version 3.1.1 --- CHANGELOG.md | 5 +++++ PerimeterXModule/Properties/AssemblyInfo.cs | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cec0a9f..8c75e6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) +## [3.1.1] - 2019-07-03 +### Fixed +- customBlockUrl redirect flow +- customBlockUrl whitelisting + ## [3.1.0] - 2019-06-05 ### Added - Send telemetry on demand by header diff --git a/PerimeterXModule/Properties/AssemblyInfo.cs b/PerimeterXModule/Properties/AssemblyInfo.cs index 7c01819..05a4303 100644 --- a/PerimeterXModule/Properties/AssemblyInfo.cs +++ b/PerimeterXModule/Properties/AssemblyInfo.cs @@ -23,5 +23,5 @@ // You can specify all the values or you can default the Build and Revision Numbers // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("3.1.0")] -[assembly: AssemblyFileVersion("3.1.0")] +[assembly: AssemblyVersion("3.1.1")] +[assembly: AssemblyFileVersion("3.1.1")]