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
Decode a URL encoded proxy username or password #665
base: master
Are you sure you want to change the base?
Decode a URL encoded proxy username or password #665
Conversation
|
@ab Please review when you can. Thanks! |
|
It looks like it's failing on rubocop configuration changes but all of the tests pass. I can look at this in a followup PR. |
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.
Looks good to me 🙆♂️
https://bugzilla.redhat.com/show_bug.cgi?id=1566615 Monkey patch RestClient for patch releases of rest-client 2.0.0. The underlying method, net_http_object, has not been modified since 2015 so it should be relatively safe to monkey patch this until the upstream PR gets merged/released. Upstream PR: rest-client/rest-client#665
https://bugzilla.redhat.com/show_bug.cgi?id=1566615 Monkey patch RestClient for patch releases of rest-client 2.0.0. The underlying method, net_http_object, has not been modified since 2015 so it should be relatively safe to monkey patch this until the upstream PR gets merged/released. Upstream PR: rest-client/rest-client#665 To verify this works, run bin/rails console: Before: ``` irb(main):004:0> r = RestClient::Request.new(method: :get, url: 'http://127.0.0.1/api', proxy: 'http://%24myuser:%24%3Fxxxx@127.0.0.1') => <RestClient::Request @method="get", @url="http://127.0.0.1/api">=> <RestClient::Request @method="get", @url="https://127.0.0.1/api"> irb(main):002:0> r.net_http_object('host', 80).proxy_user => "%24myuser" irb(main):003:0> r.net_http_object('host', 80).proxy_pass => "%24%3Fxxxx" ``` After: ``` irb(main):004:0> r = RestClient::Request.new(method: :get, url: 'http://127.0.0.1/api', proxy: 'http://%24myuser:%24%3Fxxxx@127.0.0.1') => <RestClient::Request @method="get", @url="http://127.0.0.1/api">=> <RestClient::Request @method="get", @url="https://127.0.0.1/api"> irb(main):002:0> r.net_http_object('host', 80).proxy_user => "$myuser" irb(main):003:0> r.net_http_object('host', 80).proxy_pass => "$?xxxx" ```
|
Any chance this could get moving again anytime soon? |
Restclient as of version 2.1.0 uses provided credentials stored in a proxy URI object verbatim. If the credentials are escaped as they should be, then this leads to errors when we try to use the credentials because restclient sends the escaped form. There is a PR[1] in upstream restclient, which addresses this issue, but last movement there was in October 2018. ManageIQ folks decided to monkey patch restclient when they ran into the same issue, this commit is a loose adaptation of the original[1] and ManageIQ patches[2]. [1] - rest-client/rest-client#665 [2] - ManageIQ/manageiq#18105
Restclient as of version 2.1.0 uses provided credentials stored in a proxy URI object verbatim. If the credentials are escaped as they should be, then this leads to errors when we try to use the credentials because restclient sends the escaped form. There is a PR[1] in upstream restclient, which addresses this issue, but last movement there was in October 2018. ManageIQ folks decided to monkey patch restclient when they ran into the same issue, this commit is a loose adaptation of the original[1] and ManageIQ patches[2]. [1] - rest-client/rest-client#665 [2] - ManageIQ/manageiq#18105
Restclient as of version 2.1.0 uses provided credentials stored in a proxy URI object verbatim. If the credentials are escaped as they should be, then this leads to errors when we try to use the credentials because restclient sends the escaped form. There is a PR[1] in upstream restclient, which addresses this issue, but last movement there was in October 2018. ManageIQ folks decided to monkey patch restclient when they ran into the same issue, this commit is a loose adaptation of the original[1] and ManageIQ patches[2]. [1] - rest-client/rest-client#665 [2] - ManageIQ/manageiq#18105
Restclient as of version 2.1.0 uses provided credentials stored in a proxy URI object verbatim. If the credentials are escaped as they should be, then this leads to errors when we try to use the credentials because restclient sends the escaped form. There is a PR[1] in upstream restclient, which addresses this issue, but last movement there was in October 2018. ManageIQ folks decided to monkey patch restclient when they ran into the same issue, this commit is a loose adaptation of the original[1] and ManageIQ patches[2]. [1] - rest-client/rest-client#665 [2] - ManageIQ/manageiq#18105
Restclient as of version 2.1.0 uses provided credentials stored in a proxy URI object verbatim. If the credentials are escaped as they should be, then this leads to errors when we try to use the credentials because restclient sends the escaped form. There is a PR[1] in upstream restclient, which addresses this issue, but last movement there was in October 2018. ManageIQ folks decided to monkey patch restclient when they ran into the same issue, this commit is a loose adaptation of the original[1] and ManageIQ patches[2]. [1] - rest-client/rest-client#665 [2] - ManageIQ/manageiq#18105
Restclient as of version 2.1.0 uses provided credentials stored in a proxy URI object verbatim. If the credentials are escaped as they should be, then this leads to errors when we try to use the credentials because restclient sends the escaped form. There is a PR[1] in upstream restclient, which addresses this issue, but last movement there was in October 2018. ManageIQ folks decided to monkey patch restclient when they ran into the same issue, this commit is a loose adaptation of the original[1] and ManageIQ patches[2]. [1] - rest-client/rest-client#665 [2] - ManageIQ/manageiq#18105
Restclient as of version 2.1.0 uses provided credentials stored in a proxy URI object verbatim. If the credentials are escaped as they should be, then this leads to errors when we try to use the credentials because restclient sends the escaped form. There is a PR[1] in upstream restclient, which addresses this issue, but last movement there was in October 2018. ManageIQ folks decided to monkey patch restclient when they ran into the same issue, this commit is a loose adaptation of the original[1] and ManageIQ patches[2]. [1] - rest-client/rest-client#665 [2] - ManageIQ/manageiq#18105
Restclient as of version 2.1.0 uses provided credentials stored in a proxy URI object verbatim. If the credentials are escaped as they should be, then this leads to errors when we try to use the credentials because restclient sends the escaped form. There is a PR[1] in upstream restclient, which addresses this issue, but last movement there was in October 2018. ManageIQ folks decided to monkey patch restclient when they ran into the same issue, this commit is a loose adaptation of the original[1] and ManageIQ patches[2]. [1] - rest-client/rest-client#665 [2] - ManageIQ/manageiq#18105
Fixes rest-client#661 We already decode a URL encoded username or password using CGI.unescape, this change does the same thing for a proxy's credentials provided in a URL.
6080346
to
35d1640
Compare
|
@ab I have pushed a commit to fix a sporadic test failure on this pull request. Even though the PR is a few years old, it still is correct and we have similar code running in ManageIQ for a long time. If you combine this PR + #759 to correct renamed rubocops, the rubocop part will no longer exit 1 and will instead exit 0 with some cop warnings to fix later on so both specs and cops will exit 0. Please let me know what we can do to get this merged. Thank you! |
Changes to the global RestClient.log were rolled back in the "before" instead of the "after", which meant, if tests made changes to the RestClient.log, those changes remained after the test. This was causing breakages when the request_spec.rb examples ran before the resource-spec.rb.
35d1640
to
45ddcbb
Compare
|
cc @L2G @mattmanning please also review if you have a chance... thanks! |
Fixes #661
We already decode a URL encoded username or password using CGI.unescape,
this change does the same thing for a proxy's credentials provided in a
URL.