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
f49c43e6
Commit
f49c43e6
authored
Aug 20, 2019
by
GitLab Bot
Browse files
Options
Browse Files
Download
Plain Diff
Automatic merge of gitlab-org/gitlab-ce master
parents
55ff13c5
2989ed07
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
39 additions
and
21 deletions
+39
-21
app/controllers/concerns/invisible_captcha.rb
app/controllers/concerns/invisible_captcha.rb
+2
-2
config/initializers/rack_attack_logging.rb
config/initializers/rack_attack_logging.rb
+2
-2
doc/administration/logs.md
doc/administration/logs.md
+1
-1
lib/api/api.rb
lib/api/api.rb
+1
-1
lib/gitlab/action_rate_limiter.rb
lib/gitlab/action_rate_limiter.rb
+2
-2
lib/gitlab/grape_logging/loggers/client_env_logger.rb
lib/gitlab/grape_logging/loggers/client_env_logger.rb
+16
-0
spec/controllers/projects/raw_controller_spec.rb
spec/controllers/projects/raw_controller_spec.rb
+2
-2
spec/controllers/registrations_controller_spec.rb
spec/controllers/registrations_controller_spec.rb
+2
-2
spec/frontend/mocks/mocks_helper_spec.js
spec/frontend/mocks/mocks_helper_spec.js
+3
-1
spec/lib/gitlab/action_rate_limiter_spec.rb
spec/lib/gitlab/action_rate_limiter_spec.rb
+2
-2
spec/requests/rack_attack_global_spec.rb
spec/requests/rack_attack_global_spec.rb
+6
-6
No files found.
app/controllers/concerns/invisible_captcha.rb
View file @
f49c43e6
...
...
@@ -41,9 +41,9 @@ module InvisibleCaptcha
request_information
=
{
message:
message
,
env: :invisible_captcha_signup_bot_detected
,
ip:
request
.
ip
,
remote_
ip:
request
.
ip
,
request_method:
request
.
request_method
,
full
path:
request
.
fullpath
path:
request
.
fullpath
}
Gitlab
::
AuthLogger
.
error
(
request_information
)
...
...
config/initializers/rack_attack_logging.rb
View file @
f49c43e6
...
...
@@ -7,9 +7,9 @@ ActiveSupport::Notifications.subscribe('rack.attack') do |name, start, finish, r
rack_attack_info
=
{
message:
'Rack_Attack'
,
env:
req
.
env
[
'rack.attack.match_type'
],
ip:
req
.
ip
,
remote_
ip:
req
.
ip
,
request_method:
req
.
request_method
,
full
path:
req
.
fullpath
path:
req
.
fullpath
}
if
%w(throttle_authenticated_api throttle_authenticated_web)
.
include?
req
.
env
[
'rack.attack.matched'
]
...
...
doc/administration/logs.md
View file @
f49c43e6
...
...
@@ -88,7 +88,7 @@ Introduced in GitLab 10.0, this file lives in
It helps you see requests made directly to the API. For example:
```
json
{
"time"
:
"2018-10-29T12:49:42.123Z"
,
"severity"
:
"INFO"
,
"duration"
:
709.08
,
"db"
:
14.59
,
"view"
:
694.49
,
"status"
:
200
,
"method"
:
"GET"
,
"path"
:
"/api/v4/projects"
,
"params"
:[{
"key"
:
"action"
,
"value"
:
"git-upload-pack"
},{
"key"
:
"changes"
,
"value"
:
"_any"
},{
"key"
:
"key_id"
,
"value"
:
"secret"
},{
"key"
:
"secret_token"
,
"value"
:
"[FILTERED]"
}],
"host"
:
"localhost"
,
"ip"
:
"::1"
,
"ua"
:
"Ruby"
,
"route"
:
"/api/:version/projects"
,
"user_id"
:
1
,
"username"
:
"root"
,
"queue_duration"
:
100.31
,
"gitaly_calls"
:
30
,
"gitaly_duration"
:
5.36
}
{
"time"
:
"2018-10-29T12:49:42.123Z"
,
"severity"
:
"INFO"
,
"duration"
:
709.08
,
"db"
:
14.59
,
"view"
:
694.49
,
"status"
:
200
,
"method"
:
"GET"
,
"path"
:
"/api/v4/projects"
,
"params"
:[{
"key"
:
"action"
,
"value"
:
"git-upload-pack"
},{
"key"
:
"changes"
,
"value"
:
"_any"
},{
"key"
:
"key_id"
,
"value"
:
"secret"
},{
"key"
:
"secret_token"
,
"value"
:
"[FILTERED]"
}],
"host"
:
"localhost"
,
"
remote_
ip"
:
"::1"
,
"ua"
:
"Ruby"
,
"route"
:
"/api/:version/projects"
,
"user_id"
:
1
,
"username"
:
"root"
,
"queue_duration"
:
100.31
,
"gitaly_calls"
:
30
,
"gitaly_duration"
:
5.36
}
```
This entry above shows an access to an internal endpoint to check whether an
...
...
lib/api/api.rb
View file @
f49c43e6
...
...
@@ -18,7 +18,7 @@ module API
formatter:
Gitlab
::
GrapeLogging
::
Formatters
::
LogrageWithTimestamp
.
new
,
include:
[
GrapeLogging
::
Loggers
::
FilterParameters
.
new
(
LOG_FILTERS
),
G
rapeLogging
::
Loggers
::
ClientEnv
.
new
,
G
itlab
::
GrapeLogging
::
Loggers
::
ClientEnvLogger
.
new
,
Gitlab
::
GrapeLogging
::
Loggers
::
RouteLogger
.
new
,
Gitlab
::
GrapeLogging
::
Loggers
::
UserLogger
.
new
,
Gitlab
::
GrapeLogging
::
Loggers
::
QueueDurationLogger
.
new
,
...
...
lib/gitlab/action_rate_limiter.rb
View file @
f49c43e6
...
...
@@ -49,9 +49,9 @@ module Gitlab
request_information
=
{
message:
'Action_Rate_Limiter_Request'
,
env:
type
,
ip:
request
.
ip
,
remote_
ip:
request
.
ip
,
request_method:
request
.
request_method
,
full
path:
request
.
fullpath
path:
request
.
fullpath
}
if
current_user
...
...
lib/gitlab/grape_logging/loggers/client_env_logger.rb
0 → 100644
View file @
f49c43e6
# frozen_string_literal: true
# This is a fork of
# https://github.com/aserafin/grape_logging/blob/master/lib/grape_logging/loggers/client_env.rb
# to use remote_ip instead of ip.
module
Gitlab
module
GrapeLogging
module
Loggers
class
ClientEnvLogger
<
::
GrapeLogging
::
Loggers
::
Base
def
parameters
(
request
,
_
)
{
remote_ip:
request
.
env
[
"HTTP_X_FORWARDED_FOR"
]
||
request
.
env
[
"REMOTE_ADDR"
],
ua:
request
.
env
[
"HTTP_USER_AGENT"
]
}
end
end
end
end
end
spec/controllers/projects/raw_controller_spec.rb
View file @
f49c43e6
...
...
@@ -67,9 +67,9 @@ describe Projects::RawController do
attributes
=
{
message:
'Action_Rate_Limiter_Request'
,
env: :raw_blob_request_limit
,
ip:
'0.0.0.0'
,
remote_
ip:
'0.0.0.0'
,
request_method:
'GET'
,
full
path:
"/
#{
project
.
full_path
}
/raw/
#{
file_path
}
"
path:
"/
#{
project
.
full_path
}
/raw/
#{
file_path
}
"
}
expect
(
Gitlab
::
AuthLogger
).
to
receive
(
:error
).
with
(
attributes
).
once
...
...
spec/controllers/registrations_controller_spec.rb
View file @
f49c43e6
...
...
@@ -129,9 +129,9 @@ describe RegistrationsController do
{
message:
auth_log_message
,
env: :invisible_captcha_signup_bot_detected
,
ip:
'0.0.0.0'
,
remote_
ip:
'0.0.0.0'
,
request_method:
'POST'
,
full
path:
'/users'
path:
'/users'
}
end
...
...
spec/frontend/mocks/mocks_helper_spec.js
View file @
f49c43e6
...
...
@@ -46,7 +46,9 @@ describe('mocks_helper.js', () => {
readdir
.
sync
.
mockReturnValue
([]);
setupManualMocks
();
readdir
.
mock
.
calls
.
forEach
(
call
=>
{
const
readdirSpy
=
readdir
.
sync
;
expect
(
readdirSpy
).
toHaveBeenCalled
();
readdirSpy
.
mock
.
calls
.
forEach
(
call
=>
{
expect
(
call
[
1
].
deep
).
toBeLessThan
(
100
);
});
});
...
...
spec/lib/gitlab/action_rate_limiter_spec.rb
View file @
f49c43e6
...
...
@@ -74,9 +74,9 @@ describe Gitlab::ActionRateLimiter, :clean_gitlab_redis_cache do
{
message:
'Action_Rate_Limiter_Request'
,
env:
type
,
ip:
'127.0.0.1'
,
remote_
ip:
'127.0.0.1'
,
request_method:
'GET'
,
full
path:
fullpath
path:
fullpath
}
end
...
...
spec/requests/rack_attack_global_spec.rb
View file @
f49c43e6
...
...
@@ -112,9 +112,9 @@ describe 'Rack Attack global throttles' do
arguments
=
{
message:
'Rack_Attack'
,
env: :throttle
,
ip:
'127.0.0.1'
,
remote_
ip:
'127.0.0.1'
,
request_method:
'GET'
,
full
path:
get_args
.
first
,
path:
get_args
.
first
,
user_id:
user
.
id
,
username:
user
.
username
}
...
...
@@ -213,9 +213,9 @@ describe 'Rack Attack global throttles' do
arguments
=
{
message:
'Rack_Attack'
,
env: :throttle
,
ip:
'127.0.0.1'
,
remote_
ip:
'127.0.0.1'
,
request_method:
'GET'
,
full
path:
'/users/sign_in'
path:
'/users/sign_in'
}
expect
(
Gitlab
::
AuthLogger
).
to
receive
(
:error
).
with
(
arguments
)
...
...
@@ -377,9 +377,9 @@ describe 'Rack Attack global throttles' do
arguments
=
{
message:
'Rack_Attack'
,
env: :throttle
,
ip:
'127.0.0.1'
,
remote_
ip:
'127.0.0.1'
,
request_method:
'GET'
,
full
path:
'/dashboard/snippets'
,
path:
'/dashboard/snippets'
,
user_id:
user
.
id
,
username:
user
.
username
}
...
...
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