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
5fd9f9c9
Commit
5fd9f9c9
authored
May 26, 2021
by
Daniel Tian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix vuln scanner filter not working when report type has no scanner IDs
Changelog: fixed
parent
9091eaf7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
8 deletions
+20
-8
ee/app/assets/javascripts/security_dashboard/components/filters/scanner_filter.vue
.../security_dashboard/components/filters/scanner_filter.vue
+11
-2
ee/spec/frontend/security_dashboard/components/filters/scanner_filter_spec.js
...urity_dashboard/components/filters/scanner_filter_spec.js
+9
-6
No files found.
ee/app/assets/javascripts/security_dashboard/components/filters/scanner_filter.vue
View file @
5fd9f9c9
...
@@ -70,8 +70,17 @@ export default {
...
@@ -70,8 +70,17 @@ export default {
return
groups
;
return
groups
;
},
},
filterObject
()
{
filterObject
()
{
const
ids
=
this
.
selectedOptions
.
flatMap
((
x
)
=>
x
.
scannerIds
);
if
(
this
.
isNoOptionsSelected
)
{
return
{
scannerId
:
ids
.
map
((
x
)
=>
`
${
SCANNER_ID_PREFIX
}${
x
}
`
)
};
return
{
scannerId
:
[]
};
}
const
ids
=
this
.
selectedOptions
.
flatMap
(({
scannerIds
,
reportType
})
=>
{
return
scannerIds
.
length
?
scannerIds
.
map
((
id
)
=>
`
${
SCANNER_ID_PREFIX
}${
id
}
`
)
:
[
`
${
SCANNER_ID_PREFIX
}${
reportType
}
:null`
];
});
return
{
scannerId
:
ids
};
},
},
},
},
methods
:
{
methods
:
{
...
...
ee/spec/frontend/security_dashboard/components/filters/scanner_filter_spec.js
View file @
5fd9f9c9
...
@@ -24,12 +24,11 @@ const scanners = [
...
@@ -24,12 +24,11 @@ const scanners = [
createScannerConfig
(
DEFAULT_SCANNER
,
'
SAST
'
,
4
),
createScannerConfig
(
DEFAULT_SCANNER
,
'
SAST
'
,
4
),
createScannerConfig
(
DEFAULT_SCANNER
,
'
SECRET_DETECTION
'
,
5
),
createScannerConfig
(
DEFAULT_SCANNER
,
'
SECRET_DETECTION
'
,
5
),
createScannerConfig
(
DEFAULT_SCANNER
,
'
CONTAINER_SCANNING
'
,
6
),
createScannerConfig
(
DEFAULT_SCANNER
,
'
CONTAINER_SCANNING
'
,
6
),
createScannerConfig
(
DEFAULT_SCANNER
,
'
COVERAGE_FUZZING
'
,
7
),
createScannerConfig
(
DEFAULT_SCANNER
,
'
DAST
'
,
7
),
createScannerConfig
(
DEFAULT_SCANNER
,
'
DAST
'
,
8
),
createScannerConfig
(
DEFAULT_SCANNER
,
'
DAST
'
,
8
),
createScannerConfig
(
DEFAULT_SCANNER
,
'
D
AST
'
,
9
),
createScannerConfig
(
'
Custom
'
,
'
S
AST
'
,
9
),
createScannerConfig
(
'
Custom
'
,
'
SAST
'
,
10
),
createScannerConfig
(
'
Custom
'
,
'
SAST
'
,
10
),
createScannerConfig
(
'
Custom
'
,
'
SAST
'
,
11
),
createScannerConfig
(
'
Custom
'
,
'
DAST
'
,
11
),
createScannerConfig
(
'
Custom
'
,
'
DAST
'
,
12
),
];
];
describe
(
'
Scanner Filter component
'
,
()
=>
{
describe
(
'
Scanner Filter component
'
,
()
=>
{
...
@@ -104,14 +103,18 @@ describe('Scanner Filter component', () => {
...
@@ -104,14 +103,18 @@ describe('Scanner Filter component', () => {
});
});
it
(
'
emits filter-changed event with expected data for selected options
'
,
async
()
=>
{
it
(
'
emits filter-changed event with expected data for selected options
'
,
async
()
=>
{
const
ids
=
[
'
GitLab.SAST
'
,
'
Custom.SAST
'
];
const
ids
=
[
'
GitLab.SAST
'
,
'
Custom.SAST
'
,
'
GitLab.API_FUZZING
'
,
'
GitLab.COVERAGE_FUZZING
'
];
router
.
replace
({
query
:
{
[
scannerFilter
.
id
]:
ids
}
});
router
.
replace
({
query
:
{
[
scannerFilter
.
id
]:
ids
}
});
const
selectedScanners
=
scanners
.
filter
((
x
)
=>
ids
.
includes
(
`
${
x
.
vendor
}
.
${
x
.
report_type
}
`
));
const
selectedScanners
=
scanners
.
filter
((
x
)
=>
ids
.
includes
(
`
${
x
.
vendor
}
.
${
x
.
report_type
}
`
));
createWrapper
();
createWrapper
();
await
wrapper
.
vm
.
$nextTick
();
await
wrapper
.
vm
.
$nextTick
();
expect
(
wrapper
.
emitted
(
'
filter-changed
'
)[
0
][
0
]).
toEqual
({
expect
(
wrapper
.
emitted
(
'
filter-changed
'
)[
0
][
0
]).
toEqual
({
scannerId
:
selectedScanners
.
map
((
x
)
=>
`
${
SCANNER_ID_PREFIX
}${
x
.
id
}
`
),
scannerId
:
expect
.
arrayContaining
([
...
selectedScanners
.
map
((
x
)
=>
`
${
SCANNER_ID_PREFIX
}${
x
.
id
}
`
),
`
${
SCANNER_ID_PREFIX
}
COVERAGE_FUZZING:null`
,
`
${
SCANNER_ID_PREFIX
}
API_FUZZING:null`
,
]),
});
});
});
});
});
});
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