repo-forks: stable, security, fix issue when forging fork_repo_id could allow reading other people forks.

This commit is contained in:
Marcin Kuzminski 2017-10-26 10:14:38 +02:00
parent 3df3815e09
commit ce2de33a5a

View file

@ -163,10 +163,13 @@ class ForksController(BaseRepoController):
_form = RepoForkForm(old_data={'repo_type': c.repo_info.repo_type},
repo_groups=c.repo_groups_choices,
landing_revs=c.landing_revs_choices)()
post_data = dict(request.POST)
post_data['fork_parent_id'] = c.repo_info.repo_id
form_result = {}
task_id = None
try:
form_result = _form.to_python(dict(request.POST))
form_result = _form.to_python(post_data)
# create fork is done sometimes async on celery, db transaction
# management is handled there.
task = RepoModel().create_fork(