diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-28 22:03:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-09-28 22:03:28 +0000 |
commit | 6ed97cad88c8518155867b9a6a7896d7085a2f4e (patch) | |
tree | 48e63792d3ca6f832099e38163ed7b6388d88218 /spec/models | |
parent | cda92b051261cb820ed3ea9683865aeb85890411 (diff) | |
download | gitlab-ce-6ed97cad88c8518155867b9a6a7896d7085a2f4e.tar.gz |
Add latest changes from gitlab-org/security/gitlab@15-4-stable-ee
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/hooks/web_hook_log_spec.rb | 47 |
1 files changed, 35 insertions, 12 deletions
diff --git a/spec/models/hooks/web_hook_log_spec.rb b/spec/models/hooks/web_hook_log_spec.rb index 8ff8a1c3865..3441dfda7d6 100644 --- a/spec/models/hooks/web_hook_log_spec.rb +++ b/spec/models/hooks/web_hook_log_spec.rb @@ -44,26 +44,49 @@ RSpec.describe WebHookLog do end end - context 'with author email' do + context "with users' emails" do let(:author) { create(:user) } + let(:user) { create(:user) } let(:web_hook_log) { create(:web_hook_log, request_data: data) } let(:data) do { - commit: { - author: { - name: author.name, - email: author.email + user: { + name: user.name, + email: user.email + }, + commits: [ + { + user: { + name: author.name, + email: author.email + } + }, + { + user: { + name: user.name, + email: user.email + } } - } + ] }.deep_stringify_keys end - it "redacts author's email" do - expect(web_hook_log.request_data['commit']).to match a_hash_including( - 'author' => { - 'name' => author.name, - 'email' => _('[REDACTED]') - } + it "redacts users' emails" do + expect(web_hook_log.request_data['user']).to match a_hash_including( + 'name' => user.name, + 'email' => _('[REDACTED]') + ) + expect(web_hook_log.request_data['commits'].pluck('user')).to match_array( + [ + { + 'name' => author.name, + 'email' => _('[REDACTED]') + }, + { + 'name' => user.name, + 'email' => _('[REDACTED]') + } + ] ) end end |