diff options
author | George Koltsov <gkoltsov@gitlab.com> | 2019-07-26 13:21:52 +0300 |
---|---|---|
committer | George Koltsov <gkoltsov@gitlab.com> | 2019-08-02 17:39:18 +0300 |
commit | e5e1c907c01b53194f77e8d8de53554ba1824e7c (patch) | |
tree | 5f9602f3abf48056d4258a749cd9c756981d5abd /app/services/web_hook_service.rb | |
parent | eb2d4adf38726da62f62e850d181cedf12c64c5e (diff) |
Add outbound requests setting for system hooks
This MR adds new application setting to network section
`allow_local_requests_from_system_hooks`. Prior to this change
system hooks were allowed to do local network requests by default
and we are adding an ability for admins to control it.
Diffstat (limited to 'app/services/web_hook_service.rb')
-rw-r--r-- | app/services/web_hook_service.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/services/web_hook_service.rb b/app/services/web_hook_service.rb index 6d675c026bb..8c294218708 100644 --- a/app/services/web_hook_service.rb +++ b/app/services/web_hook_service.rb @@ -17,8 +17,10 @@ class WebHookService @hook = hook @data = data @hook_name = hook_name.to_s - @request_options = { timeout: Gitlab.config.gitlab.webhook_timeout } - @request_options.merge!(allow_local_requests: true) if @hook.is_a?(SystemHook) + @request_options = { + timeout: Gitlab.config.gitlab.webhook_timeout, + allow_local_requests: hook.allow_local_requests? + } end def execute |