Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/net/ldap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,13 @@ def paged_searches_supported?
@server_caps[:supportedcontrol].include?(Net::LDAP::LDAPControls::PAGED_RESULTS)
end

# Mask auth password
def inspect
inspected = super
inspected.gsub! @auth[:password], "*******" if @auth[:password]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

inspected
end

private

# Yields an open connection if there is one, otherwise establishes a new
Expand Down
7 changes: 7 additions & 0 deletions test/test_ldap.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,11 @@ def test_instrument_search_with_size
assert_equal "(uid=user1)", payload[:filter]
assert_equal result.size, payload[:size]
end

def test_obscure_auth
password = "opensesame"
assert_include(@subject.inspect, "anonymous")
@subject.auth "joe_user", password
assert_not_include(@subject.inspect, password)
end
end