diff options
author | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-11-26 15:01:46 +0300 |
---|---|---|
committer | GitLab Release Tools Bot <robert+release-tools@gitlab.com> | 2019-11-26 15:01:46 +0300 |
commit | 774a7ed239a9f3ad2f31246b6d6e32dbac82b3f1 (patch) | |
tree | 8a91d0be731e763930ab2a1687e6fef081994a77 /config | |
parent | 7e789039da06ad05a0326fc248ae86a446270ea6 (diff) | |
parent | cd39502d5911bdcd0d6e4162d12e990d0f643486 (diff) |
Merge branch 'security-dns-rebind-ssrf-in-slack-notifications-12-4-ce' into '12-4-stable'
Use Gitlab::HTTP for all chat notifications
See merge request gitlab/gitlabhq!3516
Diffstat (limited to 'config')
-rw-r--r-- | config/initializers/hangouts_chat_http_override.rb | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/config/initializers/hangouts_chat_http_override.rb b/config/initializers/hangouts_chat_http_override.rb new file mode 100644 index 00000000000..4fd886697e4 --- /dev/null +++ b/config/initializers/hangouts_chat_http_override.rb @@ -0,0 +1,29 @@ +# frozen_string_literal: true + +module HangoutsChat + class Sender + class HTTP + module GitlabHTTPOverride + extend ::Gitlab::Utils::Override + + attr_reader :uri + + # see https://github.com/enzinia/hangouts-chat/blob/6a509f61a56e757f8f417578b393b94423831ff7/lib/hangouts_chat/http.rb + override :post + def post(payload) + httparty_response = Gitlab::HTTP.post( + uri, + body: payload.to_json, + headers: { 'Content-Type' => 'application/json' }, + parse: nil # disables automatic response parsing + ) + net_http_response = httparty_response.response + # The rest of the integration expects a Net::HTTP response + net_http_response + end + end + + prepend GitlabHTTPOverride + end + end +end |