Commits

Nick Sivo  committed 2ef2c03

Fix some bugs with request validation.

  • Participants
  • Parent commits 392d651
  • Tags 1.0.0.6

Comments (0)

Files changed (5)

File TwilioFluent.Mvc3/Properties/AssemblyInfo.cs

 // 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("1.0.0.5")]
-[assembly: AssemblyFileVersion("1.0.0.5")]
+[assembly: AssemblyVersion("1.0.0.6")]
+[assembly: AssemblyFileVersion("1.0.0.6")]

File TwilioFluent.Mvc3/TwilioAuthorizeAttribute.cs

 {
 	using System;
 	using System.Web.Mvc;
+	using System.Diagnostics;
 
 	/// <summary>
 	/// Validates signatures on incoming Twilio requests.

File TwilioFluent.Mvc3/TwilioRequestValidator.cs

 				}
 			}
 
-			return _validator.Validate(signatureString, request.RawUrl, parameters.ToArray());
+			return _validator.Validate(signatureString, request.Url.ToString(), parameters.ToArray());
 		}
 	}
 }

File TwilioFluent.TwiML/Properties/AssemblyInfo.cs

 // 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("1.0.0.5")]
-[assembly: AssemblyFileVersion("1.0.0.5")]
+[assembly: AssemblyVersion("1.0.0.6")]
+[assembly: AssemblyFileVersion("1.0.0.6")]

File TwilioFluent.TwiML/TwilioSignatureValidator.cs

 
 			using (var hmac = new HMACSHA1(_secret))
 			{
-				if (signature.Length != hmac.HashSize)
+				if (signature.Length != (hmac.HashSize / 8))
 					return false;
 
 				var hash = hmac.ComputeHash(Encoding.ASCII.GetBytes(temp.ToString()));