Commit 7baa47ba authored by Ezekiel Kigbo's avatar Ezekiel Kigbo

Merge branch '231292-remove-new-word-from-security-summary-message' into 'master'

Remove word "new" from security summary message on MR page

See merge request gitlab-org/gitlab!38043
parents b85e826c 49e6f945
......@@ -88,16 +88,16 @@ export const groupedTextBuilder = ({
switch (options) {
case HAS_CRITICAL:
message = n__(
'%{reportType} %{status} detected %{criticalStart}%{critical} new critical%{criticalEnd} severity vulnerability.',
'%{reportType} %{status} detected %{criticalStart}%{critical} new critical%{criticalEnd} severity vulnerabilities.',
'%{reportType} %{status} detected %{criticalStart}%{critical} critical%{criticalEnd} severity vulnerability.',
'%{reportType} %{status} detected %{criticalStart}%{critical} critical%{criticalEnd} severity vulnerabilities.',
critical,
);
break;
case HAS_HIGH:
message = n__(
'%{reportType} %{status} detected %{highStart}%{high} new high%{highEnd} severity vulnerability.',
'%{reportType} %{status} detected %{highStart}%{high} new high%{highEnd} severity vulnerabilities.',
'%{reportType} %{status} detected %{highStart}%{high} high%{highEnd} severity vulnerability.',
'%{reportType} %{status} detected %{highStart}%{high} high%{highEnd} severity vulnerabilities.',
high,
);
break;
......@@ -112,30 +112,30 @@ export const groupedTextBuilder = ({
case HAS_CRITICAL + HAS_HIGH:
message = __(
'%{reportType} %{status} detected %{criticalStart}%{critical} new critical%{criticalEnd} and %{highStart}%{high} new high%{highEnd} severity vulnerabilities.',
'%{reportType} %{status} detected %{criticalStart}%{critical} critical%{criticalEnd} and %{highStart}%{high} high%{highEnd} severity vulnerabilities.',
);
break;
case HAS_CRITICAL + HAS_OTHER:
message = __(
'%{reportType} %{status} detected %{criticalStart}%{critical} new critical%{criticalEnd} severity vulnerabilities out of %{total}.',
'%{reportType} %{status} detected %{criticalStart}%{critical} critical%{criticalEnd} severity vulnerabilities out of %{total}.',
);
break;
case HAS_HIGH + HAS_OTHER:
message = __(
'%{reportType} %{status} detected %{highStart}%{high} new high%{highEnd} severity vulnerabilities out of %{total}.',
'%{reportType} %{status} detected %{highStart}%{high} high%{highEnd} severity vulnerabilities out of %{total}.',
);
break;
case HAS_CRITICAL + HAS_HIGH + HAS_OTHER:
message = __(
'%{reportType} %{status} detected %{criticalStart}%{critical} new critical%{criticalEnd} and %{highStart}%{high} new high%{highEnd} severity vulnerabilities out of %{total}.',
'%{reportType} %{status} detected %{criticalStart}%{critical} critical%{criticalEnd} and %{highStart}%{high} high%{highEnd} severity vulnerabilities out of %{total}.',
);
break;
default:
message = __('%{reportType} %{status} detected no new vulnerabilities.');
message = __('%{reportType} %{status} detected no vulnerabilities.');
}
return sprintf(message, {
......
---
title: Make security summary message more understandable
merge_request: 38043
author:
type: changed
......@@ -135,7 +135,7 @@ describe('ee merge request widget options', () => {
`${SAST_SELECTOR} .report-block-list-issue-description`,
).textContent,
),
).toEqual('SAST detected 1 new critical severity vulnerability.');
).toEqual('SAST detected 1 critical severity vulnerability.');
done();
});
});
......@@ -157,7 +157,7 @@ describe('ee merge request widget options', () => {
`${SAST_SELECTOR} .report-block-list-issue-description`,
).textContent,
).trim(),
).toEqual('SAST detected no new vulnerabilities.');
).toEqual('SAST detected no vulnerabilities.');
done();
});
});
......@@ -225,9 +225,7 @@ describe('ee merge request widget options', () => {
`${DEPENDENCY_SCANNING_SELECTOR} .report-block-list-issue-description`,
).textContent,
),
).toEqual(
'Dependency scanning detected 1 new critical and 1 new high severity vulnerabilities.',
);
).toEqual('Dependency scanning detected 1 critical and 1 high severity vulnerabilities.');
done();
});
});
......@@ -245,7 +243,7 @@ describe('ee merge request widget options', () => {
vm = mountComponent(Component, { mrData: gl.mrWidgetData });
});
it('renders no new vulnerabilities message', done => {
it('renders no vulnerabilities message', done => {
setImmediate(() => {
expect(
trimText(
......@@ -253,7 +251,7 @@ describe('ee merge request widget options', () => {
`${DEPENDENCY_SCANNING_SELECTOR} .report-block-list-issue-description`,
).textContent,
),
).toEqual('Dependency scanning detected no new vulnerabilities.');
).toEqual('Dependency scanning detected no vulnerabilities.');
done();
});
});
......@@ -275,7 +273,7 @@ describe('ee merge request widget options', () => {
`${DEPENDENCY_SCANNING_SELECTOR} .report-block-list-issue-description`,
).textContent,
),
).toEqual('Dependency scanning detected no new vulnerabilities.');
).toEqual('Dependency scanning detected no vulnerabilities.');
done();
});
});
......@@ -645,9 +643,7 @@ describe('ee merge request widget options', () => {
`${CONTAINER_SCANNING_SELECTOR} .report-block-list-issue-description`,
).textContent,
),
).toEqual(
'Container scanning detected 1 new critical and 1 new high severity vulnerabilities.',
);
).toEqual('Container scanning detected 1 critical and 1 high severity vulnerabilities.');
done();
});
});
......@@ -717,7 +713,7 @@ describe('ee merge request widget options', () => {
findSecurityWidget()
.querySelector(`${DAST_SELECTOR} .report-block-list-issue-description`)
.textContent.trim(),
).toEqual('DAST detected 1 new critical severity vulnerability.');
).toEqual('DAST detected 1 critical severity vulnerability.');
done();
});
});
......@@ -787,9 +783,7 @@ describe('ee merge request widget options', () => {
findSecurityWidget()
.querySelector(`${COVERAGE_FUZZING_SELECTOR} .report-block-list-issue-description`)
.textContent.trim(),
).toEqual(
'Coverage fuzzing detected 1 new critical and 1 new high severity vulnerabilities.',
);
).toEqual('Coverage fuzzing detected 1 critical and 1 high severity vulnerabilities.');
done();
});
});
......@@ -863,9 +857,7 @@ describe('ee merge request widget options', () => {
`${SECRET_SCANNING_SELECTOR} .report-block-list-issue-description`,
).textContent,
),
).toEqual(
'Secret scanning detected 1 new critical and 1 new high severity vulnerabilities.',
);
).toEqual('Secret scanning detected 1 critical and 1 high severity vulnerabilities.');
done();
});
});
......
......@@ -225,26 +225,24 @@ describe('Grouped security reports app', () => {
// Renders the summary text
expect(wrapper.vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Security scanning detected no new vulnerabilities.',
'Security scanning detected no vulnerabilities.',
);
// Renders Sast result
expect(trimText(wrapper.vm.$el.textContent)).toContain(
'SAST detected no new vulnerabilities.',
);
expect(trimText(wrapper.vm.$el.textContent)).toContain('SAST detected no vulnerabilities.');
// Renders DSS result
expect(trimText(wrapper.vm.$el.textContent)).toContain(
'Dependency scanning detected no new vulnerabilities.',
'Dependency scanning detected no vulnerabilities.',
);
// Renders container scanning result
expect(wrapper.vm.$el.textContent).toContain(
'Container scanning detected no new vulnerabilities.',
'Container scanning detected no vulnerabilities.',
);
// Renders DAST result
expect(wrapper.vm.$el.textContent).toContain('DAST detected no new vulnerabilities.');
expect(wrapper.vm.$el.textContent).toContain('DAST detected no vulnerabilities.');
});
});
......@@ -275,7 +273,7 @@ describe('Grouped security reports app', () => {
// Renders the summary text
expect(wrapper.vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Security scanning detected 5 new critical and 3 new high severity vulnerabilities.',
'Security scanning detected 5 critical and 3 high severity vulnerabilities.',
);
// Renders the expand button
......@@ -285,27 +283,27 @@ describe('Grouped security reports app', () => {
// Renders Sast result
expect(trimText(wrapper.vm.$el.textContent)).toContain(
'SAST detected 1 new critical severity vulnerability',
'SAST detected 1 critical severity vulnerability',
);
// Renders DSS result
expect(trimText(wrapper.vm.$el.textContent)).toContain(
'Dependency scanning detected 1 new critical and 1 new high severity vulnerabilities.',
'Dependency scanning detected 1 critical and 1 high severity vulnerabilities.',
);
// Renders container scanning result
expect(wrapper.vm.$el.textContent).toContain(
'Container scanning detected 1 new critical and 1 new high severity vulnerabilities.',
'Container scanning detected 1 critical and 1 high severity vulnerabilities.',
);
// Renders DAST result
expect(wrapper.vm.$el.textContent).toContain(
'DAST detected 1 new critical severity vulnerability.',
'DAST detected 1 critical severity vulnerability.',
);
// Renders container scanning result
expect(wrapper.vm.$el.textContent).toContain(
'Coverage fuzzing detected 1 new critical and 1 new high severity vulnerabilities.',
'Coverage fuzzing detected 1 critical and 1 high severity vulnerabilities.',
);
});
......@@ -396,7 +394,7 @@ describe('Grouped security reports app', () => {
it('should display the correct numbers of vulnerabilities', () => {
expect(wrapper.text()).toContain(
'Container scanning detected 1 new critical and 1 new high severity vulnerabilities.',
'Container scanning detected 1 critical and 1 high severity vulnerabilities.',
);
});
});
......@@ -426,7 +424,7 @@ describe('Grouped security reports app', () => {
it('should display the correct numbers of vulnerabilities', () => {
expect(wrapper.vm.$el.textContent).toContain(
'Dependency scanning detected 1 new critical and 1 new high severity vulnerabilities.',
'Dependency scanning detected 1 critical and 1 high severity vulnerabilities.',
);
});
});
......@@ -457,7 +455,7 @@ describe('Grouped security reports app', () => {
it('should display the correct numbers of vulnerabilities', () => {
expect(wrapper.vm.$el.textContent).toContain(
'DAST detected 1 new critical severity vulnerability',
'DAST detected 1 critical severity vulnerability',
);
});
......@@ -539,7 +537,7 @@ describe('Grouped security reports app', () => {
it('should display the correct numbers of vulnerabilities', () => {
expect(wrapper.text()).toContain(
'Secret scanning detected 1 new critical and 1 new high severity vulnerabilities.',
'Secret scanning detected 1 critical and 1 high severity vulnerabilities.',
);
});
});
......@@ -578,7 +576,7 @@ describe('Grouped security reports app', () => {
it('should display the correct numbers of vulnerabilities', () => {
expect(wrapper.vm.$el.textContent).toContain(
'SAST detected 1 new critical severity vulnerability.',
'SAST detected 1 critical severity vulnerability.',
);
});
});
......
......@@ -47,18 +47,18 @@ describe('Security reports getters', () => {
`('grouped text for $name', ({ name, scanner, getter }) => {
describe('with no issues', () => {
it('returns no issues text', () => {
expect(getter(state)).toEqual(`${name} detected no new vulnerabilities.`);
expect(getter(state)).toEqual(`${name} detected no vulnerabilities.`);
});
});
it.each`
vulnerabilities | message
${[]} | ${`${name} detected no new vulnerabilities.`}
${[generateVuln(CRITICAL), generateVuln(CRITICAL)]} | ${`${name} detected %{criticalStart}2 new critical%{criticalEnd} severity vulnerabilities.`}
${[generateVuln(HIGH), generateVuln(HIGH)]} | ${`${name} detected %{highStart}2 new high%{highEnd} severity vulnerabilities.`}
${[]} | ${`${name} detected no vulnerabilities.`}
${[generateVuln(CRITICAL), generateVuln(CRITICAL)]} | ${`${name} detected %{criticalStart}2 critical%{criticalEnd} severity vulnerabilities.`}
${[generateVuln(HIGH), generateVuln(HIGH)]} | ${`${name} detected %{highStart}2 high%{highEnd} severity vulnerabilities.`}
${[generateVuln(LOW), generateVuln(MEDIUM)]} | ${`${name} detected 2 vulnerabilities.`}
${[generateVuln(CRITICAL), generateVuln(HIGH)]} | ${`${name} detected %{criticalStart}1 new critical%{criticalEnd} and %{highStart}1 new high%{highEnd} severity vulnerabilities.`}
${[generateVuln(CRITICAL), generateVuln(LOW)]} | ${`${name} detected %{criticalStart}1 new critical%{criticalEnd} severity vulnerabilities out of 2.`}
${[generateVuln(CRITICAL), generateVuln(HIGH)]} | ${`${name} detected %{criticalStart}1 critical%{criticalEnd} and %{highStart}1 high%{highEnd} severity vulnerabilities.`}
${[generateVuln(CRITICAL), generateVuln(LOW)]} | ${`${name} detected %{criticalStart}1 critical%{criticalEnd} severity vulnerabilities out of 2.`}
`('should build the message as "$message"', ({ vulnerabilities, message }) => {
state[scanner].newIssues = vulnerabilities;
expect(getter(state)).toEqual(message);
......@@ -133,7 +133,7 @@ describe('Security reports getters', () => {
},
}),
).toEqual(
'Security scanning (is loading) detected %{criticalStart}2 new critical%{criticalEnd} and %{highStart}4 new high%{highEnd} severity vulnerabilities.',
'Security scanning (is loading) detected %{criticalStart}2 critical%{criticalEnd} and %{highStart}4 high%{highEnd} severity vulnerabilities.',
);
});
......@@ -144,7 +144,7 @@ describe('Security reports getters', () => {
areReportsLoading: false,
summaryCounts: {},
}),
).toEqual('Security scanning detected no new vulnerabilities.');
).toEqual('Security scanning detected no vulnerabilities.');
});
});
......
......@@ -29,7 +29,7 @@ describe('groupedSastText', () => {
const sast = createReport();
const result = getters.groupedSastText(sast);
expect(result).toBe('SAST detected no new vulnerabilities.');
expect(result).toBe('SAST detected no vulnerabilities.');
});
});
......
......@@ -117,22 +117,22 @@ describe('security reports utils', () => {
it.each`
vulnerabilities | message
${undefined} | ${' detected no new vulnerabilities.'}
${{ critical }} | ${' detected %{criticalStart}2 new critical%{criticalEnd} severity vulnerabilities.'}
${{ high }} | ${' detected %{highStart}4 new high%{highEnd} severity vulnerabilities.'}
${undefined} | ${' detected no vulnerabilities.'}
${{ critical }} | ${' detected %{criticalStart}2 critical%{criticalEnd} severity vulnerabilities.'}
${{ high }} | ${' detected %{highStart}4 high%{highEnd} severity vulnerabilities.'}
${{ other }} | ${' detected 7 vulnerabilities.'}
${{ critical, high }} | ${' detected %{criticalStart}2 new critical%{criticalEnd} and %{highStart}4 new high%{highEnd} severity vulnerabilities.'}
${{ critical, other }} | ${' detected %{criticalStart}2 new critical%{criticalEnd} severity vulnerabilities out of 9.'}
${{ high, other }} | ${' detected %{highStart}4 new high%{highEnd} severity vulnerabilities out of 11.'}
${{ critical, high, other }} | ${' detected %{criticalStart}2 new critical%{criticalEnd} and %{highStart}4 new high%{highEnd} severity vulnerabilities out of 13.'}
${{ critical, high }} | ${' detected %{criticalStart}2 critical%{criticalEnd} and %{highStart}4 high%{highEnd} severity vulnerabilities.'}
${{ critical, other }} | ${' detected %{criticalStart}2 critical%{criticalEnd} severity vulnerabilities out of 9.'}
${{ high, other }} | ${' detected %{highStart}4 high%{highEnd} severity vulnerabilities out of 11.'}
${{ critical, high, other }} | ${' detected %{criticalStart}2 critical%{criticalEnd} and %{highStart}4 high%{highEnd} severity vulnerabilities out of 13.'}
`('should build the message as "$message"', ({ vulnerabilities, message }) => {
expect(groupedTextBuilder(vulnerabilities)).toEqual(message);
});
it.each`
vulnerabilities | message
${{ critical: 1 }} | ${' detected %{criticalStart}1 new critical%{criticalEnd} severity vulnerability.'}
${{ high: 1 }} | ${' detected %{highStart}1 new high%{highEnd} severity vulnerability.'}
${{ critical: 1 }} | ${' detected %{criticalStart}1 critical%{criticalEnd} severity vulnerability.'}
${{ high: 1 }} | ${' detected %{highStart}1 high%{highEnd} severity vulnerability.'}
${{ other: 1 }} | ${' detected 1 vulnerability.'}
`('should handle single vulnerabilities for "$message"', ({ vulnerabilities, message }) => {
expect(groupedTextBuilder(vulnerabilities)).toEqual(message);
......@@ -140,14 +140,14 @@ describe('security reports utils', () => {
it('should pass through the report type', () => {
const reportType = 'HAL';
expect(groupedTextBuilder({ reportType })).toEqual('HAL detected no new vulnerabilities.');
expect(groupedTextBuilder({ reportType })).toEqual('HAL detected no vulnerabilities.');
});
it('should pass through the status', () => {
const reportType = 'HAL';
const status = '(is loading)';
expect(groupedTextBuilder({ reportType, status })).toEqual(
'HAL (is loading) detected no new vulnerabilities.',
'HAL (is loading) detected no vulnerabilities.',
);
});
});
......@@ -216,7 +216,7 @@ describe('security reports utils', () => {
const report = { ...baseReport };
const result = groupedReportText(report, reportType, errorMessage, loadingMessage);
expect(result).toBe(`${reportType} detected no new vulnerabilities.`);
expect(result).toBe(`${reportType} detected no vulnerabilities.`);
});
});
});
......@@ -604,25 +604,25 @@ msgstr[1] ""
msgid "%{remaining_approvals} left"
msgstr ""
msgid "%{reportType} %{status} detected %{criticalStart}%{critical} new critical%{criticalEnd} and %{highStart}%{high} new high%{highEnd} severity vulnerabilities out of %{total}."
msgid "%{reportType} %{status} detected %{criticalStart}%{critical} critical%{criticalEnd} and %{highStart}%{high} high%{highEnd} severity vulnerabilities out of %{total}."
msgstr ""
msgid "%{reportType} %{status} detected %{criticalStart}%{critical} new critical%{criticalEnd} and %{highStart}%{high} new high%{highEnd} severity vulnerabilities."
msgid "%{reportType} %{status} detected %{criticalStart}%{critical} critical%{criticalEnd} and %{highStart}%{high} high%{highEnd} severity vulnerabilities."
msgstr ""
msgid "%{reportType} %{status} detected %{criticalStart}%{critical} new critical%{criticalEnd} severity vulnerabilities out of %{total}."
msgid "%{reportType} %{status} detected %{criticalStart}%{critical} critical%{criticalEnd} severity vulnerabilities out of %{total}."
msgstr ""
msgid "%{reportType} %{status} detected %{criticalStart}%{critical} new critical%{criticalEnd} severity vulnerability."
msgid_plural "%{reportType} %{status} detected %{criticalStart}%{critical} new critical%{criticalEnd} severity vulnerabilities."
msgid "%{reportType} %{status} detected %{criticalStart}%{critical} critical%{criticalEnd} severity vulnerability."
msgid_plural "%{reportType} %{status} detected %{criticalStart}%{critical} critical%{criticalEnd} severity vulnerabilities."
msgstr[0] ""
msgstr[1] ""
msgid "%{reportType} %{status} detected %{highStart}%{high} new high%{highEnd} severity vulnerabilities out of %{total}."
msgid "%{reportType} %{status} detected %{highStart}%{high} high%{highEnd} severity vulnerabilities out of %{total}."
msgstr ""
msgid "%{reportType} %{status} detected %{highStart}%{high} new high%{highEnd} severity vulnerability."
msgid_plural "%{reportType} %{status} detected %{highStart}%{high} new high%{highEnd} severity vulnerabilities."
msgid "%{reportType} %{status} detected %{highStart}%{high} high%{highEnd} severity vulnerability."
msgid_plural "%{reportType} %{status} detected %{highStart}%{high} high%{highEnd} severity vulnerabilities."
msgstr[0] ""
msgstr[1] ""
......@@ -631,7 +631,7 @@ msgid_plural "%{reportType} %{status} detected %{other} vulnerabilities."
msgstr[0] ""
msgstr[1] ""
msgid "%{reportType} %{status} detected no new vulnerabilities."
msgid "%{reportType} %{status} detected no vulnerabilities."
msgstr ""
msgid "%{retryButtonStart}Try again%{retryButtonEnd} or %{newFileButtonStart}attach a new file%{newFileButtonEnd}"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment