Skip to content

Commit f9a4c3a

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 598b0e9 commit f9a4c3a

File tree

15 files changed

+238
-19
lines changed

15 files changed

+238
-19
lines changed

.gitlab/ci/package-and-test-nightly/main.gitlab-ci.yml

+4-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,6 @@ e2e-test-report:
167167
upload-knapsack-report:
168168
extends:
169169
- .upload-knapsack-report
170-
- .rules:report:process-results
171170

172171
export-test-metrics:
173172
extends:
@@ -177,6 +176,10 @@ relate-test-failures:
177176
extends:
178177
- .relate-test-failures
179178

179+
generate-test-session:
180+
extends:
181+
- .generate-test-session
182+
180183
notify-slack:
181184
extends:
182185
- .notify-slack

.gitlab/ci/package-and-test/main.gitlab-ci.yml

-1
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,6 @@ e2e-test-report:
502502
upload-knapsack-report:
503503
extends:
504504
- .upload-knapsack-report
505-
- .rules:report:process-results
506505

507506
export-test-metrics:
508507
extends:

.gitlab/ci/rules.gitlab-ci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -1475,13 +1475,16 @@
14751475
allow_failure: true
14761476
variables:
14771477
SKIP_REPORT_IN_ISSUES: "false"
1478+
PROCESS_TEST_RESULTS: "true"
14781479
QA_SAVE_TEST_METRICS: "true"
14791480
QA_EXPORT_TEST_METRICS: "false"
14801481

14811482
.qa:rules:e2e:test-on-gdk:
14821483
rules:
14831484
- if: '$QA_RUN_TESTS_ON_GDK !~ /true|yes|1/i'
14841485
when: never
1486+
- <<: *if-default-branch-schedule-nightly # already executed in the 2-hourly schedule
1487+
when: never
14851488
- !reference [".qa:rules:package-and-test-common", rules]
14861489
- !reference [".qa:rules:package-and-test-schedule", rules]
14871490

@@ -1506,6 +1509,7 @@
15061509
allow_failure: true
15071510
variables:
15081511
KNAPSACK_GENERATE_REPORT: "true"
1512+
PROCESS_TEST_RESULTS: "true"
15091513
SKIP_REPORT_IN_ISSUES: "false"
15101514
QA_SAVE_TEST_METRICS: "true"
15111515
QA_EXPORT_TEST_METRICS: "false"

GITALY_SERVER_VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
da80ab3efcbf3dc0289aacf698ffeabc3c381275
1+
e66b5c2f3d56234280470d45f769779619553280

app/models/abuse/trust_score.rb

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
module Abuse
44
class TrustScore < ApplicationRecord
55
MAX_EVENTS = 100
6+
SPAMCHECK_HAM_THRESHOLD = 0.5
67

78
self.table_name = 'abuse_trust_scores'
89

app/models/user.rb

+29-1
Original file line numberDiff line numberDiff line change
@@ -1670,7 +1670,7 @@ def delete_async(deleted_by:, params: {})
16701670
new_note = format(_("User deleted own account on %{timestamp}"), timestamp: Time.zone.now)
16711671
self.note = "#{new_note}\n#{note}".strip
16721672

1673-
block
1673+
block_or_ban
16741674

16751675
DeleteUserWorker.perform_in(DELETION_DELAY_IN_DAYS, deleted_by.id, id, params.to_h)
16761676
else
@@ -2256,6 +2256,10 @@ def namespace_commit_email_for_project(project)
22562256
namespace_commit_emails.find_by(namespace: project.root_namespace)
22572257
end
22582258

2259+
def spammer?
2260+
spam_score > Abuse::TrustScore::SPAMCHECK_HAM_THRESHOLD
2261+
end
2262+
22592263
def spam_score
22602264
abuse_trust_scores.spamcheck.average(:score) || 0.0
22612265
end
@@ -2313,6 +2317,30 @@ def consume_otp!
23132317

23142318
private
23152319

