Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d6603201
Commit
d6603201
authored
Oct 14, 2020
by
Igor Drozdov
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch '215669-create-auto-fix-bot' into 'master'
Add security bot See merge request gitlab-org/gitlab!43147
parents
347701ae
ed2fe7d6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
4 deletions
+25
-4
app/models/concerns/has_user_type.rb
app/models/concerns/has_user_type.rb
+3
-2
app/models/user.rb
app/models/user.rb
+11
-0
changelogs/unreleased/215669-create-auto-fix-bot.yml
changelogs/unreleased/215669-create-auto-fix-bot.yml
+5
-0
spec/models/concerns/has_user_type_spec.rb
spec/models/concerns/has_user_type_spec.rb
+1
-1
spec/models/user_spec.rb
spec/models/user_spec.rb
+5
-1
No files found.
app/models/concerns/has_user_type.rb
View file @
d6603201
...
...
@@ -11,10 +11,11 @@ module HasUserType
service_user:
4
,
ghost:
5
,
project_bot:
6
,
migration_bot:
7
migration_bot:
7
,
security_bot:
8
}.
with_indifferent_access
.
freeze
BOT_USER_TYPES
=
%w[alert_bot project_bot support_bot visual_review_bot migration_bot]
.
freeze
BOT_USER_TYPES
=
%w[alert_bot project_bot support_bot visual_review_bot migration_bot
security_bot
]
.
freeze
NON_INTERNAL_USER_TYPES
=
%w[human project_bot service_user]
.
freeze
INTERNAL_USER_TYPES
=
(
USER_TYPES
.
keys
-
NON_INTERNAL_USER_TYPES
).
freeze
...
...
app/models/user.rb
View file @
d6603201
...
...
@@ -690,6 +690,17 @@ class User < ApplicationRecord
end
end
def
security_bot
email_pattern
=
"security-bot%s@
#{
Settings
.
gitlab
.
host
}
"
unique_internal
(
where
(
user_type: :security_bot
),
'GitLab-Security-Bot'
,
email_pattern
)
do
|
u
|
u
.
bio
=
'System bot that monitors detected vulnerabilities for solutions and creates merge requests with the fixes.'
u
.
name
=
'GitLab Security Bot'
u
.
website_url
=
Gitlab
::
Routing
.
url_helpers
.
help_page_url
(
'user/application_security/security_bot/index.md'
)
u
.
avatar
=
bot_avatar
(
image:
'security-bot.png'
)
end
end
def
support_bot
email_pattern
=
"support%s@
#{
Settings
.
gitlab
.
host
}
"
...
...
changelogs/unreleased/215669-create-auto-fix-bot.yml
0 → 100644
View file @
d6603201
---
title
:
Add security bot
merge_request
:
43147
author
:
type
:
added
spec/models/concerns/has_user_type_spec.rb
View file @
d6603201
...
...
@@ -5,7 +5,7 @@ require 'spec_helper'
RSpec
.
describe
User
do
specify
'types consistency checks'
,
:aggregate_failures
do
expect
(
described_class
::
USER_TYPES
.
keys
)
.
to
match_array
(
%w[human ghost alert_bot project_bot support_bot service_user visual_review_bot migration_bot]
)
.
to
match_array
(
%w[human ghost alert_bot project_bot support_bot service_user
security_bot
visual_review_bot migration_bot]
)
expect
(
described_class
::
USER_TYPES
).
to
include
(
*
described_class
::
BOT_USER_TYPES
)
expect
(
described_class
::
USER_TYPES
).
to
include
(
*
described_class
::
NON_INTERNAL_USER_TYPES
)
expect
(
described_class
::
USER_TYPES
).
to
include
(
*
described_class
::
INTERNAL_USER_TYPES
)
...
...
spec/models/user_spec.rb
View file @
d6603201
...
...
@@ -4867,7 +4867,8 @@ RSpec.describe User do
{
state:
'blocked'
},
{
user_type: :ghost
},
{
user_type: :alert_bot
},
{
user_type: :support_bot
}
{
user_type: :support_bot
},
{
user_type: :security_bot
}
]
end
...
...
@@ -4922,6 +4923,7 @@ RSpec.describe User do
'human'
|
true
'alert_bot'
|
false
'support_bot'
|
false
'security_bot'
|
false
end
with_them
do
...
...
@@ -5033,9 +5035,11 @@ RSpec.describe User do
it_behaves_like
'bot users'
,
:alert_bot
it_behaves_like
'bot users'
,
:support_bot
it_behaves_like
'bot users'
,
:migration_bot
it_behaves_like
'bot users'
,
:security_bot
it_behaves_like
'bot users'
,
:ghost
it_behaves_like
'bot user avatars'
,
:alert_bot
,
'alert-bot.png'
it_behaves_like
'bot user avatars'
,
:support_bot
,
'support-bot.png'
it_behaves_like
'bot user avatars'
,
:security_bot
,
'security-bot.png'
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment