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
d073e732
Commit
d073e732
authored
Jul 05, 2021
by
Douglas Barbosa Alexandre
Committed by
Mike Kozono
Jul 06, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not create audit event for failed logins on read-only DB
Changelog: fixed EE: true
parent
8ba3b727
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
ee/app/services/ee/audit_event_service.rb
ee/app/services/ee/audit_event_service.rb
+1
-1
ee/spec/services/audit_event_service_spec.rb
ee/spec/services/audit_event_service_spec.rb
+10
-0
No files found.
ee/app/services/ee/audit_event_service.rb
View file @
d073e732
...
...
@@ -133,7 +133,7 @@ module EE
# @return [AuditEvent, nil] if record is persisted or nil if audit events
# features are not enabled
def
unauth_security_event
return
unless
audit_events_enabled?
return
unless
audit_events_enabled?
&&
::
Gitlab
::
Database
.
read_write?
add_security_event_admin_details!
...
...
ee/spec/services/audit_event_service_spec.rb
View file @
d073e732
...
...
@@ -333,6 +333,16 @@ RSpec.describe AuditEventService, :request_store do
expect
(
event
.
details
).
not_to
have_key
(
:ip_address
)
end
end
context
'on a read-only instance'
do
before
do
allow
(
Gitlab
::
Database
).
to
receive
(
:read_only?
).
and_return
(
true
)
end
it
'does not create an event record in the database'
do
expect
{
service
.
for_failed_login
.
unauth_security_event
}.
not_to
change
(
AuditEvent
,
:count
)
end
end
end
describe
'#for_project_group_link'
do
...
...
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