2320+
def block_or_ban
2321+
if spammer? && account_age_in_days < 7
2322+
ban_and_report
2323+
else
2324+
block
2325+
end
2326+
end
2327+
2328+
def ban_and_report
2329+
msg = 'Potential spammer account deletion'
2330+
attrs = { user_id: id, reporter: User.security_bot, category: 'spam' }
2331+
abuse_report = AbuseReport.find_by(attrs)
2332+
2333+
if abuse_report.nil?
2334+
abuse_report = AbuseReport.create!(attrs.merge(message: msg))
2335+
else
2336+
abuse_report.update(message: "#{abuse_report.message}\n\n#{msg}")
2337+
end
2338+
2339+
UserCustomAttribute.set_banned_by_abuse_report(abuse_report)
2340+
2341+
ban
2342+
end
2343+
23162344
def pbkdf2?
23172345
return false unless otp_backup_codes&.any?
23182346

app/models/user_custom_attribute.rb

+8
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,14 @@ def sessions
3535
.select(:value)
3636
end
3737

38+
def set_banned_by_abuse_report(abuse_report)
39+
return unless abuse_report
40+
41+
custom_attribute = { user_id: abuse_report.user.id, key: AUTO_BANNED_BY_ABUSE_REPORT_ID, value: abuse_report.id }
42+
43+
upsert_custom_attributes([custom_attribute])
44+
end
45+
3846
private
3947

4048
def blocked_users

app/views/shared/notes/_notes_with_form.html.haml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
- issuable = @issue || @merge_request
22
- discussion_locked = issuable&.discussion_locked?
33

4-
%ul#notes-list.notes.main-notes-list.timeline
4+
%ul#notes-list.notes.main-notes-list.timeline{ data: { 'qa_selector': 'notes_list' } }
55
= render "shared/notes/notes"
66

77
= render 'shared/notes/edit_form', project: @project

doc/administration/geo/setup/index.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,24 @@ type: howto
2121

2222
## Using Omnibus GitLab
2323

24-
If you installed GitLab using the Omnibus packages (highly recommended):
24+
If you installed GitLab using the Omnibus packages (highly recommended), the process for setting up Geo depends on whether you need to set up
25+
a single-node Geo site or a multi-node Geo site.
26+
27+
### Single-node Geo sites
28+
29+
If both Geo sites are based on the [1K reference architecture](../../reference_architectures/1k_users.md):
2530

