Skip to content

Commit

Permalink
Revert "Containers: redact certain custom attributes values when disp…
Browse files Browse the repository at this point in the history
…laying"

This reverts commit 5c64095 ( #844 )

In fine, custom attributes are used for proxy settings in some providers. This meant we needed to redact potentially sensitive usernames and passwords when displaying such custom attributes.

For gaprindashvili, this will be moved to an `options` object on the manager ( ManageIQ/manageiq#15398 ), removing the need to redact these.
  • Loading branch information
himdel committed Jun 23, 2017
1 parent 88b1f6e commit f3cb9b1
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions app/helpers/ems_container_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -120,25 +120,9 @@ def textual_group_miq_custom_attributes
TextualGroup.new(_("Custom Attributes"), textual_miq_custom_attributes)
end

def redact_username_and_password(value)
begin
uri = URI.parse(value)
uri.password = '***' if uri.password
uri.user = '***' if uri.user
uri.to_s
rescue # dont reduct in case the value was malformed, to allow debugging it.
value
end
end

def textual_miq_custom_attributes
attrs = @record.custom_attributes
return nil if attrs.blank?
attrs.sort_by(&:name).collect do |a|
{
:label => a.name.tr("_", " "),
:value => redact_username_and_password(a.value)
}
end
attrs.sort_by(&:name).collect { |a| {:label => a.name.tr("_", " "), :value => a.value} }
end
end

0 comments on commit f3cb9b1

Please sign in to comment.