Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
1e6410cd
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1e6410cd
编写于
7月 26, 2019
作者:
G
GitLab Release Tools Bot
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'security-mr-pipeline-permissions-12-1' into '12-1-stable'
MR pipeline permissions See merge request gitlab/gitlabhq!3281
上级
cd66293d
70676286
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
102 addition
and
6 deletion
+102
-6
app/controllers/projects/merge_requests/application_controller.rb
...rollers/projects/merge_requests/application_controller.rb
+1
-1
app/controllers/projects/merge_requests_controller.rb
app/controllers/projects/merge_requests_controller.rb
+2
-1
changelogs/unreleased/security-mr-pipeline-permissions.yml
changelogs/unreleased/security-mr-pipeline-permissions.yml
+5
-0
spec/controllers/projects/merge_requests_controller_spec.rb
spec/controllers/projects/merge_requests_controller_spec.rb
+94
-4
未找到文件。
app/controllers/projects/merge_requests/application_controller.rb
浏览文件 @
1e6410cd
...
...
@@ -45,7 +45,7 @@ class Projects::MergeRequests::ApplicationController < Projects::ApplicationCont
def
set_pipeline_variables
@pipelines
=
if
can?
(
current_user
,
:read_pipeline
,
@project
)
if
can?
(
current_user
,
:read_pipeline
,
@
merge_request
.
source_
project
)
@merge_request
.
all_pipelines
else
Ci
::
Pipeline
.
none
...
...
app/controllers/projects/merge_requests_controller.rb
浏览文件 @
1e6410cd
...
...
@@ -82,7 +82,8 @@ class Projects::MergeRequestsController < Projects::MergeRequests::ApplicationCo
end
def
pipelines
@pipelines
=
@merge_request
.
all_pipelines
.
page
(
params
[
:page
]).
per
(
30
)
set_pipeline_variables
@pipelines
=
@pipelines
.
page
(
params
[
:page
]).
per
(
30
)
Gitlab
::
PollingInterval
.
set_header
(
response
,
interval:
10_000
)
...
...
changelogs/unreleased/security-mr-pipeline-permissions.yml
0 → 100644
浏览文件 @
1e6410cd
---
title
:
Use source project as permissions reference for MergeRequestsController#pipelines
merge_request
:
author
:
type
:
security
spec/controllers/projects/merge_requests_controller_spec.rb
浏览文件 @
1e6410cd
...
...
@@ -621,10 +621,100 @@ describe Projects::MergeRequestsController do
format: :json
end
it
'responds with serialized pipelines'
do
expect
(
json_response
[
'pipelines'
]).
not_to
be_empty
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
1
expect
(
response
).
to
include_pagination_headers
context
'with "enabled" builds on a public project'
do
let
(
:project
)
{
create
(
:project
,
:repository
,
:public
)
}
context
'for a project owner'
do
it
'responds with serialized pipelines'
do
expect
(
json_response
[
'pipelines'
]).
to
be_present
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
(
1
)
expect
(
response
).
to
include_pagination_headers
end
end
context
'for an unassociated user'
do
let
(
:user
)
{
create
:user
}
it
'responds with no pipelines'
do
expect
(
json_response
[
'pipelines'
]).
to
be_present
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
(
1
)
expect
(
response
).
to
include_pagination_headers
end
end
end
context
'with private builds on a public project'
do
let
(
:project
)
{
create
(
:project
,
:repository
,
:public
,
:builds_private
)
}
context
'for a project owner'
do
it
'responds with serialized pipelines'
do
expect
(
json_response
[
'pipelines'
]).
to
be_present
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
(
1
)
expect
(
response
).
to
include_pagination_headers
end
end
context
'for an unassociated user'
do
let
(
:user
)
{
create
:user
}
it
'responds with no pipelines'
do
expect
(
json_response
[
'pipelines'
]).
to
be_empty
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
(
0
)
expect
(
response
).
to
include_pagination_headers
end
end
context
'from a project fork'
do
let
(
:fork_user
)
{
create
:user
}
let
(
:forked_project
)
{
fork_project
(
project
,
fork_user
,
repository:
true
)
}
# Forked project carries over :builds_private
let
(
:merge_request
)
{
create
(
:merge_request_with_diffs
,
target_project:
project
,
source_project:
forked_project
)
}
context
'with private builds'
do
context
'for the target project member'
do
it
'does not respond with serialized pipelines'
do
expect
(
json_response
[
'pipelines'
]).
to
be_empty
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
(
0
)
expect
(
response
).
to
include_pagination_headers
end
end
context
'for the source project member'
do
let
(
:user
)
{
fork_user
}
it
'responds with serialized pipelines'
do
expect
(
json_response
[
'pipelines'
]).
to
be_present
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
(
1
)
expect
(
response
).
to
include_pagination_headers
end
end
end
context
'with public builds'
do
let
(
:forked_project
)
do
fork_project
(
project
,
fork_user
,
repository:
true
).
tap
do
|
new_project
|
new_project
.
project_feature
.
update
(
builds_access_level:
ProjectFeature
::
ENABLED
)
end
end
context
'for the target project member'
do
it
'does not respond with serialized pipelines'
do
expect
(
json_response
[
'pipelines'
]).
to
be_present
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
(
1
)
expect
(
response
).
to
include_pagination_headers
end
end
context
'for the source project member'
do
let
(
:user
)
{
fork_user
}
it
'responds with serialized pipelines'
do
expect
(
json_response
[
'pipelines'
]).
to
be_present
expect
(
json_response
[
'count'
][
'all'
]).
to
eq
(
1
)
expect
(
response
).
to
include_pagination_headers
end
end
end
end
end
end
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录