2631
1. [Set up the database replication](database.md) (`primary (read-write) <-> secondary (read-only)` topology).
2732
1. [Configure GitLab](../replication/configuration.md) to set the **primary** and **secondary** sites.
2833
1. Optional: [Configure Object storage](../../object_storage.md)
2934
1. Optional: [Configure a secondary LDAP server](../../auth/ldap/index.md) for the **secondary** sites. See [notes on LDAP](../index.md#ldap).
3035
1. Optional: [Configure Geo secondary proxying](../secondary_proxy/index.md) to use a single, unified URL for all Geo sites. This step is recommended to accelerate most read requests while transparently proxying writes to the primary Geo site.
3136
1. Follow the [Using a Geo Site](../replication/usage.md) guide.
37+
38+
### Multi-node Geo sites
39+
40+
If one or more of your sites is using the [2K reference architecture](../../reference_architectures/2k_users.md) or larger, see
41+
[Configure Geo for multiple nodes](../replication/multiple_servers.md).
3242

3343
## Using GitLab Charts
3444

locale/gitlab.pot

+1-1
Original file line numberDiff line numberDiff line change
@@ -39754,7 +39754,7 @@ msgstr ""
3975439754
msgid "ScanExecutionPolicy|Run a %{scan} scan on runner that %{tags}"
3975539755
msgstr ""
3975639756

39757-
msgid "ScanExecutionPolicy|Run a %{scan} scan with %{dastProfiles} with tags %{tags}"
39757+
msgid "ScanExecutionPolicy|Run a %{scan} scan with %{dastProfiles} on runner that %{tags}"
3975839758
msgstr ""
3975939759

3976039760
msgid "ScanExecutionPolicy|Scanner profile"

qa/qa/page/component/snippet.rb

+8
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ def self.included(base)
7070
element :note_author_content
7171
end
7272

73+
base.view 'app/views/shared/notes/_notes_with_form.html.haml' do
74+
element :notes_list
75+
end
76+
7377
base.view 'app/views/projects/notes/_more_actions_dropdown.html.haml' do
7478
element :more_actions_dropdown
7579
element :delete_comment_button
@@ -216,6 +220,10 @@ def has_comment_content?(comment_content)
216220
end
217221
end
218222

223+
def within_notes_list(&block)
224+
within_element :notes_list, &block
225+
end
226+
219227
def has_syntax_highlighting?(language)
220228
within_element(:blob_viewer_file_content) do
221229
find('.line')['lang'].to_s == language

qa/qa/page/group/menu.rb

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class Menu < Page::Base
1616
end
1717

1818
def click_group_members_item
19+
return go_to_members if Runtime::Env.super_sidebar_enabled?
20+
1921
hover_group_information do
2022
within_submenu do
2123
click_element(:sidebar_menu_item_link, menu_item: 'Members')

qa/qa/specs/features/browser_ui/3_create/snippet/add_comment_to_snippet_spec.rb

+9-5
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,19 @@ def delete_comment
6666
end
6767

6868
def verify_comment_content(author, comment_content)
69-
Page::Dashboard::Snippet::Show.perform do |comment|
70-
expect(comment).to have_comment_author(author)
71-
expect(comment).to have_comment_content(comment_content)
69+
Page::Dashboard::Snippet::Show.perform do |snippet|
70+
expect(snippet).to have_comment_author(author)
71+
expect(snippet).to have_comment_content(comment_content)
7272
end
7373
end
7474

7575
def verify_comment_deleted
76-
expect(page).not_to have_content(comment_author.username)
77-
expect(page).not_to have_content(edited_comment_content)
76+
Page::Dashboard::Snippet::Show.perform do |snippet|
77+
snippet.within_notes_list do
78+
expect(snippet).not_to have_content(comment_author.username)
79+
expect(snippet).not_to have_content(edited_comment_content)
80+
end
81+
end
7882
end
7983
end
8084
end

spec/models/user_custom_attribute_spec.rb

+26-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
require 'spec_helper'
44

5-
RSpec.describe UserCustomAttribute do
5+
RSpec.describe UserCustomAttribute, feature_category: :user_profile do
66
describe 'assocations' do
77
it { is_expected.to belong_to(:user) }
88
end
@@ -40,6 +40,31 @@
4040
end
4141
end
4242

43+
describe '.set_banned_by_abuse_report' do
44+
let_it_be(:user) { create(:user) }
45+
let(:abuse_report) { create(:abuse_report, user: user) }
46+
47+
subject { UserCustomAttribute.set_banned_by_abuse_report(abuse_report) }
48+
49+
it 'adds the abuse report ID to user custom attributes' do
50+
subject
51+
52+
custom_attribute = user.custom_attributes.by_key(UserCustomAttribute::AUTO_BANNED_BY_ABUSE_REPORT_ID).first
53+
expect(custom_attribute.value).to eq(abuse_report.id.to_s)
54+
end
55+
56+
context 'when abuse report is nil' do
57+
let(:abuse_report) { nil }
58+
59+
it 'does not update custom attributes' do
60+
subject
61+
62+
custom_attribute = user.custom_attributes.by_key(UserCustomAttribute::AUTO_BANNED_BY_ABUSE_REPORT_ID).first
63+
expect(custom_attribute).to be_nil
64+
end
65+
end
66+
end
67+
4368
describe '#upsert_custom_attributes' do
4469
subject { UserCustomAttribute.upsert_custom_attributes(custom_attributes) }
4570

0 commit comments

Comments
 (0)