Use #public_send instead #method.call

These builder methods are using user provided input inside a public_send
but this is safe to do in this instance because before they are called
we check before calling them that they match an expected application
name.
This commit is contained in:
Dylan Griffith 2019-04-26 13:27:06 +10:00 committed by Stan Hu
parent dbb284de5a
commit a1c216e5e4
3 changed files with 4 additions and 4 deletions

View File

@ -10,8 +10,8 @@ module Clusters
end
def builder
cluster.method("application_#{application_name}").call ||
cluster.method("build_application_#{application_name}").call
cluster.public_send(:"application_#{application_name}") || # rubocop:disable GitlabSecurity/PublicSend
cluster.public_send(:"build_application_#{application_name}") # rubocop:disable GitlabSecurity/PublicSend
end
end
end

View File

@ -16,7 +16,7 @@ module Clusters
private
def builder
cluster.method("application_#{application_name}").call
cluster.public_send(:"application_#{application_name}") # rubocop:disable GitlabSecurity/PublicSend
end
end
end

View File

@ -10,7 +10,7 @@ module Clusters
end
def builder
cluster.method("application_#{application_name}").call
cluster.public_send(:"application_#{application_name}") # rubocop:disable GitlabSecurity/PublicSend
end
end
end