diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-29 01:03:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-29 01:03:28 +0300 |
commit | 6ed97cad88c8518155867b9a6a7896d7085a2f4e (patch) | |
tree | 48e63792d3ca6f832099e38163ed7b6388d88218 /app | |
parent | cda92b051261cb820ed3ea9683865aeb85890411 (diff) |
Add latest changes from gitlab-org/security/gitlab@15-4-stable-ee
Diffstat (limited to 'app')
-rw-r--r-- | app/models/hooks/web_hook_log.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/app/models/hooks/web_hook_log.rb b/app/models/hooks/web_hook_log.rb index 3fc3f193f19..c32957fbef9 100644 --- a/app/models/hooks/web_hook_log.rb +++ b/app/models/hooks/web_hook_log.rb @@ -22,7 +22,7 @@ class WebHookLog < ApplicationRecord validates :web_hook, presence: true before_save :obfuscate_basic_auth - before_save :redact_author_email + before_save :redact_user_emails def self.recent where(created_at: 2.days.ago.beginning_of_day..Time.zone.now) @@ -54,9 +54,9 @@ class WebHookLog < ApplicationRecord self.url = safe_url end - def redact_author_email - return unless self.request_data.dig('commit', 'author', 'email').present? - - self.request_data['commit']['author']['email'] = _('[REDACTED]') + def redact_user_emails + self.request_data.deep_transform_values! do |value| + value =~ URI::MailTo::EMAIL_REGEXP ? _('[REDACTED]') : value + end end end |