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
8d7e0955
Commit
8d7e0955
authored
Sep 01, 2020
by
Fabio Pitino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix use of `ci_pipelines` in favour of `all_pipelines`
parent
b2806985
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
7 deletions
+28
-7
ee/app/controllers/projects/security/scanned_resources_controller.rb
...rollers/projects/security/scanned_resources_controller.rb
+1
-1
ee/changelogs/unreleased/fix-use-of-ci_pipelines.yml
ee/changelogs/unreleased/fix-use-of-ci_pipelines.yml
+5
-0
ee/spec/controllers/projects/security/scanned_resources_controller_spec.rb
...rs/projects/security/scanned_resources_controller_spec.rb
+22
-6
No files found.
ee/app/controllers/projects/security/scanned_resources_controller.rb
View file @
8d7e0955
...
@@ -20,7 +20,7 @@ module Projects
...
@@ -20,7 +20,7 @@ module Projects
private
private
def
scanned_resources
def
scanned_resources
pipeline
=
project
.
ci
_pipelines
.
find
(
pipeline_id
)
pipeline
=
project
.
all
_pipelines
.
find
(
pipeline_id
)
@scanned_resources
=
pipeline
&
.
security_reports
&
.
reports
&
.
fetch
(
'dast'
,
nil
)
&
.
scanned_resources
@scanned_resources
=
pipeline
&
.
security_reports
&
.
reports
&
.
fetch
(
'dast'
,
nil
)
&
.
scanned_resources
return
if
@scanned_resources
return
if
@scanned_resources
...
...
ee/changelogs/unreleased/fix-use-of-ci_pipelines.yml
0 → 100644
View file @
8d7e0955
---
title
:
Allow on-demand DAST pipelines to be found for scanned resource
merge_request
:
40982
author
:
type
:
fixed
ee/spec/controllers/projects/security/scanned_resources_controller_spec.rb
View file @
8d7e0955
...
@@ -5,9 +5,9 @@ require 'spec_helper'
...
@@ -5,9 +5,9 @@ require 'spec_helper'
RSpec
.
describe
Projects
::
Security
::
ScannedResourcesController
do
RSpec
.
describe
Projects
::
Security
::
ScannedResourcesController
do
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:user
)
{
create
(
:user
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:project
)
{
create
(
:project
,
:repository
)
}
let_it_be
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
ref:
'master'
,
sha:
project
.
commit
.
id
)
}
let_it_be
(
:action_params
)
{
{
project_id:
project
,
namespace_id:
project
.
namespace
,
pipeline_id:
pipeline
}
}
let
(
:pipeline
)
{
create
(
:ci_pipeline
,
project:
project
,
ref:
'master'
,
sha:
project
.
commit
.
id
)
}
let
(
:action_params
)
{
{
project_id:
project
,
namespace_id:
project
.
namespace
,
pipeline_id:
pipeline
}
}
before
do
before
do
stub_licensed_features
(
dast:
true
,
security_dashboard:
true
)
stub_licensed_features
(
dast:
true
,
security_dashboard:
true
)
...
@@ -30,12 +30,28 @@ RSpec.describe Projects::Security::ScannedResourcesController do
...
@@ -30,12 +30,28 @@ RSpec.describe Projects::Security::ScannedResourcesController do
end
end
end
end
context
'when the pipeline id is missing'
do
it
'returns the CSV data'
do
let_it_be
(
:action_params
)
{
{
project_id:
project
,
namespace_id:
project
.
namespace
}
}
expect
(
subject
).
to
have_gitlab_http_status
(
:ok
)
expect
(
parsed_csv_data
.
size
).
to
be_positive
end
context
'when pipeline_id is from a dangling pipeline'
do
let
(
:pipeline
)
do
create
(
:ci_pipeline
,
source: :ondemand_dast_scan
,
project:
project
,
ref:
'master'
,
sha:
project
.
commit
.
id
)
end
before
do
it
'returns the CSV data'
do
project
.
add_developer
(
user
)
expect
(
subject
).
to
have_gitlab_http_status
(
:ok
)
expect
(
parsed_csv_data
.
size
).
to
be_positive
end
end
end
context
'when the pipeline id is missing'
do
let
(
:action_params
)
{
{
project_id:
project
,
namespace_id:
project
.
namespace
}
}
it
'raises an error when pipeline_id param is missing'
do
it
'raises an error when pipeline_id param is missing'
do
expect
{
subject
}.
to
raise_error
(
ActionController
::
ParameterMissing
)
expect
{
subject
}.
to
raise_error
(
ActionController
::
ParameterMissing
)
...
...
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