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
Show 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
private
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
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'
RSpec
.
describe
Projects
::
Security
::
ScannedResourcesController
do
let_it_be
(
:user
)
{
create
(
:user
)
}
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
stub_licensed_features
(
dast:
true
,
security_dashboard:
true
)
...
...
@@ -30,13 +30,29 @@ RSpec.describe Projects::Security::ScannedResourcesController do
end
end
context
'when the pipeline id is missing'
do
let_it_be
(
:action_params
)
{
{
project_id:
project
,
namespace_id:
project
.
namespace
}
}
it
'returns the CSV data'
do
expect
(
subject
).
to
have_gitlab_http_status
(
:ok
)
expect
(
parsed_csv_data
.
size
).
to
be_positive
end
before
do
project
.
add_developer
(
user
)
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
it
'returns the CSV data'
do
expect
(
subject
).
to
have_gitlab_http_status
(
:ok
)
expect
(
parsed_csv_data
.
size
).
to
be_positive
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
expect
{
subject
}.
to
raise_error
(
ActionController
::
ParameterMissing
)
end
...
...
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