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
5ddd576c
Commit
5ddd576c
authored
Feb 15, 2018
by
Francisco Javier López
Committed by
Douwe Maan
Feb 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove internal api calls from the rack::attack throttling
parent
e5df66e1
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
changelogs/unreleased/fj-42910-unauthenticated-limit-via-ssh.yml
...ogs/unreleased/fj-42910-unauthenticated-limit-via-ssh.yml
+5
-0
config/initializers/rack_attack_global.rb
config/initializers/rack_attack_global.rb
+5
-0
spec/requests/rack_attack_global_spec.rb
spec/requests/rack_attack_global_spec.rb
+10
-0
No files found.
changelogs/unreleased/fj-42910-unauthenticated-limit-via-ssh.yml
0 → 100644
View file @
5ddd576c
---
title
:
Fixed bug with unauthenticated requests through git ssh
merge_request
:
17149
author
:
type
:
fixed
config/initializers/rack_attack_global.rb
View file @
5ddd576c
...
...
@@ -26,6 +26,7 @@ class Rack::Attack
throttle
(
'throttle_unauthenticated'
,
Gitlab
::
Throttle
.
unauthenticated_options
)
do
|
req
|
Gitlab
::
Throttle
.
settings
.
throttle_unauthenticated_enabled
&&
req
.
unauthenticated?
&&
!
req
.
api_internal_request?
&&
req
.
ip
end
...
...
@@ -54,6 +55,10 @@ class Rack::Attack
path
.
start_with?
(
'/api'
)
end
def
api_internal_request?
path
=~
%r{^/api/v
\d
+/internal/}
end
def
web_request?
!
api_request?
end
...
...
spec/requests/rack_attack_global_spec.rb
View file @
5ddd576c
...
...
@@ -22,6 +22,7 @@ describe 'Rack Attack global throttles' do
let
(
:url_that_does_not_require_authentication
)
{
'/users/sign_in'
}
let
(
:url_that_requires_authentication
)
{
'/dashboard/snippets'
}
let
(
:url_api_internal
)
{
'/api/v4/internal/check'
}
let
(
:api_partial_url
)
{
'/todos'
}
around
do
|
example
|
...
...
@@ -172,6 +173,15 @@ describe 'Rack Attack global throttles' do
get
url_that_does_not_require_authentication
expect
(
response
).
to
have_http_status
200
end
context
'when the request is to the api internal endpoints'
do
it
'allows requests over the rate limit'
do
(
1
+
requests_per_period
).
times
do
get
url_api_internal
,
secret_token:
Gitlab
::
Shell
.
secret_token
expect
(
response
).
to
have_http_status
200
end
end
end
end
context
'when the throttle is disabled'
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