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
3ca43788
Commit
3ca43788
authored
Nov 10, 2020
by
Alexander Turinske
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix missing styling
- break out string into two strings - update tests
parent
eb978c52
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
248 additions
and
148 deletions
+248
-148
ee/app/assets/javascripts/vue_shared/security_reports/components/security_summary.vue
...e_shared/security_reports/components/security_summary.vue
+29
-9
ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue
..._shared/security_reports/grouped_security_reports_app.vue
+0
-1
ee/app/assets/javascripts/vue_shared/security_reports/store/utils.js
...ts/javascripts/vue_shared/security_reports/store/utils.js
+26
-23
ee/spec/frontend/vue_mr_widget/ee_mr_widget_options_spec.js
ee/spec/frontend/vue_mr_widget/ee_mr_widget_options_spec.js
+19
-13
ee/spec/frontend/vue_shared/components/security_reports/__snapshots__/security_summary_spec.js.snap
...urity_reports/__snapshots__/security_summary_spec.js.snap
+93
-55
ee/spec/frontend/vue_shared/security_reports/grouped_security_reports_app_spec.js
...red/security_reports/grouped_security_reports_app_spec.js
+44
-24
ee/spec/frontend/vue_shared/security_reports/store/modules/sast/getters_spec.js
...hared/security_reports/store/modules/sast/getters_spec.js
+3
-1
ee/spec/frontend/vue_shared/security_reports/store/utils_spec.js
.../frontend/vue_shared/security_reports/store/utils_spec.js
+29
-20
locale/gitlab.pot
locale/gitlab.pot
+5
-2
No files found.
ee/app/assets/javascripts/vue_shared/security_reports/components/security_summary.vue
View file @
3ca43788
...
...
@@ -12,28 +12,48 @@ export default {
required
:
true
,
},
},
computed
:
{
shouldShowCountMessage
()
{
return
!
this
.
message
.
status
&&
Boolean
(
this
.
message
.
countMessage
);
},
},
methods
:
{
getSeverityClass
(
severity
)
{
return
SEVERITY_CLASS_NAME_MAP
[
severity
];
},
},
slotNames
:
[
'
critical
'
,
'
high
'
,
'
other
'
],
spacingClasses
:
{
critical
:
'
gl-pl-4
'
,
high
:
'
gl-px-2
'
,
other
:
'
gl-px-2
'
,
},
};
</
script
>
<
template
>
<span>
<gl-sprintf
:message=
"message.message"
>
<template
#
count
="
{content}">
<template
#
total
="
{content}">
<strong>
{{
content
}}
</strong>
</
template
>
<
template
v-for=
"slotName in ['critical', 'high', 'other']"
#[slotName]=
"{content}"
>
</gl-sprintf>
<span
v-if=
"shouldShowCountMessage"
class=
"gl-font-sm"
>
<gl-sprintf
:message=
"message.countMessage"
>
<
template
v-for=
"slotName in $options.slotNames"
#[slotName]=
"{content}"
>
<span
:key=
"slotName"
>
<strong
v-if=
"Boolean(message[slotName])"
:class=
"getSeverityClass(slotName)"
>
<strong
v-if=
"message[slotName] > 0"
:class=
"[getSeverityClass(slotName), $options.spacingClasses[slotName]]"
>
{{
content
}}
</strong>
<span
v-else
>
{{
content
}}
</span>
<span
v-else
:class=
"$options.spacingClasses[slotName]"
>
{{
content
}}
</span>
</span>
</
template
>
</gl-sprintf>
</span>
</span>
</template>
ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue
View file @
3ca43788
...
...
@@ -555,7 +555,6 @@ export default {
<
template
v-if=
"hasCoverageFuzzingReports"
>
<summary-row
:summary=
"groupedCoverageFuzzingText.message"
:status-icon=
"coverageFuzzingStatusIcon"
:popover-options=
"coverageFuzzingPopover"
class=
"js-coverage-fuzzing-widget"
...
...
ee/app/assets/javascripts/vue_shared/security_reports/store/utils.js
View file @
3ca43788
...
...
@@ -9,6 +9,29 @@ import { __, n__, sprintf } from '~/locale';
export
const
findIssueIndex
=
(
issues
,
issue
)
=>
issues
.
findIndex
(
el
=>
el
.
project_fingerprint
===
issue
.
project_fingerprint
);
const
createCountMessage
=
({
critical
,
high
,
other
,
total
})
=>
{
const
otherMessage
=
n__
(
'
%d Other
'
,
'
%d Others
'
,
other
);
const
countMessage
=
__
(
'
%{criticalStart}%{critical} Critical%{criticalEnd} %{highStart}%{high} High%{highEnd} and %{otherStart}%{otherMessage}%{otherEnd}
'
,
);
return
total
?
sprintf
(
countMessage
,
{
critical
,
high
,
otherMessage
})
:
''
;
};
const
createStatusMessage
=
({
reportType
,
status
,
total
})
=>
{
const
vulnMessage
=
n__
(
'
vulnerability
'
,
'
vulnerabilities
'
,
total
);
let
message
;
if
(
status
)
{
message
=
__
(
'
%{reportType} %{status}
'
);
}
else
if
(
!
total
)
{
message
=
__
(
'
%{reportType} detected %{totalStart}no%{totalEnd} vulnerabilities.
'
);
}
else
{
message
=
__
(
'
%{reportType} detected %{totalStart}%{total}%{totalEnd} potential %{vulnMessage}
'
,
);
}
return
sprintf
(
message
,
{
reportType
,
status
,
total
,
vulnMessage
});
};
/**
* Takes an object of options and returns the object with an externalized string representing
* the critical, high, and other severity vulnerabilities for a given report.
...
...
@@ -27,35 +50,15 @@ export const groupedTextBuilder = ({
other
=
0
,
}
=
{})
=>
{
const
total
=
critical
+
high
+
other
;
const
vulnMessage
=
n__
(
'
vulnerability
'
,
'
vulnerabilities
'
,
total
);
const
otherMessage
=
n__
(
'
%d Other
'
,
'
%d Others
'
,
other
);
let
message
;
if
(
status
)
{
message
=
__
(
'
%{reportType} %{status}
'
);
}
else
if
(
!
total
)
{
message
=
__
(
'
%{reportType} detected %{countStart}no%{countEnd} vulnerabilities.
'
);
}
else
{
message
=
__
(
'
%{reportType} detected %{countStart}%{total}%{countEnd} potential %{vulnMessage} %{criticalStart}%{critical} critical%{criticalEnd} %{highStart}%{high} high%{highEnd} and %{otherStart}%{otherMessage}%{otherEnd}
'
,
);
}
return
{
message
:
sprintf
(
message
,
{
critical
,
high
,
otherMessage
,
reportType
,
status
,
total
,
vulnMessage
,
}).
replace
(
/
\s\s
+/g
,
'
'
),
countMessage
:
createCountMessage
({
critical
,
high
,
other
,
total
}),
message
:
createStatusMessage
({
reportType
,
status
,
total
}),
critical
,
high
,
other
,
status
,
total
,
};
};
...
...
ee/spec/frontend/vue_mr_widget/ee_mr_widget_options_spec.js
View file @
3ca43788
...
...
@@ -140,7 +140,7 @@ describe('ee merge request widget options', () => {
`
${
SAST_SELECTOR
}
.report-block-list-issue-description`
,
).
textContent
,
),
).
toEqual
(
'
SAST detected 1 potential vulnerability 1
critical 0 h
igh and 0 Others
'
);
).
toEqual
(
'
SAST detected 1 potential vulnerability 1
Critical 0 H
igh and 0 Others
'
);
done
();
});
});
...
...
@@ -235,8 +235,8 @@ describe('ee merge request widget options', () => {
`
${
DEPENDENCY_SCANNING_SELECTOR
}
.report-block-list-issue-description`
,
).
textContent
,
),
).
to
Contain
(
'
Dependency scanning detected 2 potential vulnerabilities 1
critical 1 h
igh and 0 Others
'
,
).
to
Equal
(
'
Dependency scanning detected 2 potential vulnerabilities 1
Critical 1 H
igh and 0 Others
'
,
);
done
();
});
...
...
@@ -663,7 +663,7 @@ describe('ee merge request widget options', () => {
).
textContent
,
),
).
toEqual
(
'
Container scanning detected 2 potential vulnerabilities 1
critical 1 h
igh and 0 Others
'
,
'
Container scanning detected 2 potential vulnerabilities 1
Critical 1 H
igh and 0 Others
'
,
);
done
();
});
...
...
@@ -734,10 +734,12 @@ describe('ee merge request widget options', () => {
it
(
'
should render provided data
'
,
done
=>
{
setImmediate
(()
=>
{
expect
(
findExtendedSecurityWidget
()
.
querySelector
(
`
${
DAST_SELECTOR
}
.report-block-list-issue-description`
)
.
textContent
.
trim
(),
).
toContain
(
'
DAST detected 1 potential vulnerability
'
);
trimText
(
findExtendedSecurityWidget
().
querySelector
(
`
${
DAST_SELECTOR
}
.report-block-list-issue-description`
,
).
textContent
,
),
).
toEqual
(
'
DAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others
'
);
done
();
});
});
...
...
@@ -810,10 +812,14 @@ describe('ee merge request widget options', () => {
it
(
'
should render provided data
'
,
done
=>
{
setImmediate
(()
=>
{
expect
(
findExtendedSecurityWidget
()
.
querySelector
(
`
${
COVERAGE_FUZZING_SELECTOR
}
.report-block-list-issue-description`
)
.
textContent
.
trim
(),
).
toContain
(
'
Coverage fuzzing detected 2 potential vulnerabilities
'
);
trimText
(
findExtendedSecurityWidget
().
querySelector
(
`
${
COVERAGE_FUZZING_SELECTOR
}
.report-block-list-issue-description`
,
).
textContent
,
),
).
toEqual
(
'
Coverage fuzzing detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others
'
,
);
done
();
});
});
...
...
@@ -889,7 +895,7 @@ describe('ee merge request widget options', () => {
).
textContent
,
),
).
toEqual
(
'
Secret scanning detected 2 potential vulnerabilities 1
critical 1 h
igh and 0 Others
'
,
'
Secret scanning detected 2 potential vulnerabilities 1
Critical 1 H
igh and 0 Others
'
,
);
done
();
});
...
...
ee/spec/frontend/vue_shared/components/security_reports/__snapshots__/security_summary_spec.js.snap
View file @
3ca43788
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Severity Summary given the message {"c
ritical": 0, "high": 1, "message": "Security scanning detected %{countStart}1%{countEnd} potential vulnerability %{criticalStart}0 critical%{criticalEnd} %{highStart}1 high%{highEnd} and %{otherStart}0 Others%{otherEnd}", "other": 0, "status": ""
} interpolates correctly 1`] = `
exports[`Severity Summary given the message {"c
ountMessage": "%{criticalStart}0 Critical%{criticalEnd} %{highStart}1 High%{highEnd} and %{otherStart}0 Others%{otherEnd}", "critical": 0, "high": 1, "message": "Security scanning detected %{totalStart}1%{totalEnd} potential vulnerability", "other": 0, "status": "", "total": 1
} interpolates correctly 1`] = `
<span>
Security scanning detected
<strong>
1
</strong>
potential vulnerability
<span
class="gl-font-sm"
>
<span>
<span>
0 critical
<span
class="gl-pl-4"
>
0 Critical
</span>
</span>
<span>
<strong
class="text-danger-600
"
class="text-danger-600 gl-px-2
"
>
1 h
igh
1 H
igh
</strong>
</span>
and
<span>
<span>
<span
class="gl-px-2"
>
0 Others
</span>
</span>
</span>
</span>
`;
exports[`Severity Summary given the message {"c
ritical": 1, "high": 0, "message": "Security scanning detected %{countStart}1%{countEnd} potential vulnerability %{criticalStart}1 critical%{criticalEnd} %{highStart}0 high%{highEnd} and %{otherStart}0 Others%{otherEnd}", "other": 0, "status": ""
} interpolates correctly 1`] = `
exports[`Severity Summary given the message {"c
ountMessage": "%{criticalStart}1 Critical%{criticalEnd} %{highStart}0 High%{highEnd} and %{otherStart}0 Others%{otherEnd}", "critical": 1, "high": 0, "message": "Security scanning detected %{totalStart}1%{totalEnd} potential vulnerability", "other": 0, "status": "", "total": 1
} interpolates correctly 1`] = `
<span>
Security scanning detected
<strong>
1
</strong>
potential vulnerability
<span
class="gl-font-sm"
>
<span>
<strong
class="text-danger-800
"
class="text-danger-800 gl-pl-4
"
>
1 c
ritical
1 C
ritical
</strong>
</span>
<span>
<span>
0 high
<span
class="gl-px-2"
>
0 High
</span>
</span>
and
<span>
<span>
<span
class="gl-px-2"
>
0 Others
</span>
</span>
</span>
</span>
`;
exports[`Severity Summary given the message {"c
ritical": 1, "high": 2, "message": "Security scanning detected %{countStart}3%{countEnd} potential vulnerabilities %{criticalStart}1 critical%{criticalEnd} %{highStart}2 high%{highEnd} and %{otherStart}0 Others%{otherEnd}", "other": 0, "status": ""
} interpolates correctly 1`] = `
exports[`Severity Summary given the message {"c
ountMessage": "%{criticalStart}1 Critical%{criticalEnd} %{highStart}2 High%{highEnd} and %{otherStart}0 Others%{otherEnd}", "critical": 1, "high": 2, "message": "Security scanning detected %{totalStart}3%{totalEnd} potential vulnerabilities", "other": 0, "status": "", "total": 3
} interpolates correctly 1`] = `
<span>
Security scanning detected
<strong>
3
</strong>
potential vulnerabilities
<span
class="gl-font-sm"
>
<span>
<strong
class="text-danger-800
"
class="text-danger-800 gl-pl-4
"
>
1 c
ritical
1 C
ritical
</strong>
</span>
<span>
<strong
class="text-danger-600
"
class="text-danger-600 gl-px-2
"
>
2 h
igh
2 H
igh
</strong>
</span>
and
<span>
<span>
<span
class="gl-px-2"
>
0 Others
</span>
</span>
</span>
</span>
`;
exports[`Severity Summary given the message {"message": ""} interpolates correctly 1`] = `<span />`;
exports[`Severity Summary given the message {"message": ""} interpolates correctly 1`] = `
<span>
<!---->
</span>
`;
exports[`Severity Summary given the message {"message": "foo"} interpolates correctly 1`] = `
<span>
foo
<!---->
</span>
`;
ee/spec/frontend/vue_shared/security_reports/grouped_security_reports_app_spec.js
View file @
3ca43788
...
...
@@ -144,9 +144,11 @@ describe('Grouped security reports app', () => {
it
(
'
renders error state
'
,
()
=>
{
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
.gl-spinner
'
)).
toBeNull
();
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
.js-code-text
'
).
textContent
.
trim
()).
toEqual
(
'
Security scanning failed loading any results
'
,
);
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
[data-testid="report-section-code-text"]
'
)
.
textContent
.
trim
(),
).
toEqual
(
'
Security scanning failed loading any results
'
);
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
.js-collapse-btn
'
).
textContent
.
trim
()).
toEqual
(
'
Expand
'
,
...
...
@@ -185,9 +187,11 @@ describe('Grouped security reports app', () => {
it
(
'
renders loading summary text + spinner
'
,
()
=>
{
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
.gl-spinner
'
)).
not
.
toBeNull
();
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
.js-code-text
'
).
textContent
.
trim
()).
toEqual
(
'
Security scanning is loading
'
,
);
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
[data-testid="report-section-code-text"]
'
)
.
textContent
.
trim
(),
).
toEqual
(
'
Security scanning is loading
'
);
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
.js-collapse-btn
'
).
textContent
.
trim
()).
toEqual
(
'
Expand
'
,
...
...
@@ -228,9 +232,11 @@ describe('Grouped security reports app', () => {
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
.gl-spinner
'
)).
toBeNull
();
// Renders the summary text
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
.js-code-text
'
).
textContent
.
trim
()).
toEqual
(
'
Security scanning detected no vulnerabilities.
'
,
);
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
[data-testid="report-section-code-text"]
'
)
.
textContent
.
trim
(),
).
toEqual
(
'
Security scanning detected no vulnerabilities.
'
);
// Renders Sast result
expect
(
trimText
(
wrapper
.
vm
.
$el
.
textContent
)).
toContain
(
'
SAST detected no vulnerabilities.
'
);
...
...
@@ -276,8 +282,12 @@ describe('Grouped security reports app', () => {
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
.gl-spinner
'
)).
toBeNull
();
// Renders the summary text
expect
(
wrapper
.
vm
.
$el
.
querySelector
(
'
.js-code-text
'
).
textContent
.
trim
()).
toContain
(
'
Security scanning detected 10 potential vulnerabilities
'
,
expect
(
trimText
(
wrapper
.
vm
.
$el
.
querySelector
(
'
[data-testid="report-section-code-text"]
'
).
textContent
,
),
).
toEqual
(
'
Security scanning detected 10 potential vulnerabilities 6 Critical 4 High and 0 Others
'
,
);
// Renders the expand button
...
...
@@ -287,25 +297,27 @@ describe('Grouped security reports app', () => {
// Renders Sast result
expect
(
trimText
(
wrapper
.
vm
.
$el
.
textContent
)).
toContain
(
'
SAST detected 1 potential vulnerability
'
,
'
SAST detected 1 potential vulnerability
1 Critical 0 High and 0 Others
'
,
);
// Renders DSS result
expect
(
trimText
(
wrapper
.
vm
.
$el
.
textContent
)).
toContain
(
'
Dependency scanning detected 2 potential vulnerabilities
'
,
'
Dependency scanning detected 2 potential vulnerabilities
1 Critical 1 High and 0 Others
'
,
);
// Renders container scanning result
expect
(
wrapper
.
vm
.
$el
.
textContent
).
toContain
(
'
Container scanning detected 2 potential vulnerabilities
'
,
expect
(
trimText
(
wrapper
.
vm
.
$el
.
textContent
)
).
toContain
(
'
Container scanning detected 2 potential vulnerabilities
1 Critical 1 High and 0 Others
'
,
);
// Renders DAST result
expect
(
wrapper
.
vm
.
$el
.
textContent
).
toContain
(
'
DAST detected 1 potential vulnerability
'
);
expect
(
trimText
(
wrapper
.
vm
.
$el
.
textContent
)).
toContain
(
'
DAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others
'
,
);
// Renders container scanning result
expect
(
wrapper
.
vm
.
$el
.
textContent
).
toContain
(
'
Coverage fuzzing detected 2 potential vulnerabilities
'
,
expect
(
trimText
(
wrapper
.
vm
.
$el
.
textContent
)
).
toContain
(
'
Coverage fuzzing detected 2 potential vulnerabilities
1 Critical 1 High and 0 Others
'
,
);
});
...
...
@@ -426,7 +438,9 @@ describe('Grouped security reports app', () => {
});
it
(
'
should display the correct numbers of vulnerabilities
'
,
()
=>
{
expect
(
wrapper
.
text
()).
toContain
(
'
Container scanning detected 2 potential vulnerabilities
'
);
expect
(
trimText
(
wrapper
.
text
())).
toContain
(
'
Container scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others
'
,
);
});
});
...
...
@@ -454,8 +468,8 @@ describe('Grouped security reports app', () => {
});
it
(
'
should display the correct numbers of vulnerabilities
'
,
()
=>
{
expect
(
wrapper
.
vm
.
$el
.
textContent
).
toContain
(
'
Dependency scanning detected 2 potential vulnerabilities
'
,
expect
(
trimText
(
wrapper
.
vm
.
$el
.
textContent
)
).
toContain
(
'
Dependency scanning detected 2 potential vulnerabilities
1 Critical 1 High and 0 Others
'
,
);
});
});
...
...
@@ -485,7 +499,9 @@ describe('Grouped security reports app', () => {
});
it
(
'
should display the correct numbers of vulnerabilities
'
,
()
=>
{
expect
(
wrapper
.
vm
.
$el
.
textContent
).
toContain
(
'
DAST detected 1 potential vulnerability
'
);
expect
(
trimText
(
wrapper
.
vm
.
$el
.
textContent
)).
toContain
(
'
DAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others
'
,
);
});
it
(
'
shows the scanned URLs count and opens a modal
'
,
async
()
=>
{
...
...
@@ -565,7 +581,9 @@ describe('Grouped security reports app', () => {
});
it
(
'
should display the correct numbers of vulnerabilities
'
,
()
=>
{
expect
(
wrapper
.
text
()).
toContain
(
'
Secret scanning detected 2 potential vulnerabilities
'
);
expect
(
trimText
(
wrapper
.
text
())).
toContain
(
'
Secret scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others
'
,
);
});
});
...
...
@@ -602,7 +620,9 @@ describe('Grouped security reports app', () => {
});
it
(
'
should display the correct numbers of vulnerabilities
'
,
()
=>
{
expect
(
wrapper
.
vm
.
$el
.
textContent
).
toContain
(
'
SAST detected 1 potential vulnerability
'
);
expect
(
trimText
(
wrapper
.
vm
.
$el
.
textContent
)).
toContain
(
'
SAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others
'
,
);
});
});
...
...
ee/spec/frontend/vue_shared/security_reports/store/modules/sast/getters_spec.js
View file @
3ca43788
...
...
@@ -30,11 +30,13 @@ describe('groupedSastText', () => {
const
result
=
getters
.
groupedSastText
(
sast
);
expect
(
result
).
toStrictEqual
({
countMessage
:
''
,
critical
:
0
,
high
:
0
,
message
:
'
SAST detected %{
countStart}no%{count
End} vulnerabilities.
'
,
message
:
'
SAST detected %{
totalStart}no%{total
End} vulnerabilities.
'
,
other
:
0
,
status
:
''
,
total
:
0
,
});
});
});
...
...
ee/spec/frontend/vue_shared/security_reports/store/utils_spec.js
View file @
3ca43788
...
...
@@ -116,32 +116,37 @@ describe('security reports utils', () => {
const
other
=
7
;
it
.
each
`
vulnerabilities | message
${
undefined
}
|
${
'
detected %{
countStart}no%{countEnd} vulnerabilities.
'
}
${{
critical
}
} |
${
` detected %{
countStart}2%{countEnd} potential vulnerabilities %{criticalStart}2 critical%{criticalEnd} %{highStart}0 h
igh%{highEnd} and %{otherStart}0 Others%{otherEnd}`
}
${{
high
}
} |
${
` detected %{
countStart}4%{countEnd} potential vulnerabilities %{criticalStart}0 critical%{criticalEnd} %{highStart}4 h
igh%{highEnd} and %{otherStart}0 Others%{otherEnd}`
}
${{
other
}
} |
${
` detected %{
countStart}7%{countEnd} potential vulnerabilities %{criticalStart}0 critical%{criticalEnd} %{highStart}0 h
igh%{highEnd} and %{otherStart}7 Others%{otherEnd}`
}
${{
critical
,
high
}
} |
${
` detected %{
countStart}6%{countEnd} potential vulnerabilities %{criticalStart}2 critical%{criticalEnd} %{highStart}4 h
igh%{highEnd} and %{otherStart}0 Others%{otherEnd}`
}
${{
critical
,
other
}
} |
${
` detected %{
countStart}9%{countEnd} potential vulnerabilities %{criticalStart}2 critical%{criticalEnd} %{highStart}0 h
igh%{highEnd} and %{otherStart}7 Others%{otherEnd}`
}
${{
high
,
other
}
} |
${
` detected %{
countStart}11%{countEnd} potential vulnerabilities %{criticalStart}0 critical%{criticalEnd} %{highStart}4 h
igh%{highEnd} and %{otherStart}7 Others%{otherEnd}`
}
${{
critical
,
high
,
other
}
} |
${
` detected %{
countStart}13%{countEnd} potential vulnerabilities %{criticalStart}2 critical%{criticalEnd} %{highStart}4 h
igh%{highEnd} and %{otherStart}7 Others%{otherEnd}`
}
`
(
'
should build the message as "$message"
'
,
({
vulnerabilities
,
message
})
=>
{
vulnerabilities | message
| countMessage
${
undefined
}
|
${
'
detected %{
totalStart}no%{totalEnd} vulnerabilities.
'
}
|
${
'
'
}
${{
critical
}
} |
${
` detected %{
totalStart}2%{totalEnd} potential vulnerabilities`
}
|
${
`%{criticalStart}2 Critical%{criticalEnd} %{highStart}0 H
igh%{highEnd} and %{otherStart}0 Others%{otherEnd}`
}
${{
high
}
} |
${
` detected %{
totalStart}4%{totalEnd} potential vulnerabilities`
}
|
${
`%{criticalStart}0 Critical%{criticalEnd} %{highStart}4 H
igh%{highEnd} and %{otherStart}0 Others%{otherEnd}`
}
${{
other
}
} |
${
` detected %{
totalStart}7%{totalEnd} potential vulnerabilities`
}
|
${
`%{criticalStart}0 Critical%{criticalEnd} %{highStart}0 H
igh%{highEnd} and %{otherStart}7 Others%{otherEnd}`
}
${{
critical
,
high
}
} |
${
` detected %{
totalStart}6%{totalEnd} potential vulnerabilities`
}
|
${
`%{criticalStart}2 Critical%{criticalEnd} %{highStart}4 H
igh%{highEnd} and %{otherStart}0 Others%{otherEnd}`
}
${{
critical
,
other
}
} |
${
` detected %{
totalStart}9%{totalEnd} potential vulnerabilities`
}
|
${
`%{criticalStart}2 Critical%{criticalEnd} %{highStart}0 H
igh%{highEnd} and %{otherStart}7 Others%{otherEnd}`
}
${{
high
,
other
}
} |
${
` detected %{
totalStart}11%{totalEnd} potential vulnerabilities`
}
|
${
`%{criticalStart}0 Critical%{criticalEnd} %{highStart}4 H
igh%{highEnd} and %{otherStart}7 Others%{otherEnd}`
}
${{
critical
,
high
,
other
}
} |
${
` detected %{
totalStart}13%{totalEnd} potential vulnerabilities`
}
|
${
`%{criticalStart}2 Critical%{criticalEnd} %{highStart}4 H
igh%{highEnd} and %{otherStart}7 Others%{otherEnd}`
}
`
(
'
should build the message as "$message"
'
,
({
vulnerabilities
,
message
,
countMessage
})
=>
{
expect
(
groupedTextBuilder
(
vulnerabilities
).
message
).
toEqual
(
message
);
expect
(
groupedTextBuilder
(
vulnerabilities
).
countMessage
).
toEqual
(
countMessage
);
});
it
.
each
`
vulnerabilities | message
${{
critical
:
1
}
} |
${
` detected %{countStart}1%{countEnd} potential vulnerability %{criticalStart}1 critical%{criticalEnd} %{highStart}0 high%{highEnd} and %{otherStart}0 Others%{otherEnd}`
}
${{
high
:
1
}
} |
${
` detected %{countStart}1%{countEnd} potential vulnerability %{criticalStart}0 critical%{criticalEnd} %{highStart}1 high%{highEnd} and %{otherStart}0 Others%{otherEnd}`
}
${{
other
:
1
}
} |
${
` detected %{countStart}1%{countEnd} potential vulnerability %{criticalStart}0 critical%{criticalEnd} %{highStart}0 high%{highEnd} and %{otherStart}1 Other%{otherEnd}`
}
`
(
'
should handle single vulnerabilities for "$message"
'
,
({
vulnerabilities
,
message
})
=>
{
vulnerabilities | message | countMessage
${{
critical
:
1
}
} |
${
` detected %{totalStart}1%{totalEnd} potential vulnerability`
}
|
${
`%{criticalStart}1 Critical%{criticalEnd} %{highStart}0 High%{highEnd} and %{otherStart}0 Others%{otherEnd}`
}
${{
high
:
1
}
} |
${
` detected %{totalStart}1%{totalEnd} potential vulnerability`
}
|
${
`%{criticalStart}0 Critical%{criticalEnd} %{highStart}1 High%{highEnd} and %{otherStart}0 Others%{otherEnd}`
}
${{
other
:
1
}
} |
${
` detected %{totalStart}1%{totalEnd} potential vulnerability`
}
|
${
`%{criticalStart}0 Critical%{criticalEnd} %{highStart}0 High%{highEnd} and %{otherStart}1 Other%{otherEnd}`
}
`
(
'
should handle single vulnerabilities for "$message"
'
,
({
vulnerabilities
,
message
,
countMessage
})
=>
{
expect
(
groupedTextBuilder
(
vulnerabilities
).
message
).
toEqual
(
message
);
});
expect
(
groupedTextBuilder
(
vulnerabilities
).
countMessage
).
toEqual
(
countMessage
);
},
);
it
(
'
should pass through the report type
'
,
()
=>
{
const
reportType
=
'
HAL
'
;
expect
(
groupedTextBuilder
({
reportType
}).
message
).
toEqual
(
'
HAL detected %{
countStart}no%{count
End} vulnerabilities.
'
,
'
HAL detected %{
totalStart}no%{total
End} vulnerabilities.
'
,
);
});
...
...
@@ -149,11 +154,13 @@ describe('security reports utils', () => {
const
reportType
=
'
HAL
'
;
const
status
=
'
is loading
'
;
expect
(
groupedTextBuilder
({
reportType
,
status
})).
toEqual
({
countMessage
:
''
,
critical
:
0
,
high
:
0
,
message
:
'
HAL is loading
'
,
other
:
0
,
status
:
'
is loading
'
,
total
:
0
,
});
});
});
...
...
@@ -193,7 +200,7 @@ describe('security reports utils', () => {
${[{
severity
:
LOW
},
{
severity
:
MEDIUM
}]}
|
${{
critical
:
0
,
high
:
0
,
other
:
2
}
}
${[{
severity
:
CRITICAL
},
{
severity
:
HIGH
}]}
|
${{
critical
:
1
,
high
:
1
,
other
:
0
}
}
${[{
severity
:
CRITICAL
},
{
severity
:
LOW
}]}
|
${{
critical
:
1
,
high
:
0
,
other
:
1
}
}
`
(
'
should
count
the vulnerabilities correctly
'
,
({
vulnerabilities
,
response
})
=>
{
`
(
'
should
total
the vulnerabilities correctly
'
,
({
vulnerabilities
,
response
})
=>
{
expect
(
countVulnerabilities
(
vulnerabilities
)).
toEqual
(
response
);
});
});
...
...
@@ -223,11 +230,13 @@ describe('security reports utils', () => {
const
result
=
groupedReportText
(
report
,
reportType
,
errorMessage
,
loadingMessage
);
expect
(
result
).
toStrictEqual
({
countMessage
:
''
,
critical
:
0
,
high
:
0
,
message
:
'
dummyReport detected %{
countStart}no%{count
End} vulnerabilities.
'
,
message
:
'
dummyReport detected %{
totalStart}no%{total
End} vulnerabilities.
'
,
other
:
0
,
status
:
''
,
total
:
0
,
});
});
});
...
...
locale/gitlab.pot
View file @
3ca43788
...
...
@@ -450,6 +450,9 @@ msgstr ""
msgid "%{count} total weight"
msgstr ""
msgid "%{criticalStart}%{critical} Critical%{criticalEnd} %{highStart}%{high} High%{highEnd} and %{otherStart}%{otherMessage}%{otherEnd}"
msgstr ""
msgid "%{dashboard_path} could not be found."
msgstr ""
...
...
@@ -718,10 +721,10 @@ msgstr ""
msgid "%{reportType} %{status}"
msgstr ""
msgid "%{reportType} detected %{
countStart}%{total}%{countEnd} potential %{vulnMessage} %{criticalStart}%{critical} critical%{criticalEnd} %{highStart}%{high} high%{highEnd} and %{otherStart}%{otherMessage}%{otherEnd
}"
msgid "%{reportType} detected %{
totalStart}%{total}%{totalEnd} potential %{vulnMessage
}"
msgstr ""
msgid "%{reportType} detected %{
countStart}no%{count
End} vulnerabilities."
msgid "%{reportType} detected %{
totalStart}no%{total
End} vulnerabilities."
msgstr ""
msgid "%{retryButtonStart}Try again%{retryButtonEnd} or %{newFileButtonStart}attach a new file%{newFileButtonEnd}."
...
...
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