Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
a01497b0
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,体验更适合开发者的 AI 搜索 >>
提交
a01497b0
编写于
4月 27, 2020
作者:
G
GitLab Bot
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add latest changes from gitlab-org/security/gitlab@12-8-stable-ee
上级
ec3f4810
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
29 addition
and
5 deletion
+29
-5
app/helpers/projects_helper.rb
app/helpers/projects_helper.rb
+1
-0
changelogs/unreleased/bug-codeowner-diffs.yml
changelogs/unreleased/bug-codeowner-diffs.yml
+5
-0
changelogs/unreleased/security-branch-permissions.yml
changelogs/unreleased/security-branch-permissions.yml
+5
-0
spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
+18
-5
未找到文件。
app/helpers/projects_helper.rb
浏览文件 @
a01497b0
...
...
@@ -614,6 +614,7 @@ module ProjectsHelper
def
find_file_path
return
unless
@project
&&
!
@project
.
empty_repo?
return
unless
can?
(
current_user
,
:download_code
,
@project
)
ref
=
@ref
||
@project
.
repository
.
root_ref
...
...
changelogs/unreleased/bug-codeowner-diffs.yml
0 → 100644
浏览文件 @
a01497b0
---
title
:
Ensure MR diff exists before codeowner check
merge_request
:
author
:
type
:
security
changelogs/unreleased/security-branch-permissions.yml
0 → 100644
浏览文件 @
a01497b0
---
title
:
Prevent unauthorized access to default branch
merge_request
:
author
:
type
:
security
spec/helpers/application_helper_spec.rb
浏览文件 @
a01497b0
...
...
@@ -277,11 +277,16 @@ describe ApplicationHelper do
end
context
'when @project is set'
do
it
'includes all possible body data elements and associates the project elements with project'
do
project
=
create
(
:project
)
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
before
do
assign
(
:project
,
project
)
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
nil
)
end
it
'includes all possible body data elements and associates the project elements with project'
do
expect
(
helper
).
to
receive
(
:can?
).
with
(
nil
,
:download_code
,
project
)
expect
(
helper
.
body_data
).
to
eq
(
{
page:
'application'
,
...
...
@@ -302,12 +307,11 @@ describe ApplicationHelper do
context
'when params[:id] is present and the issue exsits and action_name is show'
do
it
'sets all project and id elements correctly related to the issue'
do
issue
=
create
(
:issue
)
issue
=
create
(
:issue
,
project:
project
)
stub_controller_method
(
:action_name
,
'show'
)
stub_controller_method
(
:params
,
{
id:
issue
.
id
})
assign
(
:project
,
issue
.
project
)
expect
(
helper
).
to
receive
(
:can?
).
with
(
nil
,
:download_code
,
project
).
and_return
(
false
)
expect
(
helper
.
body_data
).
to
eq
(
{
page:
'projects:issues:show'
,
...
...
@@ -322,6 +326,15 @@ describe ApplicationHelper do
end
end
end
context
'when current_user has download_code permission'
do
it
'returns find_file with the default branch'
do
allow
(
helper
).
to
receive
(
:current_user
).
and_return
(
user
)
expect
(
helper
).
to
receive
(
:can?
).
with
(
user
,
:download_code
,
project
).
and_return
(
true
)
expect
(
helper
.
body_data
[
:find_file
]).
to
end_with
(
project
.
default_branch
)
end
end
end
def
stub_controller_method
(
method_name
,
value
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录