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
12735eef
Commit
12735eef
authored
Apr 24, 2017
by
Bob Van Landuyt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor style adjustments
parent
ea8e86da
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
45 additions
and
28 deletions
+45
-28
app/validators/dynamic_path_validator.rb
app/validators/dynamic_path_validator.rb
+39
-21
lib/constraints/project_url_constrainer.rb
lib/constraints/project_url_constrainer.rb
+1
-3
lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb
...base/rename_reserved_paths_migration/rename_namespaces.rb
+4
-3
lib/gitlab/etag_caching/router.rb
lib/gitlab/etag_caching/router.rb
+1
-1
No files found.
app/validators/dynamic_path_validator.rb
View file @
12735eef
...
...
@@ -16,20 +16,33 @@ class DynamicPathValidator < ActiveModel::EachValidator
# the path `api` shouldn't be allowed because it would be masked by `api/*`
#
TOP_LEVEL_ROUTES
=
Set
.
new
(
%w[
-
.well-known
abuse_reports
admin
all
api
assets
autocomplete
ci
dashboard
explore
files
groups
health_check
help
hooks
import
invites
issues
jwt
koding
member
merge_requests
new
notes
notification_settings
oauth
profile
projects
public
...
...
@@ -37,29 +50,14 @@ class DynamicPathValidator < ActiveModel::EachValidator
robots.txt
s
search
sent_notifications
services
snippets
teams
u
unsubscribes
users
api
autocomplete
search
member
explore
uploads
import
notification_settings
abuse_reports
invites
help
koding
health_check
jwt
oauth
sent_notifications
-
users
]
).
freeze
# All project routes with wildcard argument must be listed here.
...
...
@@ -71,10 +69,30 @@ class DynamicPathValidator < ActiveModel::EachValidator
# without tree as reserved name routing can match 'group/project' as group name,
# 'tree' as project name and 'deploy_keys' as route.
#
WILDCARD_ROUTES
=
Set
.
new
(
%w[tree commits wikis new edit create update logs_tree
preview blob blame raw files create_dir find_file
artifacts graphs refs badges info/lfs/objects
gitlab-lfs/objects environments/folders]
)
WILDCARD_ROUTES
=
Set
.
new
(
%w[
artifacts
badges
blame
blob
commits
create
create_dir
edit
environments/folders
files
find_file
gitlab-lfs/objects
graphs
info/lfs/objects
logs_tree
new
preview
raw
refs
tree
update
wikis
]
).
freeze
STRICT_RESERVED
=
(
TOP_LEVEL_ROUTES
|
WILDCARD_ROUTES
).
freeze
...
...
lib/constraints/project_url_constrainer.rb
View file @
12735eef
...
...
@@ -4,9 +4,7 @@ class ProjectUrlConstrainer
project_path
=
request
.
params
[
:project_id
]
||
request
.
params
[
:id
]
full_path
=
namespace_path
+
'/'
+
project_path
unless
DynamicPathValidator
.
valid?
(
full_path
)
return
false
end
return
false
unless
DynamicPathValidator
.
valid?
(
full_path
)
Project
.
find_by_full_path
(
full_path
).
present?
end
...
...
lib/gitlab/database/rename_reserved_paths_migration/rename_namespaces.rb
View file @
12735eef
...
...
@@ -11,13 +11,14 @@ module Gitlab
end
def
namespaces_for_paths
(
type
:)
namespaces
=
if
type
==
:wildcard
namespaces
=
case
type
when
:wildcard
MigrationClasses
::
Namespace
.
where
.
not
(
parent_id:
nil
)
elsif
type
==
:top_level
when
:top_level
MigrationClasses
::
Namespace
.
where
(
parent_id:
nil
)
end
with_paths
=
MigrationClasses
::
Route
.
arel_table
[
:path
].
matches_any
(
path_patterns
)
matches_any
(
path_patterns
)
namespaces
.
joins
(
:route
).
where
(
with_paths
)
end
...
...
lib/gitlab/etag_caching/router.rb
View file @
12735eef
...
...
@@ -8,7 +8,7 @@ module Gitlab
# regex itself)
# - Ending in `noteable/issue/<id>/notes` for the `issue_notes` route
# - Ending in `issues/id`/rendered_title` for the `issue_title` route
USED_IN_ROUTES
=
%w[noteable issue notes issues render
r
ed_title
USED_IN_ROUTES
=
%w[noteable issue notes issues rendered_title
commit pipelines merge_requests new]
.
freeze
RESERVED_WORDS
=
DynamicPathValidator
::
WILDCARD_ROUTES
-
USED_IN_ROUTES
RESERVED_WORDS_REGEX
=
Regexp
.
union
(
*
RESERVED_WORDS
)
...
...
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