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
9ac115c3
Commit
9ac115c3
authored
Nov 27, 2019
by
Tetiana Chupryna
Committed by
James Lopez
Nov 27, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add policy for security findings
parent
732de68b
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
1 deletion
+51
-1
ee/app/policies/ee/project_policy.rb
ee/app/policies/ee/project_policy.rb
+2
-0
ee/spec/policies/project_policy_spec.rb
ee/spec/policies/project_policy_spec.rb
+49
-1
No files found.
ee/app/policies/ee/project_policy.rb
View file @
9ac115c3
...
...
@@ -150,6 +150,8 @@ module EE
rule
{
can?
(
:public_access
)
}.
enable
:read_package
rule
{
can?
(
:read_project
)
&
can?
(
:read_build
)
}.
enable
:read_security_findings
rule
{
can?
(
:developer_access
)
}.
policy
do
enable
:read_project_security_dashboard
end
...
...
ee/spec/policies/project_policy_spec.rb
View file @
9ac115c3
...
...
@@ -47,7 +47,7 @@ describe ProjectPolicy do
read_environment read_deployment read_merge_request read_pages
create_merge_request_in award_emoji
read_project_security_dashboard read_vulnerability
read_vulnerability_feedback read_software_license_policy
read_vulnerability_feedback read_s
ecurity_findings read_s
oftware_license_policy
]
end
...
...
@@ -411,6 +411,54 @@ describe ProjectPolicy do
end
end
describe
'read_security_findings'
do
context
'with private project'
do
let
(
:project
)
{
create
(
:project
,
:private
,
namespace:
owner
.
namespace
)
}
context
'with guest or above'
do
let
(
:current_user
)
{
guest
}
it
{
is_expected
.
to
be_allowed
(
:read_security_findings
)
}
end
context
'with non member'
do
let
(
:current_user
)
{
create
(
:user
)
}
it
{
is_expected
.
to
be_disallowed
(
:read_security_findings
)
}
end
context
'with anonymous'
do
let
(
:current_user
)
{
nil
}
it
{
is_expected
.
to
be_disallowed
(
:read_security_findings
)
}
end
end
context
'with public project'
do
let
(
:current_user
)
{
create
(
:user
)
}
context
'with limited access to builds'
do
context
'when builds enabled only for project members'
do
let
(
:project
)
{
create
(
:project
,
:public
,
:builds_private
)
}
it
{
is_expected
.
not_to
be_allowed
(
:read_security_findings
)
}
end
context
'when public builds disabled'
do
let
(
:project
)
{
create
(
:project
,
:public
,
public_builds:
false
)
}
it
{
is_expected
.
not_to
be_allowed
(
:read_security_findings
)
}
end
end
context
'with public access to repository'
do
let
(
:project
)
{
create
(
:project
,
:public
)
}
it
{
is_expected
.
to
be_allowed
(
:read_security_findings
)
}
end
end
end
describe
'vulnerability feedback permissions'
do
subject
{
described_class
.
new
(
current_user
,
project
)
}
...
...
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