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
0b324d34
Commit
0b324d34
authored
Mar 20, 2019
by
Małgorzata Ksionek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Disallow changing namespace of a project in update method
parent
37bd7aa6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
5 deletions
+30
-5
app/controllers/projects_controller.rb
app/controllers/projects_controller.rb
+8
-5
changelogs/unreleased/security-mass-assignment-on-project-update.yml
...unreleased/security-mass-assignment-on-project-update.yml
+5
-0
spec/controllers/projects_controller_spec.rb
spec/controllers/projects_controller_spec.rb
+17
-0
No files found.
app/controllers/projects_controller.rb
View file @
0b324d34
...
@@ -47,7 +47,7 @@ class ProjectsController < Projects::ApplicationController
...
@@ -47,7 +47,7 @@ class ProjectsController < Projects::ApplicationController
end
end
def
create
def
create
@project
=
::
Projects
::
CreateService
.
new
(
current_user
,
project_params
).
execute
@project
=
::
Projects
::
CreateService
.
new
(
current_user
,
project_params
(
attributes:
project_params_create_attributes
)
).
execute
if
@project
.
saved?
if
@project
.
saved?
cookies
[
:issue_board_welcome_hidden
]
=
{
path:
project_path
(
@project
),
value:
nil
,
expires:
Time
.
at
(
0
)
}
cookies
[
:issue_board_welcome_hidden
]
=
{
path:
project_path
(
@project
),
value:
nil
,
expires:
Time
.
at
(
0
)
}
...
@@ -328,9 +328,9 @@ class ProjectsController < Projects::ApplicationController
...
@@ -328,9 +328,9 @@ class ProjectsController < Projects::ApplicationController
end
end
# rubocop: enable CodeReuse/ActiveRecord
# rubocop: enable CodeReuse/ActiveRecord
def
project_params
def
project_params
(
attributes:
project_params_attributes
)
params
.
require
(
:project
)
params
.
require
(
:project
)
.
permit
(
project_params_
attributes
)
.
permit
(
attributes
)
end
end
def
project_params_attributes
def
project_params_attributes
...
@@ -349,11 +349,10 @@ class ProjectsController < Projects::ApplicationController
...
@@ -349,11 +349,10 @@ class ProjectsController < Projects::ApplicationController
:last_activity_at
,
:last_activity_at
,
:lfs_enabled
,
:lfs_enabled
,
:name
,
:name
,
:namespace_id
,
:only_allow_merge_if_all_discussions_are_resolved
,
:only_allow_merge_if_all_discussions_are_resolved
,
:only_allow_merge_if_pipeline_succeeds
,
:only_allow_merge_if_pipeline_succeeds
,
:printing_merge_request_link_enabled
,
:path
,
:path
,
:printing_merge_request_link_enabled
,
:public_builds
,
:public_builds
,
:request_access_enabled
,
:request_access_enabled
,
:runners_token
,
:runners_token
,
...
@@ -375,6 +374,10 @@ class ProjectsController < Projects::ApplicationController
...
@@ -375,6 +374,10 @@ class ProjectsController < Projects::ApplicationController
]
]
end
end
def
project_params_create_attributes
project_params_attributes
<<
:namespace_id
end
def
custom_import_params
def
custom_import_params
{}
{}
end
end
...
...
changelogs/unreleased/security-mass-assignment-on-project-update.yml
0 → 100644
View file @
0b324d34
---
title
:
Disallow updating namespace during updating project
merge_request
:
author
:
type
:
security
spec/controllers/projects_controller_spec.rb
View file @
0b324d34
...
@@ -369,6 +369,23 @@ describe ProjectsController do
...
@@ -369,6 +369,23 @@ describe ProjectsController do
end
end
end
end
it
'does not update namespace'
do
controller
.
instance_variable_set
(
:@project
,
project
)
params
=
{
namespace_id:
'test'
}
expect
do
put
:update
,
params:
{
namespace_id:
project
.
namespace
,
id:
project
.
id
,
project:
params
}
end
.
not_to
change
{
project
.
namespace
}
end
def
update_project
(
**
parameters
)
def
update_project
(
**
parameters
)
put
:update
,
put
:update
,
params:
{
params:
{
...
...
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