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/spec
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-29 01:03:06 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-29 01:03:28 +0300
commit6ed97cad88c8518155867b9a6a7896d7085a2f4e (patch)
tree48e63792d3ca6f832099e38163ed7b6388d88218 /spec
parentcda92b051261cb820ed3ea9683865aeb85890411 (diff)
Add latest changes from gitlab-org/security/gitlab@15-4-stable-ee
Diffstat (limited to 'spec')
-rw-r--r--spec/lib/gitlab/ci/ansi2json/line_spec.rb2
-rw-r--r--spec/models/hooks/web_hook_log_spec.rb47
2 files changed, 37 insertions, 12 deletions
diff --git a/spec/lib/gitlab/ci/ansi2json/line_spec.rb b/spec/lib/gitlab/ci/ansi2json/line_spec.rb
index d16750d19f1..b8563bb1d1c 100644
--- a/spec/lib/gitlab/ci/ansi2json/line_spec.rb
+++ b/spec/lib/gitlab/ci/ansi2json/line_spec.rb
@@ -87,6 +87,8 @@ RSpec.describe Gitlab::Ci::Ansi2json::Line do
1.minute + 15.seconds | '01:15'
13.hours + 14.minutes + 15.seconds | '13:14:15'
1.day + 13.hours + 14.minutes + 15.seconds | '37:14:15'
+ Float::MAX | '8765:00:00'
+ 10**10000 | '8765:00:00'
end
with_them do
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