1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Robots.txt Requests', :aggregate_failures do
before do
Gitlab::Testing::RobotsBlockerMiddleware.block_requests!
end
after do
Gitlab::Testing::RobotsBlockerMiddleware.allow_requests!
end
it 'allows the requests' do
requests = [
'/users/sign_in',
'/namespace/subnamespace/design.gitlab.com',
'/users/foo/snippets',
'/users/foo/snippets/1'
]
requests.each do |request|
get request
expect(response).not_to have_gitlab_http_status(:service_unavailable), "#{request} must be allowed"
end
end
it 'blocks the requests' do
requests = [
'/autocomplete/users',
'/autocomplete/projects',
'/search',
'/admin',
'/profile',
'/dashboard',
'/users',
'/users/foo',
'/help',
'/s/',
'/-/profile',
'/-/ide/project',
'/foo/bar/new',
'/foo/bar/edit',
'/foo/bar/raw',
'/groups/foo/analytics',
'/groups/foo/contribution_analytics',
'/groups/foo/group_members',
'/foo/bar/project.git',
'/foo/bar/archive/foo',
'/foo/bar/repository/archive',
'/foo/bar/activity',
'/foo/bar/blame',
'/foo/bar/commits',
'/foo/bar/commit',
'/foo/bar/compare',
'/foo/bar/network',
'/foo/bar/graphs',
'/foo/bar/merge_requests/1.patch',
'/foo/bar/merge_requests/1.diff',
'/foo/bar/merge_requests/1/diffs',
'/foo/bar/deploy_keys',
'/foo/bar/hooks',
'/foo/bar/services',
'/foo/bar/protected_branches',
'/foo/bar/uploads/foo',
'/foo/bar/project_members',
'/foo/bar/settings',
'/namespace/subnamespace/design.gitlab.com/settings',
'/foo/bar/-/import',
'/foo/bar/-/environments',
'/foo/bar/-/jobs',
'/foo/bar/-/requirements_management',
'/foo/bar/-/pipelines',
'/foo/bar/-/pipeline_schedules',
'/foo/bar/-/dependencies',
'/foo/bar/-/licenses',
'/foo/bar/-/metrics',
'/foo/bar/-/incidents',
'/foo/bar/-/value_stream_analytics',
'/foo/bar/-/analytics',
'/foo/bar/insights'
]
requests.each do |request|
get request
expect(response).to have_gitlab_http_status(:service_unavailable), "#{request} must be disallowed"
end
end
end
|