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
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/hooks/web_hook_log.rb')
-rw-r--r--app/models/hooks/web_hook_log.rb11
1 files changed, 9 insertions, 2 deletions
diff --git a/app/models/hooks/web_hook_log.rb b/app/models/hooks/web_hook_log.rb
index 4c35f699468..3e0c8e7c472 100644
--- a/app/models/hooks/web_hook_log.rb
+++ b/app/models/hooks/web_hook_log.rb
@@ -1,7 +1,6 @@
# frozen_string_literal: true
class WebHookLog < ApplicationRecord
- include SafeUrl
include Presentable
include DeleteWithLimit
include CreatedAtFilterable
@@ -58,10 +57,18 @@ class WebHookLog < ApplicationRecord
self[:request_headers].merge('X-Gitlab-Token' => _('[REDACTED]'))
end
+ def url_current?
+ # URL hash hasn't been set, so we must assume there's no prior value to
+ # compare to.
+ return true if url_hash.nil?
+
+ Gitlab::CryptoHelper.sha256(web_hook.interpolated_url) == url_hash
+ end
+
private
def obfuscate_basic_auth
- self.url = safe_url
+ self.url = Gitlab::UrlSanitizer.sanitize_masked_url(url)
end
def redact_user_emails