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
0
Merge Requests
0
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
Léo-Paul Géneau
gitlab-ce
Commits
b332caa4
Commit
b332caa4
authored
5 years ago
by
Oswaldo Ferreira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport "Track repository pushes as audit events"
parent
ab2d5fdd
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
4 deletions
+17
-4
app/services/audit_event_service.rb
app/services/audit_event_service.rb
+4
-4
config/sidekiq_queues.yml
config/sidekiq_queues.yml
+1
-0
spec/services/audit_event_service_spec.rb
spec/services/audit_event_service_spec.rb
+12
-0
No files found.
app/services/audit_event_service.rb
View file @
b332caa4
...
...
@@ -21,6 +21,10 @@ class AuditEventService
log_security_event_to_database
end
def
log_security_event_to_file
file_logger
.
info
(
base_payload
.
merge
(
formatted_details
))
end
private
def
base_payload
...
...
@@ -39,10 +43,6 @@ class AuditEventService
@details
.
merge
(
@details
.
slice
(
:from
,
:to
).
transform_values
(
&
:to_s
))
end
def
log_security_event_to_file
file_logger
.
info
(
base_payload
.
merge
(
formatted_details
))
end
def
log_security_event_to_database
SecurityEvent
.
create
(
base_payload
.
merge
(
details:
@details
))
end
...
...
This diff is collapsed.
Click to expand it.
config/sidekiq_queues.yml
View file @
b332caa4
...
...
@@ -102,6 +102,7 @@
- [create_github_webhook, 2]
- [geo, 1]
- [repository_update_mirror, 1]
- [repository_push_audit_event, 1]
- [new_epic, 2]
- [project_import_schedule, 1]
- [project_update_repository_storage, 1]
...
...
This diff is collapsed.
Click to expand it.
spec/services/audit_event_service_spec.rb
View file @
b332caa4
...
...
@@ -47,4 +47,16 @@ describe AuditEventService do
expect
(
details
[
:target_id
]).
to
eq
(
1
)
end
end
describe
'#log_security_event_to_file'
do
it
'logs security event to file'
do
expect
(
service
).
to
receive
(
:file_logger
).
and_return
(
logger
)
expect
(
logger
).
to
receive
(
:info
).
with
(
author_id:
user
.
id
,
entity_type:
'Project'
,
entity_id:
project
.
id
,
action: :destroy
)
service
.
log_security_event_to_file
end
end
end
This diff is collapsed.
Click to expand it.
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