-
Notifications
You must be signed in to change notification settings - Fork 464
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
added request validation for urls with and without ports #481
Conversation
Just realized I forgot to add url builder unit tests. Adding now. |
if params_hash.is_a? Enumerable | ||
expected = build_signature_for(url, params_hash) | ||
secure_compare(expected, signature) | ||
else | ||
expected_signature = build_signature_for(url, {}) | ||
body_hash = URI.decode_www_form(URI(url).query).to_h['bodySHA256'] | ||
expected_hash = build_hash_for(params) | ||
secure_compare(expected_signature, signature) && secure_compare(expected_hash, body_hash) | ||
unless params_hash.is_a? Enumerable | ||
body_hash = URI.decode_www_form(parsed_url.query).to_h['bodySHA256'] | ||
params_hash = build_hash_for(params) | ||
valid_body = !(params_hash.nil? || body_hash.nil?) && secure_compare(params_hash, body_hash) | ||
params_hash = {} |
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.
Noice!
url += parsed_url.host ? "#{parsed_url.host}:#{parsed_url.default_port}" : '' | ||
url += parsed_url.path | ||
url += parsed_url.query ? "?#{parsed_url.query}" : '' | ||
url += parsed_url.fragment ? "##{parsed_url.fragment}" : '' |
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.
Don't think there's any tests for this line, but I assume it's the correct syntax.
PR for DI-322