Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-11-26 15:01:46 +0300
committerGitLab Release Tools Bot <robert+release-tools@gitlab.com>2019-11-26 15:01:46 +0300
commit774a7ed239a9f3ad2f31246b6d6e32dbac82b3f1 (patch)
tree8a91d0be731e763930ab2a1687e6fef081994a77 /config
parent7e789039da06ad05a0326fc248ae86a446270ea6 (diff)
parentcd39502d5911bdcd0d6e4162d12e990d0f643486 (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.rb29
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