-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure that headers are correctly cased before signature verification… #59
Ensure that headers are correctly cased before signature verification… #59
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BunqSdk/Security/SecurityUtils.cs
Outdated
@@ -127,6 +133,20 @@ private static string GenerateRequestHeadersSortedString(HttpRequestMessage requ | |||
); | |||
} | |||
|
|||
private static string GetHeaderNameCorrectyCased(string headerName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetHeaderNameCorrectyCased
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets create a follow up issue to add tests in all SDK's. I've done a quick dirty test by manipulating the headers right after the response is received to see if it indeed works, which it does. But a test unit is indeed needed to ensure that in the future it does not break.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BunqSdk/Security/SecurityUtils.cs
Outdated
@@ -127,6 +133,20 @@ private static string GenerateRequestHeadersSortedString(HttpRequestMessage requ | |||
); | |||
} | |||
|
|||
private static string GetHeaderNameCorrectyCased(string headerName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test?
BunqSdk/Security/SecurityUtils.cs
Outdated
private static string GetHeaderNameCorrectyCased(string headerName) | ||
{ | ||
headerName = headerName.ToLower(); | ||
headerName = headerName.First().ToString().ToUpper() + headerName.Substring(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what emile says ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Regex is already used in the other SDK's. So for consistency i would like to keep using regex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OGKevin This is what I meant: https://dotnetfiddle.net/QdElDN
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I understand. But for the sake of maintaining, I prefer consistency over all the SDK's. So lets keep the SDK's as consistent with each other as we can.
BunqSdk/Security/SecurityUtils.cs
Outdated
@@ -127,6 +133,20 @@ private static string GenerateRequestHeadersSortedString(HttpRequestMessage requ | |||
); | |||
} | |||
|
|||
private static string GetHeaderNameCorrectyCased(string headerName) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetHeaderNameCorrectlyCased
BunqSdk/Security/SecurityUtils.cs
Outdated
private static string GetHeaderNameCorrectyCased(string headerName) | ||
{ | ||
headerName = headerName.ToLower(); | ||
headerName = headerName.First().ToString().ToUpper() + headerName.Substring(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what emile says ;-)
Closes #49