-
Notifications
You must be signed in to change notification settings - Fork 253
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
Encryption Bug #250
Comments
@timmyarch could you include the snippet of code you're calling with? |
@jch this will do the trick ;) - the bind will raise ldap = Net::LDAP.new( |
@timmyarch The constructor way of initializing encryption requires a hash (#239). This is different than old way of setting it through the ldap = Net::LDAP.new(:encryption => { :simple_tls }, ...)
ldap.bind @satoryu I noticed the "Documentation" link on https://rubygems.org/gems/net-ldap/versions/0.13.0 links to a really old version of net-ldap (0.0.4). I tried to file a bug on rubydoc.info, but got a 500. Any ideas? |
@jch encryption accepts an array? Are there multiple types of encryption? |
@timmyarch there are, docs are unfortunately linking to the wrong version, but you can see it in the source here: Lines 479 to 505 in b32f4e7
|
@jch the current link is for ruby-net-ldap not net-ldap. replace it with http://www.rubydoc.info/gems/net-ldap/Net/LDAP . |
@satoryu thanks. It's closer at 0.12.1, but still not quite there. |
Ah nice thanks, this will help. But it will be fine to get a pre parameter validation. To prevent such fails. Normally it should be always backwards compatible after minor Version bump. |
To clarify @jch's example above, either of these should work: ldap = Net::LDAP.new(:encryption => { :method => :simple_tls }, ...)
ldap = Net::LDAP.new(:encryption => [ :simple_tls ], ...) |
@satoryu would you be interested in adding a check and raising ArgumentError if someone passes in a non-hash?
@timmyarch I agree with you that this was confusing behavior to a user, but this is actually a new interface so there is no backwards compatibility to consider. The old way of setting encryption was to set it after initialization: ldap = Net::LDAP.new(...)
ldap.encryption(...) This makes me want to revisit releasing a major version so we can have more stability in the API since there are many production environments that rely on this gem. I'll open up a separate issue for that. |
👌 I'll sent a PR. |
I want to second this API breakage lament. We use net-ldap heavily in production and also have been passing encryption as a simple symbol, not a hash, and ended up with minor production downtime. |
@cthielen Thanks for reporting in. How did you previously set up encryption? This introduces a new way of setting encryption through the constructor, which was not previously available. If you set it up via |
Also was affected by this with same configuration as @timmyarch. We mock most of our ldap code in tests so we didn't catch it. Regardless @jch, not too big of a deal and I appreciate the time you spend on this library! |
@jch the Net::LDAP constructor has accepted an :encryption parameter since at least v0.2, see here: https://github.com/ruby-ldap/ruby-net-ldap/blob/v0.2/lib/net/ldap.rb#L382 It was modified in def2c46 to pass-through the given parameter instead of running it through the encryption method to normalize it into a hash, thus breaking the existing API for anyone who was passing in a symbol. This breaks, amongst other things, omniauth-ldap which is supplying the encryption parameter to the constructor. See https://github.com/intridea/omniauth-ldap/blob/9d36cdb9f3d4da040ab6f7aff54450392b78f5eb/lib/omniauth-ldap/adaptor.rb#L52 |
v0.14.0 should fix this #265 |
@ryanshow @timmyarch @cthielen I'm sorry. As @ryanshow 's work #264 , you would be able to specify encryption method as Symbol. @jch I was working on implementing a validation for |
Hey, 0.12.1 is incompatible with 0.13.0. I get the following trace, with encryption enabled.
"no implicit conversion of Symbol into Integer"
net-ldap (0.13.0) lib/net/ldap/connection.rb:118:in
[]' net-ldap (0.13.0) lib/net/ldap/connection.rb:118:in
setup_encryption'net-ldap (0.13.0) lib/net/ldap/connection.rb:30:in
prepare_socket' net-ldap (0.13.0) lib/net/ldap/connection.rb:44:in
block in open_connection'net-ldap (0.13.0) lib/net/ldap/connection.rb:42:in
each' net-ldap (0.13.0) lib/net/ldap/connection.rb:42:in
open_connection'net-ldap (0.13.0) lib/net/ldap/connection.rb:19:in
initialize' net-ldap (0.13.0) lib/net/ldap.rb:1254:in
new'net-ldap (0.13.0) lib/net/ldap.rb:1254:in
new_connection' net-ldap (0.13.0) lib/net/ldap.rb:849:in
block in bind'net-ldap (0.13.0) lib/net/ldap/instrumentation.rb:19:in
instrument' net-ldap (0.13.0) lib/net/ldap.rb:843:in
bind'The text was updated successfully, but these errors were encountered: