Skip to content
This repository has been archived by the owner on Oct 18, 2018. It is now read-only.

Commit

Permalink
Add a few more parameter checks in WebHookVerifySignatureFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
dougbu committed Jan 23, 2018
1 parent f60ff25 commit 6a9ba32
Showing 1 changed file with 26 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,19 @@ protected virtual async Task<byte[]> ComputeRequestBodySha1HashAsync(
byte[] prefix,
byte[] suffix)
{
if (request == null)
{
throw new ArgumentNullException(nameof(request));
}
if (secret == null)
{
throw new ArgumentNullException(nameof(secret));
}
if (secret.Length == 0)
{
throw new ArgumentException(Resources.General_ArgumentCannotBeNullOrEmpty);
}

await WebHookHttpRequestUtilities.PrepareRequestBody(request);

using (var hasher = new HMACSHA1(secret))
Expand Down Expand Up @@ -352,6 +365,19 @@ protected virtual async Task<byte[]> ComputeRequestBodySha256HashAsync(
byte[] prefix,
byte[] suffix)
{
if (request == null)
{
throw new ArgumentNullException(nameof(request));
}
if (secret == null)
{
throw new ArgumentNullException(nameof(secret));
}
if (secret.Length == 0)
{
throw new ArgumentException(Resources.General_ArgumentCannotBeNullOrEmpty);
}

await WebHookHttpRequestUtilities.PrepareRequestBody(request);

using (var hasher = new HMACSHA256(secret))
Expand Down

0 comments on commit 6a9ba32

Please sign in to comment.