Skip to content

Commit

Permalink
avoid reusing generic validation method during params securization
Browse files Browse the repository at this point in the history
Fixes #4952
  • Loading branch information
jsvd authored and andrewvc committed Mar 31, 2016
1 parent dd11ecf commit 54ab10d
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion logstash-core/lib/logstash/config/mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ def config_init(params)

# now that we know the parameters are valid, we can obfuscate the original copy
# of the parameters before storing them as an instance variable
self.class.validate_check_parameter_values(original_params)
self.class.secure_params!(original_params)
@original_params = original_params

@config = params
Expand Down Expand Up @@ -542,6 +542,14 @@ def validate_value(value, validator)
return true, result
end # def validate_value

def secure_params!(params)
params.each do |key, value|
if @config[key][:validate] == :password && !value.is_a?(::LogStash::Util::Password)
params[key] = ::LogStash::Util::Password.new(value)
end
end
end

def hash_or_array(value)
if !value.is_a?(Hash)
value = [*value] # coerce scalar to array if necessary
Expand Down

0 comments on commit 54ab10d

Please sign in to comment.