diff options
author | Dylan Griffith <dyl.griffith@gmail.com> | 2019-04-26 13:27:06 +1000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-04-29 22:55:13 -0700 |
commit | a1c216e5e4f566b762e185ad36bf566f14268cba (patch) | |
tree | 20bdf979d2cc2574cef20be87a6b8e88b37c4ddf | |
parent | dbb284de5a18361eae937926052abd1ea3c261b5 (diff) | |
download | gitlab-ce-a1c216e5e4f566b762e185ad36bf566f14268cba.tar.gz |
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.
-rw-r--r-- | app/services/clusters/applications/create_service.rb | 4 | ||||
-rw-r--r-- | app/services/clusters/applications/destroy_service.rb | 2 | ||||
-rw-r--r-- | app/services/clusters/applications/update_service.rb | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/app/services/clusters/applications/create_service.rb b/app/services/clusters/applications/create_service.rb index ae36da7b3dd..f723c42c049 100644 --- a/app/services/clusters/applications/create_service.rb +++ b/app/services/clusters/applications/create_service.rb @@ -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 diff --git a/app/services/clusters/applications/destroy_service.rb b/app/services/clusters/applications/destroy_service.rb index fc74e1300a9..f3a4c4f754a 100644 --- a/app/services/clusters/applications/destroy_service.rb +++ b/app/services/clusters/applications/destroy_service.rb @@ -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 diff --git a/app/services/clusters/applications/update_service.rb b/app/services/clusters/applications/update_service.rb index 5071c31839c..0fa937da865 100644 --- a/app/services/clusters/applications/update_service.rb +++ b/app/services/clusters/applications/update_service.rb @@ -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 |