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
4e8364cd
Commit
4e8364cd
authored
Jan 07, 2019
by
Olivier Gonzalez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue creation permissions check
Ensure permissions are checked when creating issue from a vulnerability.
parent
258e73a8
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
0 deletions
+30
-0
ee/app/services/issues/create_from_vulnerability_data_service.rb
...services/issues/create_from_vulnerability_data_service.rb
+2
-0
ee/changelogs/unreleased/9072_fix_permission_check_when_creating_issue_from_vulnerability.yml
...rmission_check_when_creating_issue_from_vulnerability.yml
+5
-0
ee/spec/services/ee/issues/create_from_vulnerability_data_service_spec.rb
.../ee/issues/create_from_vulnerability_data_service_spec.rb
+23
-0
No files found.
ee/app/services/issues/create_from_vulnerability_data_service.rb
View file @
4e8364cd
...
...
@@ -3,6 +3,8 @@
module
Issues
class
CreateFromVulnerabilityDataService
<
::
BaseService
def
execute
return
error
(
"Can't create issue"
)
unless
can?
(
@current_user
,
:create_issue
,
@project
)
vulnerability
=
case
@params
[
:category
]
when
'sast'
,
'dependency_scanning'
,
'dast'
Gitlab
::
Vulnerabilities
::
StandardVulnerability
.
new
(
params
)
...
...
ee/changelogs/unreleased/9072_fix_permission_check_when_creating_issue_from_vulnerability.yml
0 → 100644
View file @
4e8364cd
---
title
:
Fix permission check when creating an issue from a vulnerability
merge_request
:
9055
author
:
type
:
fixed
ee/spec/services/ee/issues/create_from_vulnerability_data_service_spec.rb
View file @
4e8364cd
...
...
@@ -23,6 +23,29 @@ describe Issues::CreateFromVulnerabilityDataService, '#execute' do
end
end
context
'when user does not have permission to create issue'
do
let
(
:result
)
{
described_class
.
new
(
project
,
user
,
{}).
execute
}
before
do
allow_any_instance_of
(
described_class
).
to
receive
(
:can?
).
with
(
user
,
:create_issue
,
project
).
and_return
(
false
)
end
it
'returns expected error'
do
expect
(
result
[
:status
]).
to
eq
(
:error
)
expect
(
result
[
:message
]).
to
eq
(
"Can't create issue"
)
end
end
context
'when issues are disabled on project'
do
let
(
:result
)
{
described_class
.
new
(
project
,
user
,
{}).
execute
}
let
(
:project
)
{
create
(
:project
,
:public
,
namespace:
group
,
issues_access_level:
ProjectFeature
::
DISABLED
)
}
it
'returns expected error'
do
expect
(
result
[
:status
]).
to
eq
(
:error
)
expect
(
result
[
:message
]).
to
eq
(
"Can't create issue"
)
end
end
context
'when params are valid'
do
context
'when category is SAST'
do
context
'when a description is present'
do
...
...
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