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
230e1c02
Commit
230e1c02
authored
Dec 10, 2019
by
John T Skarbek
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'dev/master'
parents
a4f730c5
4bcea37c
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
93 additions
and
2 deletions
+93
-2
CHANGELOG-EE.md
CHANGELOG-EE.md
+14
-0
CHANGELOG.md
CHANGELOG.md
+14
-0
app/services/groups/transfer_service.rb
app/services/groups/transfer_service.rb
+14
-1
changelogs/unreleased/security-400-path-traversal-rce2.yml
changelogs/unreleased/security-400-path-traversal-rce2.yml
+5
-0
ee/app/services/ee/groups/transfer_service.rb
ee/app/services/ee/groups/transfer_service.rb
+18
-0
ee/lib/ee/gitlab/regex.rb
ee/lib/ee/gitlab/regex.rb
+1
-1
ee/spec/lib/gitlab/regex_spec.rb
ee/spec/lib/gitlab/regex_spec.rb
+1
-0
ee/spec/services/groups/transfer_service_spec.rb
ee/spec/services/groups/transfer_service_spec.rb
+26
-0
No files found.
CHANGELOG-EE.md
View file @
230e1c02
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
## 12.5.4
### Security (1 change)
-
Fix stale Elasticsearch permissions when moving group from public group to private parent group.
## 12.5.3
## 12.5.3
### Performance (1 change)
### Performance (1 change)
...
@@ -251,6 +258,13 @@ Please view this file on the master branch, on stable branches it's out of date.
...
@@ -251,6 +258,13 @@ Please view this file on the master branch, on stable branches it's out of date.
-
Docs for protected branch code owner approval API. !17132
-
Docs for protected branch code owner approval API. !17132
## 12.3.9
### Security (1 change)
-
Fix stale Elasticsearch permissions when moving group from public group to private parent group.
## 12.3.7
## 12.3.7
### Security (6 changes)
### Security (6 changes)
...
...
CHANGELOG.md
View file @
230e1c02
...
@@ -2,6 +2,13 @@
...
@@ -2,6 +2,13 @@
documentation
](
doc/development/changelog.md
)
for instructions on adding your own
documentation
](
doc/development/changelog.md
)
for instructions on adding your own
entry.
entry.
## 12.5.4
### Security (1 change)
-
Update maven_file_name_regex for full string match.
## 12.5.3
## 12.5.3
### Fixed (4 changes)
### Fixed (4 changes)
...
@@ -756,6 +763,13 @@ entry.
...
@@ -756,6 +763,13 @@ entry.
-
Remove Postgresql specific setup tasks and move to schema.rb.
-
Remove Postgresql specific setup tasks and move to schema.rb.
## 12.3.9
### Security (1 change)
-
Update maven_file_name_regex for full string match.
## 12.3.7
## 12.3.7
### Security (12 changes)
### Security (12 changes)
...
...
app/services/groups/transfer_service.rb
View file @
230e1c02
...
@@ -39,9 +39,15 @@ module Groups
...
@@ -39,9 +39,15 @@ module Groups
ensure_ownership
ensure_ownership
end
end
post_update_hooks
(
@updated_project_ids
)
true
true
end
end
# Overridden in EE
def
post_update_hooks
(
updated_project_ids
)
end
def
ensure_allowed_transfer
def
ensure_allowed_transfer
raise_transfer_error
(
:group_is_already_root
)
if
group_is_already_root?
raise_transfer_error
(
:group_is_already_root
)
if
group_is_already_root?
raise_transfer_error
(
:same_parent_as_current
)
if
same_parent?
raise_transfer_error
(
:same_parent_as_current
)
if
same_parent?
...
@@ -96,9 +102,16 @@ module Groups
...
@@ -96,9 +102,16 @@ module Groups
.
where
(
id:
descendants
.
select
(
:id
))
.
where
(
id:
descendants
.
select
(
:id
))
.
update_all
(
visibility_level:
@new_parent_group
.
visibility_level
)
.
update_all
(
visibility_level:
@new_parent_group
.
visibility_level
)
@group
projects_to_update
=
@group
.
all_projects
.
all_projects
.
where
(
"visibility_level > ?"
,
@new_parent_group
.
visibility_level
)
.
where
(
"visibility_level > ?"
,
@new_parent_group
.
visibility_level
)
# Used in post_update_hooks in EE. Must use pluck (and not select)
# here as after we perform the update below we won't be able to find
# these records again.
@updated_project_ids
=
projects_to_update
.
pluck
(
:id
)
projects_to_update
.
update_all
(
visibility_level:
@new_parent_group
.
visibility_level
)
.
update_all
(
visibility_level:
@new_parent_group
.
visibility_level
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
...
...
changelogs/unreleased/security-400-path-traversal-rce2.yml
0 → 100644
View file @
230e1c02
---
title
:
Update maven_file_name_regex for full string match
merge_request
:
author
:
type
:
security
ee/app/services/ee/groups/transfer_service.rb
View file @
230e1c02
...
@@ -22,6 +22,24 @@ module EE
...
@@ -22,6 +22,24 @@ module EE
end
end
end
end
override
:post_update_hooks
# rubocop: disable CodeReuse/ActiveRecord
def
post_update_hooks
(
updated_project_ids
)
::
Project
.
where
(
id:
updated_project_ids
).
find_each
do
|
project
|
# TODO: Refactor out this duplication per https://gitlab.com/gitlab-org/gitlab/issues/38232
if
::
Gitlab
::
CurrentSettings
.
elasticsearch_indexing?
&&
project
.
searchable?
ElasticIndexerWorker
.
perform_async
(
:update
,
project
.
class
.
to_s
,
project
.
id
,
project
.
es_id
,
changed_fields:
[
'visibility_level'
]
)
end
end
end
# rubocop: enable CodeReuse/ActiveRecord
def
raise_ee_transfer_error
(
message
)
def
raise_ee_transfer_error
(
message
)
raise
::
Groups
::
TransferService
::
TransferError
,
EE_ERROR_MESSAGES
[
message
]
raise
::
Groups
::
TransferService
::
TransferError
,
EE_ERROR_MESSAGES
[
message
]
end
end
...
...
ee/lib/ee/gitlab/regex.rb
View file @
230e1c02
...
@@ -28,7 +28,7 @@ module EE
...
@@ -28,7 +28,7 @@ module EE
end
end
def
maven_file_name_regex
def
maven_file_name_regex
@maven_file_name_regex
||=
%r{
^[A-Za-z0-9
\.\_\-\+
]+$
}
.
freeze
@maven_file_name_regex
||=
%r{
\A
[A-Za-z0-9
\.\_\-\+
]+
\z
}
.
freeze
end
end
def
maven_path_regex
def
maven_path_regex
...
...
ee/spec/lib/gitlab/regex_spec.rb
View file @
230e1c02
...
@@ -67,6 +67,7 @@ describe Gitlab::Regex do
...
@@ -67,6 +67,7 @@ describe Gitlab::Regex do
it
{
is_expected
.
not_to
match
(
'@@foo/bar'
)
}
it
{
is_expected
.
not_to
match
(
'@@foo/bar'
)
}
it
{
is_expected
.
not_to
match
(
'my package name'
)
}
it
{
is_expected
.
not_to
match
(
'my package name'
)
}
it
{
is_expected
.
not_to
match
(
'!!()()'
)
}
it
{
is_expected
.
not_to
match
(
'!!()()'
)
}
it
{
is_expected
.
not_to
match
(
"..
\n
..
\f
oo"
)
}
end
end
describe
'.maven_file_name_regex'
do
describe
'.maven_file_name_regex'
do
...
...
ee/spec/services/groups/transfer_service_spec.rb
View file @
230e1c02
...
@@ -52,4 +52,30 @@ describe Groups::TransferService, '#execute' do
...
@@ -52,4 +52,30 @@ describe Groups::TransferService, '#execute' do
end
end
end
end
end
end
context
'when visibility changes'
do
let
(
:new_group
)
{
create
(
:group
,
:private
)
}
before
do
stub_ee_application_setting
(
elasticsearch_indexing:
true
)
end
it
'reindexes projects'
do
project1
=
create
(
:project
,
:repository
,
:public
,
namespace:
group
)
project2
=
create
(
:project
,
:repository
,
:public
,
namespace:
group
)
project3
=
create
(
:project
,
:repository
,
:private
,
namespace:
group
)
expect
(
ElasticIndexerWorker
).
to
receive
(
:perform_async
)
.
with
(
:update
,
"Project"
,
project1
.
id
,
project1
.
es_id
,
changed_fields:
array_including
(
'visibility_level'
))
expect
(
ElasticIndexerWorker
).
to
receive
(
:perform_async
)
.
with
(
:update
,
"Project"
,
project2
.
id
,
project2
.
es_id
,
changed_fields:
array_including
(
'visibility_level'
))
expect
(
ElasticIndexerWorker
).
not_to
receive
(
:perform_async
)
.
with
(
:update
,
"Project"
,
project3
.
id
,
project3
.
es_id
,
changed_fields:
array_including
(
'visibility_level'
))
transfer_service
.
execute
(
new_group
)
expect
(
transfer_service
.
error
).
not_to
be
expect
(
group
.
parent
).
to
eq
(
new_group
)
end
end
end
end
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