Skip to content

Commit

Permalink
Merge pull request #73 from PerimeterX/dev
Browse files Browse the repository at this point in the history
Version 3.1.1
  • Loading branch information
Johnny Tordgeman authored Jul 3, 2019
2 parents c9231e7 + 1051864 commit 6d91179
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions PerimeterXModule/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
17 changes: 12 additions & 5 deletions PerimeterXModule/PxModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -442,13 +443,19 @@ private bool IsFilteredRequest(HttpContext context)
return true;
}

// whitelist routes prefix
var url = context.Request.Url.AbsolutePath;

// custom block url check
if (customBlockUrl != null && 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;
}
Expand Down Expand Up @@ -539,7 +546,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)
Expand All @@ -565,7 +572,7 @@ private static void SetPxhdAndVid(PxContext pxContext)
}

/// <summary>
/// Uses reflection to check whether an IVerificationHandler was implemented by the customer.
/// Uses reflection to check whether an IVerificationHandler was implemented by the customer.
/// </summary>
/// <returns>If found, returns the IVerificationHandler class instance. Otherwise, returns null.</returns>
private static IVerificationHandler GetCustomVerificationHandler(string customHandlerName)
Expand Down

0 comments on commit 6d91179

Please sign in to comment.