Skip to content

Commit

Permalink
Merge pull request #96 from PerimeterX/release/v3.2.1
Browse files Browse the repository at this point in the history
Release/v3.2.1 to master
  • Loading branch information
chen-zimmer-px authored Jul 17, 2023
2 parents 0a95486 + 31deab1 commit 6c48651
Show file tree
Hide file tree
Showing 8 changed files with 24 additions and 21 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.2.1] - 2023-08-17
### Fixed
- Fixed advanced blocking response feature


## [3.2.0] - 2023-01-03
### Added
- Support for credentials intelligence protocols `v2` and `multistep_sso`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ private ExtractedCredentials HandleExtractCredentials(ExtractorObject extraction
return null;
}

Dictionary<string, string> headers = pxContext.GetLowercaseHeadersAsDictionary();
Dictionary<string, string> headers = pxContext.lowercaseHttpHeaders;

if (extractionDetails.SentThrough == "header")
{
Expand Down
14 changes: 11 additions & 3 deletions PerimeterXModule/Internals/PxBlock.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,17 @@ public PxBlock(PxModuleConfigurationSection config)

public bool IsJsonResponse(PxContext pxContext)
{
Dictionary<string, string> headers = pxContext.GetHeadersAsDictionary();
string jsonHeader;
bool jsonHeaderExists = headers.TryGetValue("accept", out jsonHeader) || headers.TryGetValue("content-type", out jsonHeader);
Dictionary<string, string> headers = pxContext.lowercaseHttpHeaders;
string acceptHeader;
string contentTypeHeader;
bool jsonHeaderExistsInAccept = headers.TryGetValue("accept", out acceptHeader);
bool jsonHeaderExistsInContentType = headers.TryGetValue("content-type", out contentTypeHeader);
return DoesJsonExists(acceptHeader, jsonHeaderExistsInAccept) || DoesJsonExists(contentTypeHeader, jsonHeaderExistsInContentType);

}

private static bool DoesJsonExists(string jsonHeader, bool jsonHeaderExists)
{
if (jsonHeaderExists)
{
string[] values = jsonHeader.Split(',');
Expand Down
14 changes: 2 additions & 12 deletions PerimeterXModule/Internals/PxContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class PxContext
public bool MonitorRequest { get; set; }
public LoginCredentialsFields LoginCredentialsFields { get; set; }
public string RequestId { get; set; }
public Dictionary<string,string> lowercaseHttpHeaders;

public PxContext(HttpContext context, PxModuleConfigurationSection pxConfiguration)
{
Expand Down Expand Up @@ -194,6 +195,7 @@ public PxContext(HttpContext context, PxModuleConfigurationSection pxConfigurati
RedirectOnCustomUrl = pxConfiguration.RedirectOnCustomUrl;

MonitorRequest = shouldMonitorRequest(context, pxConfiguration);
lowercaseHttpHeaders = GetLowercaseHeadersAsDictionary();
}

private bool shouldMonitorRequest(HttpContext context, PxModuleConfigurationSection pxConfiguration)
Expand Down Expand Up @@ -275,18 +277,6 @@ public string GetPxCookie()
return PxCookies.ContainsKey(PxConstants.COOKIE_V3_PREFIX) ? PxCookies[PxConstants.COOKIE_V3_PREFIX] : PxCookies[PxConstants.COOKIE_V1_PREFIX];
}

public Dictionary<string, string> GetHeadersAsDictionary()
{
Dictionary<string, string> headersDictionary = new Dictionary<string, string>();

if (Headers != null && Headers.Count() > 0)
{
headersDictionary = Headers.ToDictionary(header => header.Name, header => header.Value);
}

return headersDictionary;
}

public Dictionary<string, string> GetLowercaseHeadersAsDictionary()
{
Dictionary<string, string> headersDictionary = new Dictionary<string, string>();
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.2.0")]
[assembly: AssemblyFileVersion("3.2.0")]
[assembly: AssemblyVersion("3.2.1")]
[assembly: AssemblyFileVersion("3.2.1")]
2 changes: 1 addition & 1 deletion PerimeterXModule/PxModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -473,7 +473,7 @@ private void PostActivity(PxContext pxContext, string eventType, ActivityDetails
SocketIP = pxContext.Ip,
Url = pxContext.FullUrl,
Details = details,
Headers = pxContext.GetHeadersAsDictionary(),
Headers = pxContext.lowercaseHttpHeaders,
};

if (!string.IsNullOrEmpty(pxContext.Vid))
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[PerimeterX](http://www.perimeterx.com) ASP.NET SDK
===================================================

> Latest stable version: [v3.2.0](https://www.nuget.org/packages/PerimeterXModule/3.2.0)
> Latest stable version: [v3.2.1](https://www.nuget.org/packages/PerimeterXModule/3.2.1)
Table of Contents
-----------------
Expand Down
2 changes: 1 addition & 1 deletion px_metadata.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "3.2.0",
"version": "3.2.1",
"supported_features": [
"additional_activity_handler",
"advanced_blocking_response",
Expand Down

0 comments on commit 6c48651

Please sign in to comment.