Skip to content

Commit

Permalink
Merge pull request #28 from PerimeterX/dev
Browse files Browse the repository at this point in the history
version bump 2.2.0
  • Loading branch information
nitzanpx authored Oct 11, 2017
2 parents 230ba59 + b11f686 commit c05eee3
Show file tree
Hide file tree
Showing 24 changed files with 1,349 additions and 889 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)

##[2.2.0] - 2017-11-10
### Fixed
- Fixed default value for sensitive_route
- Using action_block to render block pages
- Naming for s2s expired_cookie reason to cookie_expired
### Added
- JS Challenge support
- FunCaptcha support
- CustomVerificationHandler support
- MonitorMode and set default to true
##[2.1.0] - 2017-04-06
### Fixed
- Renamed risk_score to block_score in activity details
Expand Down
13 changes: 13 additions & 0 deletions PerimeterXModule/CustomBehavior/IVerificationHandler.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System.Web;

namespace PerimeterX
{
/// <summary>
/// Custom verification handler, can be used to replace the default verification behavior
/// to execute custom logic based on the risk score returned by PerimeterX.
/// </summary>
public interface IVerificationHandler
{
void Handle(HttpApplication HttpApplication, PxContext pxContext, PxModuleConfigurationSection pxConfig);
}
}
4 changes: 2 additions & 2 deletions PerimeterXModule/DataContracts/Requests/Additional.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ public class Additional
public string ModuleVersion { get { return PxConstants.MODULE_VERSION; } set { } }

[DataMember(Name = "s2s_call_reason")]
public RiskRequestReasonEnum CallReason;
public RiskRequestReasonEnum? CallReason;

[DataMember(Name = "px_orig_cookie")]
public string PxOrigCookie;

[DataMember(Name = "risk_mode")]
public ModuleMode RiskMode;
public ModuleMode? RiskMode;

[DataMember(Name = "px_cookie_hmac")]
public string PxCookieHMAC;
Expand Down
20 changes: 20 additions & 0 deletions PerimeterXModule/DataContracts/Requests/CaptchaAPIRequest.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System.Runtime.Serialization;

namespace PerimeterX
{
[DataContract]
public class CaptchaAPIRequest
{
[DataMember(Name = "request")]
public CaptchaRequest Request;

[DataMember(Name = "pxCaptcha")]
public string PXCaptcha;

[DataMember(Name = "hostname")]
public string Hostname;

[DataMember(Name = "additional")]
public Additional Additional;
}
}
20 changes: 0 additions & 20 deletions PerimeterXModule/DataContracts/Requests/CaptchaRequest.cs

This file was deleted.

20 changes: 20 additions & 0 deletions PerimeterXModule/DataContracts/Requests/Request.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,24 @@ public static Request CreateRequestFromContext(PxContext pxContext)
};
}
}

[DataContract]
[Serializable]
public class CaptchaRequest : Request
{
[DataMember(Name = "captchaType")]
public string CaptchaType { get; set; }

public static CaptchaRequest CreateCaptchaRequestFromContext(PxContext pxContext, string captchaType)
{
return new CaptchaRequest
{
IP = pxContext.Ip,
URL = pxContext.FullUrl,
URI = pxContext.Uri,
Headers = pxContext.Headers.ToArray(),
CaptchaType = captchaType
};
}
}
}
11 changes: 11 additions & 0 deletions PerimeterXModule/DataContracts/Responses/RiskResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,18 @@ public class RiskResponse
[DataMember(Name = "action")]
public string RiskResponseAction;

[DataMember(Name = "action_data")]
public ActionData RiskResponseActionData;

[DataMember(Name = "error_msg")]
public string ErrorMessage;
}


[DataContract]
public class ActionData
{
[DataMember(Name = "body")]
public string Body;
}
}
6 changes: 4 additions & 2 deletions PerimeterXModule/Internals/Enums/BlockReasonEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@ namespace PerimeterX
[DataContract]
public enum BlockReasonEnum
{
[EnumMember]
[EnumMember(Value = "none")]
NONE,
[EnumMember(Value = "cookie_high_score")]
COOKIE_HIGH_SCORE,
[EnumMember(Value = "s2s_high_score")]
RISK_HIGH_SCORE
RISK_HIGH_SCORE,
[EnumMember(Value = "challenge")]
CHALLENGE
}
}
4 changes: 2 additions & 2 deletions PerimeterXModule/Internals/Enums/RiskRequestReasonEnum.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ public enum RiskRequestReasonEnum
NONE,
[EnumMember(Value = "no_cookie")]
NO_COOKIE,
[EnumMember(Value = "expired_cookie")]
EXPIRED_COOKIE,
[EnumMember(Value = "cookie_expired")]
COOKIE_EXPIRED,
[EnumMember(Value = "invalid_cookie")]
INVALID_COOKIE,
[EnumMember(Value = "cookie_decryption_failed")]
Expand Down
3 changes: 2 additions & 1 deletion PerimeterXModule/Internals/Helpers/PxConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ public static class PxConstants
public static readonly string LOG_CATEGORY = "PxModule";
public static readonly string MODULE_VERSION = GetAssemblyVersion();
public static readonly Options JSON_OPTIONS = new Options(prettyPrint: false, excludeNulls: true, includeInherited: true);
public static readonly string JS_CHALLENGE_ACTION = "j";


// Endpoints
public const string RISK_API_V2 = "/api/v2/risk";
public const string CAPTCHA_API_V1 = "/api/v1/risk/captcha";
public const string CAPTCHA_API_PATH = "/api/v2/risk/captcha";

private static string GetAssemblyVersion()
{
Expand Down
Loading

0 comments on commit c05eee3

Please sign in to comment.