diff options
5 files changed, 741 insertions, 842 deletions
diff --git a/server/sonar-web/src/main/js/apps/securityReports/components/App.tsx b/server/sonar-web/src/main/js/apps/securityReports/components/App.tsx index 32a19880013..58f78b0526d 100755 --- a/server/sonar-web/src/main/js/apps/securityReports/components/App.tsx +++ b/server/sonar-web/src/main/js/apps/securityReports/components/App.tsx @@ -21,11 +21,10 @@ import * as React from 'react'; import * as PropTypes from 'prop-types'; import Helmet from 'react-helmet'; import { Link } from 'react-router'; -import { FormattedMessage } from 'react-intl'; import VulnerabilityList from './VulnerabilityList'; import Suggestions from '../../../app/components/embed-docs-modal/Suggestions'; import { translate } from '../../../helpers/l10n'; -import { Component, BranchLike, SecurityHotspot, RuleType } from '../../../app/types'; +import { Component, BranchLike, SecurityHotspot } from '../../../app/types'; import DeferredSpinner from '../../../components/common/DeferredSpinner'; import Checkbox from '../../../components/controls/Checkbox'; import { RawQuery } from '../../../helpers/query'; @@ -33,8 +32,6 @@ import NotFound from '../../../app/components/NotFound'; import { getSecurityHotspots } from '../../../api/security-reports'; import { isLongLivingBranch } from '../../../helpers/branches'; import DocTooltip from '../../../components/docs/DocTooltip'; -import { getRulesUrl } from '../../../helpers/urls'; -import { isSonarCloud } from '../../../helpers/system'; import { StandardType } from '../utils'; import '../style.css'; @@ -127,39 +124,20 @@ export default class App extends React.PureComponent<Props, State> { }; renderAdditionalRulesMessage = () => { - const { component } = this.props; - const { findings, type } = this.state; + const { findings } = this.state; if (findings.length === 0) { return null; } const total = findings.map(f => f.totalRules).reduce((sum, count) => sum + count); const active = findings.map(f => f.activeRules).reduce((sum, count) => sum + count); - if (active === total) { + if (active >= total) { return null; } - const standard = translate('security_reports', type, 'page'); return ( <div className="alert alert-info spacer-top display-inline-block"> - <FormattedMessage - defaultMessage={translate('security_reports.info')} - id="security_reports.info" - tagName="p" - values={{ - link: ( - <Link - to={getRulesUrl( - { types: [RuleType.Vulnerability, RuleType.Hotspot].join() }, - isSonarCloud() ? component.organization : undefined - )}> - {translate('security_reports.info.link')} - </Link> - ), - standard, - total: total - active - }} - /> + {translate('security_reports.more_rules')} </div> ); }; diff --git a/server/sonar-web/src/main/js/apps/securityReports/components/VulnerabilityList.tsx b/server/sonar-web/src/main/js/apps/securityReports/components/VulnerabilityList.tsx index 5cde1c6db30..28cbd625f14 100755 --- a/server/sonar-web/src/main/js/apps/securityReports/components/VulnerabilityList.tsx +++ b/server/sonar-web/src/main/js/apps/securityReports/components/VulnerabilityList.tsx @@ -20,7 +20,7 @@ import * as React from 'react'; import * as classNames from 'classnames'; import { Link } from 'react-router'; -import { translate, translateWithParameters } from '../../../helpers/l10n'; +import { translate } from '../../../helpers/l10n'; import { SecurityHotspot, Component, BranchLike, IssueType } from '../../../app/types'; import Rating from '../../../components/ui/Rating'; import { getComponentIssuesUrl, getRulesUrl } from '../../../helpers/urls'; @@ -86,7 +86,7 @@ export default class VulnerabilityList extends React.PureComponent<Props, State> ); }; - getName(finding: SecurityHotspot, type: StandardType, activeRules: number, totalRules: number) { + getName(finding: SecurityHotspot, type: StandardType) { const category = finding.category || finding.cwe || 'unknown'; const renderers = { owaspTop10: renderOwaspTop10Category, @@ -103,12 +103,13 @@ export default class VulnerabilityList extends React.PureComponent<Props, State> overlay={this.renderOverlay(this.state.standards[type][category].description)} /> )} - {activeRules === 0 && - totalRules > 0 && + {finding.activeRules === 0 && + finding.totalRules > 0 && + category !== 'cwe' && category !== 'unknown' && ( <HelpTooltip className="spacer-left" - overlay={this.renderMoreRulesOverlay(totalRules, type, category)}> + overlay={this.renderMoreRulesOverlay(type, category)}> <PlusCircleIcon className="vertical-middle" fill={theme.blue} size={12} /> </HelpTooltip> )} @@ -118,18 +119,18 @@ export default class VulnerabilityList extends React.PureComponent<Props, State> // We redirect the user to the rules page, using languages, types, keywords and tags filters // to display the correct list of rules - renderMoreRulesOverlay = (totalRules: number, type: StandardType, category: string) => { + renderMoreRulesOverlay = (type: StandardType, category: string) => { const languages = this.props.component.qualityProfiles ? this.props.component.qualityProfiles.map(qp => qp.language).join(',') : ''; - let tags; - let q; - if (type === 'cwe') { - q = `${STANDARDS_TAGS[type]}:${category.toLowerCase()}`; - tags = 'cwe'; - } else { - tags = `${STANDARDS_TAGS[type]}-${category.toLowerCase()}`; - } + const sansTopCategoryTags: { [key: string]: string } = { + 'insecure-interaction': 'insecure', + 'porous-defenses': 'porous', + 'risky-resource': 'risky' + }; + const tags = `${STANDARDS_TAGS[type]}-${ + type === 'sansTop25' ? sansTopCategoryTags[category.toLowerCase()] : category.toLowerCase() + }`; return ( <> <p>{translate('security_reports.activate_rules')}</p> @@ -137,10 +138,10 @@ export default class VulnerabilityList extends React.PureComponent<Props, State> <Link className="spacer-left link-no-underline" to={getRulesUrl( - { languages, tags, q, types: `${IssueType.Hotspot},${IssueType.Vulnerability}` }, + { languages, tags, types: [IssueType.Hotspot, IssueType.Vulnerability].join() }, isSonarCloud() ? this.props.component.organization : undefined )}> - {translateWithParameters('security_reports.activate_rules.link', totalRules)} + {translate('security_reports.activate_rules.link')} </Link> </> ); @@ -166,6 +167,28 @@ export default class VulnerabilityList extends React.PureComponent<Props, State> ); }; + renderComponentIssuesLink = ( + activeRules: number, + query: { [x: string]: string | undefined }, + value: number, + tooltip?: JSX.Element + ) => { + if (activeRules === 0) { + return '-'; + } + return value === 0 ? ( + <> + {value} + {tooltip} + </> + ) : ( + <> + <Link to={getComponentIssuesUrl(this.props.component.key, query)}>{value}</Link> + {tooltip} + </> + ); + }; + renderFinding( finding: SecurityHotspot, isCWE?: boolean, @@ -189,25 +212,22 @@ export default class VulnerabilityList extends React.PureComponent<Props, State> : null; const title = getRatingTooltip('security_rating', finding.vulnerabilityRating || 1); - const hasActiveRules = finding.activeRules > 0; return ( <React.Fragment key={finding.category || finding.cwe}> <tr> <td className={classNames({ 'cwe-title-cell': isCWE })}> - {this.getName(finding, isCWE ? 'cwe' : type, finding.activeRules, finding.totalRules)} + {this.getName(finding, isCWE ? 'cwe' : type)} </td> <td className="text-right"> - {!hasActiveRules && '-'} - {hasActiveRules && ( - <div className="display-inline-flex-center"> - <Link - to={getComponentIssuesUrl(component.key, { - ...params, - types: IssueType.Vulnerability, - resolved: 'false' - })}> - {finding.vulnerabilities} - </Link> + <div className="display-inline-flex-center"> + {this.renderComponentIssuesLink( + finding.activeRules, + { + ...params, + types: IssueType.Vulnerability, + resolved: 'false' + }, + finding.vulnerabilities, <Tooltip overlay={title}> <Link className="link-no-underline spacer-left" @@ -219,49 +239,43 @@ export default class VulnerabilityList extends React.PureComponent<Props, State> <Rating value={finding.vulnerabilityRating || 1} /> </Link> </Tooltip> - </div> - )} + )} + </div> </td> <td className="text-right security-column-separator"> - {!hasActiveRules && '-'} - {hasActiveRules && ( - <Link - to={getComponentIssuesUrl(component.key, { - ...params, - types: IssueType.Hotspot, - resolved: 'false', - statuses: 'OPEN,REOPENED' - })}> - {finding.openSecurityHotspots} - </Link> + {this.renderComponentIssuesLink( + finding.activeRules, + { + ...params, + types: IssueType.Hotspot, + resolved: 'false', + statuses: 'OPEN,REOPENED' + }, + finding.openSecurityHotspots )} </td> <td className="text-right"> - {!hasActiveRules && '-'} - {hasActiveRules && ( - <Link - to={getComponentIssuesUrl(component.key, { - ...params, - types: IssueType.Hotspot, - resolutions: 'FIXED', - statuses: 'RESOLVED' - })}> - {finding.toReviewSecurityHotspots} - </Link> + {this.renderComponentIssuesLink( + finding.activeRules, + { + ...params, + types: IssueType.Hotspot, + resolutions: 'FIXED', + statuses: 'RESOLVED' + }, + finding.toReviewSecurityHotspots )} </td> <td className="text-right"> - {!hasActiveRules && '-'} - {hasActiveRules && ( - <Link - to={getComponentIssuesUrl(component.key, { - ...params, - types: IssueType.Hotspot, - resolutions: 'WONTFIX', - statuses: 'RESOLVED' - })}> - {finding.wontFixSecurityHotspots} - </Link> + {this.renderComponentIssuesLink( + finding.activeRules, + { + ...params, + types: IssueType.Hotspot, + resolutions: 'WONTFIX', + statuses: 'RESOLVED' + }, + finding.wontFixSecurityHotspots )} </td> </tr> diff --git a/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/__snapshots__/App-test.tsx.snap b/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/__snapshots__/App-test.tsx.snap index 7f23c59af71..ace4a652592 100644 --- a/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/__snapshots__/App-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/__snapshots__/App-test.tsx.snap @@ -124,31 +124,7 @@ exports[`handle checkbox for cwe display 2`] = ` <div className="alert alert-info spacer-top display-inline-block" > - <FormattedMessage - defaultMessage="security_reports.info" - id="security_reports.info" - tagName="p" - values={ - Object { - "link": <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/coding_rules", - "query": Object { - "types": "VULNERABILITY,SECURITY_HOTSPOT", - }, - } - } - > - security_reports.info.link - </Link>, - "standard": "security_reports.owaspTop10.page", - "total": 1, - } - } - /> + security_reports.more_rules </div> </div> </header> @@ -293,31 +269,7 @@ exports[`renders owaspTop10 1`] = ` <div className="alert alert-info spacer-top display-inline-block" > - <FormattedMessage - defaultMessage="security_reports.info" - id="security_reports.info" - tagName="p" - values={ - Object { - "link": <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/coding_rules", - "query": Object { - "types": "VULNERABILITY,SECURITY_HOTSPOT", - }, - } - } - > - security_reports.info.link - </Link>, - "standard": "security_reports.owaspTop10.page", - "total": 1, - } - } - /> + security_reports.more_rules </div> </div> </header> diff --git a/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/__snapshots__/VulnerabilityList-test.tsx.snap b/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/__snapshots__/VulnerabilityList-test.tsx.snap index ddee9f669d3..bdd6fa5d8eb 100644 --- a/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/__snapshots__/VulnerabilityList-test.tsx.snap +++ b/server/sonar-web/src/main/js/apps/securityReports/components/__tests__/__snapshots__/VulnerabilityList-test.tsx.snap @@ -81,28 +81,8 @@ exports[`renders 1`] = ` <div className="display-inline-flex-center" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a1", - "resolved": "false", - "types": "VULNERABILITY", - }, - } - } - > - 2 - </Link> - <Tooltip - overlay="metric.security_rating.tooltip.E" - > + <React.Fragment> <Link - className="link-no-underline spacer-left" onlyActiveOnIndex={false} style={Object {}} to={ @@ -117,78 +97,89 @@ exports[`renders 1`] = ` } } > - <Rating - value={5} - /> + 2 </Link> - </Tooltip> + <Tooltip + overlay="metric.security_rating.tooltip.E" + > + <Link + className="link-no-underline spacer-left" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "a1", + "resolved": "false", + "types": "VULNERABILITY", + }, + } + } + > + <Rating + value={5} + /> + </Link> + </Tooltip> + </React.Fragment> </div> </td> <td className="text-right security-column-separator" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a1", - "resolved": "false", - "statuses": "OPEN,REOPENED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "a1", + "resolved": "false", + "statuses": "OPEN,REOPENED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 10 - </Link> + > + 10 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a1", - "resolutions": "FIXED", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "a1", + "resolutions": "FIXED", + "statuses": "RESOLVED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 2 - </Link> + > + 2 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a1", - "resolutions": "WONTFIX", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, - } - } - > + <React.Fragment> 0 - </Link> + </React.Fragment> </td> </tr> </React.Fragment> @@ -209,28 +200,8 @@ exports[`renders 1`] = ` <div className="display-inline-flex-center" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a2", - "resolved": "false", - "types": "VULNERABILITY", - }, - } - } - > - 2 - </Link> - <Tooltip - overlay="metric.security_rating.tooltip.E" - > + <React.Fragment> <Link - className="link-no-underline spacer-left" onlyActiveOnIndex={false} style={Object {}} to={ @@ -245,78 +216,89 @@ exports[`renders 1`] = ` } } > - <Rating - value={5} - /> + 2 </Link> - </Tooltip> + <Tooltip + overlay="metric.security_rating.tooltip.E" + > + <Link + className="link-no-underline spacer-left" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "a2", + "resolved": "false", + "types": "VULNERABILITY", + }, + } + } + > + <Rating + value={5} + /> + </Link> + </Tooltip> + </React.Fragment> </div> </td> <td className="text-right security-column-separator" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a2", - "resolved": "false", - "statuses": "OPEN,REOPENED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "a2", + "resolved": "false", + "statuses": "OPEN,REOPENED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 10 - </Link> + > + 10 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a2", - "resolutions": "FIXED", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "a2", + "resolutions": "FIXED", + "statuses": "RESOLVED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 2 - </Link> + > + 2 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a2", - "resolutions": "WONTFIX", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, - } - } - > + <React.Fragment> 0 - </Link> + </React.Fragment> </td> </tr> </React.Fragment> @@ -348,14 +330,13 @@ exports[`renders 1`] = ` "pathname": "/coding_rules", "query": Object { "languages": "", - "q": undefined, "tags": "owasp-a3", "types": "SECURITY_HOTSPOT,VULNERABILITY", }, } } > - security_reports.activate_rules.link.1 + security_reports.activate_rules.link </Link> </React.Fragment> } @@ -371,7 +352,11 @@ exports[`renders 1`] = ` <td className="text-right" > - - + <div + className="display-inline-flex-center" + > + - + </div> </td> <td className="text-right security-column-separator" @@ -407,28 +392,8 @@ exports[`renders 1`] = ` <div className="display-inline-flex-center" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "unknown", - "resolved": "false", - "types": "VULNERABILITY", - }, - } - } - > - 3 - </Link> - <Tooltip - overlay="metric.security_rating.tooltip.C" - > + <React.Fragment> <Link - className="link-no-underline spacer-left" onlyActiveOnIndex={false} style={Object {}} to={ @@ -443,78 +408,106 @@ exports[`renders 1`] = ` } } > - <Rating - value={3} - /> + 3 </Link> - </Tooltip> + <Tooltip + overlay="metric.security_rating.tooltip.C" + > + <Link + className="link-no-underline spacer-left" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "unknown", + "resolved": "false", + "types": "VULNERABILITY", + }, + } + } + > + <Rating + value={3} + /> + </Link> + </Tooltip> + </React.Fragment> </div> </td> <td className="text-right security-column-separator" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "unknown", - "resolved": "false", - "statuses": "OPEN,REOPENED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "unknown", + "resolved": "false", + "statuses": "OPEN,REOPENED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 100 - </Link> + > + 100 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "unknown", - "resolutions": "FIXED", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "unknown", + "resolutions": "FIXED", + "statuses": "RESOLVED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 8 - </Link> + > + 8 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "unknown", - "resolutions": "WONTFIX", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "unknown", + "resolutions": "WONTFIX", + "statuses": "RESOLVED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 10 - </Link> + > + 10 + </Link> + </React.Fragment> </td> </tr> </React.Fragment> @@ -604,28 +597,8 @@ exports[`renders with cwe 1`] = ` <div className="display-inline-flex-center" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a1", - "resolved": "false", - "types": "VULNERABILITY", - }, - } - } - > - 2 - </Link> - <Tooltip - overlay="metric.security_rating.tooltip.E" - > + <React.Fragment> <Link - className="link-no-underline spacer-left" onlyActiveOnIndex={false} style={Object {}} to={ @@ -640,78 +613,89 @@ exports[`renders with cwe 1`] = ` } } > - <Rating - value={5} - /> + 2 </Link> - </Tooltip> + <Tooltip + overlay="metric.security_rating.tooltip.E" + > + <Link + className="link-no-underline spacer-left" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "a1", + "resolved": "false", + "types": "VULNERABILITY", + }, + } + } + > + <Rating + value={5} + /> + </Link> + </Tooltip> + </React.Fragment> </div> </td> <td className="text-right security-column-separator" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a1", - "resolved": "false", - "statuses": "OPEN,REOPENED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "a1", + "resolved": "false", + "statuses": "OPEN,REOPENED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 10 - </Link> + > + 10 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a1", - "resolutions": "FIXED", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "a1", + "resolutions": "FIXED", + "statuses": "RESOLVED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 2 - </Link> + > + 2 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a1", - "resolutions": "WONTFIX", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, - } - } - > + <React.Fragment> 0 - </Link> + </React.Fragment> </td> </tr> <React.Fragment @@ -731,29 +715,8 @@ exports[`renders with cwe 1`] = ` <div className="display-inline-flex-center" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "cwe": "42", - "id": "foo", - "owaspTop10": "a1", - "resolved": "false", - "types": "VULNERABILITY", - }, - } - } - > - 1 - </Link> - <Tooltip - overlay="metric.security_rating.tooltip.A" - > + <React.Fragment> <Link - className="link-no-underline spacer-left" onlyActiveOnIndex={false} style={Object {}} to={ @@ -769,81 +732,92 @@ exports[`renders with cwe 1`] = ` } } > - <Rating - value={1} - /> + 1 </Link> - </Tooltip> + <Tooltip + overlay="metric.security_rating.tooltip.A" + > + <Link + className="link-no-underline spacer-left" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "cwe": "42", + "id": "foo", + "owaspTop10": "a1", + "resolved": "false", + "types": "VULNERABILITY", + }, + } + } + > + <Rating + value={1} + /> + </Link> + </Tooltip> + </React.Fragment> </div> </td> <td className="text-right security-column-separator" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "cwe": "42", - "id": "foo", - "owaspTop10": "a1", - "resolved": "false", - "statuses": "OPEN,REOPENED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "cwe": "42", + "id": "foo", + "owaspTop10": "a1", + "resolved": "false", + "statuses": "OPEN,REOPENED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 10 - </Link> + > + 10 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "cwe": "42", - "id": "foo", - "owaspTop10": "a1", - "resolutions": "FIXED", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "cwe": "42", + "id": "foo", + "owaspTop10": "a1", + "resolutions": "FIXED", + "statuses": "RESOLVED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 2 - </Link> + > + 2 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "cwe": "42", - "id": "foo", - "owaspTop10": "a1", - "resolutions": "WONTFIX", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, - } - } - > + <React.Fragment> 0 - </Link> + </React.Fragment> </td> </tr> </React.Fragment> @@ -865,28 +839,8 @@ exports[`renders with cwe 1`] = ` <div className="display-inline-flex-center" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a2", - "resolved": "false", - "types": "VULNERABILITY", - }, - } - } - > - 2 - </Link> - <Tooltip - overlay="metric.security_rating.tooltip.E" - > + <React.Fragment> <Link - className="link-no-underline spacer-left" onlyActiveOnIndex={false} style={Object {}} to={ @@ -901,78 +855,89 @@ exports[`renders with cwe 1`] = ` } } > - <Rating - value={5} - /> + 2 </Link> - </Tooltip> + <Tooltip + overlay="metric.security_rating.tooltip.E" + > + <Link + className="link-no-underline spacer-left" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "a2", + "resolved": "false", + "types": "VULNERABILITY", + }, + } + } + > + <Rating + value={5} + /> + </Link> + </Tooltip> + </React.Fragment> </div> </td> <td className="text-right security-column-separator" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a2", - "resolved": "false", - "statuses": "OPEN,REOPENED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "a2", + "resolved": "false", + "statuses": "OPEN,REOPENED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 10 - </Link> + > + 10 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a2", - "resolutions": "FIXED", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "a2", + "resolutions": "FIXED", + "statuses": "RESOLVED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 2 - </Link> + > + 2 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "a2", - "resolutions": "WONTFIX", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, - } - } - > + <React.Fragment> 0 - </Link> + </React.Fragment> </td> </tr> <React.Fragment @@ -992,29 +957,8 @@ exports[`renders with cwe 1`] = ` <div className="display-inline-flex-center" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "cwe": "42", - "id": "foo", - "owaspTop10": "a2", - "resolved": "false", - "types": "VULNERABILITY", - }, - } - } - > - 1 - </Link> - <Tooltip - overlay="metric.security_rating.tooltip.A" - > + <React.Fragment> <Link - className="link-no-underline spacer-left" onlyActiveOnIndex={false} style={Object {}} to={ @@ -1030,81 +974,92 @@ exports[`renders with cwe 1`] = ` } } > - <Rating - value={1} - /> + 1 </Link> - </Tooltip> + <Tooltip + overlay="metric.security_rating.tooltip.A" + > + <Link + className="link-no-underline spacer-left" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "cwe": "42", + "id": "foo", + "owaspTop10": "a2", + "resolved": "false", + "types": "VULNERABILITY", + }, + } + } + > + <Rating + value={1} + /> + </Link> + </Tooltip> + </React.Fragment> </div> </td> <td className="text-right security-column-separator" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "cwe": "42", - "id": "foo", - "owaspTop10": "a2", - "resolved": "false", - "statuses": "OPEN,REOPENED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "cwe": "42", + "id": "foo", + "owaspTop10": "a2", + "resolved": "false", + "statuses": "OPEN,REOPENED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 10 - </Link> + > + 10 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "cwe": "42", - "id": "foo", - "owaspTop10": "a2", - "resolutions": "FIXED", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "cwe": "42", + "id": "foo", + "owaspTop10": "a2", + "resolutions": "FIXED", + "statuses": "RESOLVED", + "types": "SECURITY_HOTSPOT", + }, + } } - } - > - 2 - </Link> + > + 2 + </Link> + </React.Fragment> </td> <td className="text-right" > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "cwe": "42", - "id": "foo", - "owaspTop10": "a2", - "resolutions": "WONTFIX", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, - } - } - > + <React.Fragment> 0 - </Link> + </React.Fragment> </td> </tr> </React.Fragment> @@ -1137,14 +1092,13 @@ exports[`renders with cwe 1`] = ` "pathname": "/coding_rules", "query": Object { "languages": "", - "q": undefined, "tags": "owasp-a3", "types": "SECURITY_HOTSPOT,VULNERABILITY", }, } } > - security_reports.activate_rules.link.1 + security_reports.activate_rules.link </Link> </React.Fragment> } @@ -1160,7 +1114,11 @@ exports[`renders with cwe 1`] = ` <td className="text-right" > - - + <div + className="display-inline-flex-center" + > + - + </div> </td> <td className="text-right security-column-separator" @@ -1195,6 +1153,82 @@ exports[`renders with cwe 1`] = ` <div className="display-inline-flex-center" > + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "cwe": "42", + "id": "foo", + "owaspTop10": "a3", + "resolved": "false", + "types": "VULNERABILITY", + }, + } + } + > + 1 + </Link> + <Tooltip + overlay="metric.security_rating.tooltip.A" + > + <Link + className="link-no-underline spacer-left" + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "cwe": "42", + "id": "foo", + "owaspTop10": "a3", + "resolved": "false", + "types": "VULNERABILITY", + }, + } + } + > + <Rating + value={1} + /> + </Link> + </Tooltip> + </React.Fragment> + </div> + </td> + <td + className="text-right security-column-separator" + > + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "cwe": "42", + "id": "foo", + "owaspTop10": "a3", + "resolved": "false", + "statuses": "OPEN,REOPENED", + "types": "SECURITY_HOTSPOT", + }, + } + } + > + 10 + </Link> + </React.Fragment> + </td> + <td + className="text-right" + > + <React.Fragment> <Link onlyActiveOnIndex={false} style={Object {}} @@ -1205,16 +1239,64 @@ exports[`renders with cwe 1`] = ` "cwe": "42", "id": "foo", "owaspTop10": "a3", + "resolutions": "FIXED", + "statuses": "RESOLVED", + "types": "SECURITY_HOTSPOT", + }, + } + } + > + 2 + </Link> + </React.Fragment> + </td> + <td + className="text-right" + > + <React.Fragment> + 0 + </React.Fragment> + </td> + </tr> + </React.Fragment> + </React.Fragment> + <React.Fragment + key="unknown" + > + <tr> + <td + className="" + > + <React.Fragment> + UNKNOWN + </React.Fragment> + </td> + <td + className="text-right" + > + <div + className="display-inline-flex-center" + > + <React.Fragment> + <Link + onlyActiveOnIndex={false} + style={Object {}} + to={ + Object { + "pathname": "/project/issues", + "query": Object { + "id": "foo", + "owaspTop10": "unknown", "resolved": "false", "types": "VULNERABILITY", }, } } > - 1 + 3 </Link> <Tooltip - overlay="metric.security_rating.tooltip.A" + overlay="metric.security_rating.tooltip.C" > <Link className="link-no-underline spacer-left" @@ -1224,9 +1306,8 @@ exports[`renders with cwe 1`] = ` Object { "pathname": "/project/issues", "query": Object { - "cwe": "42", "id": "foo", - "owaspTop10": "a3", + "owaspTop10": "unknown", "resolved": "false", "types": "VULNERABILITY", }, @@ -1234,15 +1315,17 @@ exports[`renders with cwe 1`] = ` } > <Rating - value={1} + value={3} /> </Link> </Tooltip> - </div> - </td> - <td - className="text-right security-column-separator" - > + </React.Fragment> + </div> + </td> + <td + className="text-right security-column-separator" + > + <React.Fragment> <Link onlyActiveOnIndex={false} style={Object {}} @@ -1250,9 +1333,8 @@ exports[`renders with cwe 1`] = ` Object { "pathname": "/project/issues", "query": Object { - "cwe": "42", "id": "foo", - "owaspTop10": "a3", + "owaspTop10": "unknown", "resolved": "false", "statuses": "OPEN,REOPENED", "types": "SECURITY_HOTSPOT", @@ -1260,12 +1342,14 @@ exports[`renders with cwe 1`] = ` } } > - 10 + 100 </Link> - </td> - <td - className="text-right" - > + </React.Fragment> + </td> + <td + className="text-right" + > + <React.Fragment> <Link onlyActiveOnIndex={false} style={Object {}} @@ -1273,9 +1357,8 @@ exports[`renders with cwe 1`] = ` Object { "pathname": "/project/issues", "query": Object { - "cwe": "42", "id": "foo", - "owaspTop10": "a3", + "owaspTop10": "unknown", "resolutions": "FIXED", "statuses": "RESOLVED", "types": "SECURITY_HOTSPOT", @@ -1283,52 +1366,14 @@ exports[`renders with cwe 1`] = ` } } > - 2 - </Link> - </td> - <td - className="text-right" - > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "cwe": "42", - "id": "foo", - "owaspTop10": "a3", - "resolutions": "WONTFIX", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, - } - } - > - 0 + 8 </Link> - </td> - </tr> - </React.Fragment> - </React.Fragment> - <React.Fragment - key="unknown" - > - <tr> - <td - className="" - > - <React.Fragment> - UNKNOWN </React.Fragment> </td> <td className="text-right" > - <div - className="display-inline-flex-center" - > + <React.Fragment> <Link onlyActiveOnIndex={false} style={Object {}} @@ -1338,105 +1383,16 @@ exports[`renders with cwe 1`] = ` "query": Object { "id": "foo", "owaspTop10": "unknown", - "resolved": "false", - "types": "VULNERABILITY", + "resolutions": "WONTFIX", + "statuses": "RESOLVED", + "types": "SECURITY_HOTSPOT", }, } } > - 3 + 10 </Link> - <Tooltip - overlay="metric.security_rating.tooltip.C" - > - <Link - className="link-no-underline spacer-left" - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "unknown", - "resolved": "false", - "types": "VULNERABILITY", - }, - } - } - > - <Rating - value={3} - /> - </Link> - </Tooltip> - </div> - </td> - <td - className="text-right security-column-separator" - > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "unknown", - "resolved": "false", - "statuses": "OPEN,REOPENED", - "types": "SECURITY_HOTSPOT", - }, - } - } - > - 100 - </Link> - </td> - <td - className="text-right" - > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "unknown", - "resolutions": "FIXED", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, - } - } - > - 8 - </Link> - </td> - <td - className="text-right" - > - <Link - onlyActiveOnIndex={false} - style={Object {}} - to={ - Object { - "pathname": "/project/issues", - "query": Object { - "id": "foo", - "owaspTop10": "unknown", - "resolutions": "WONTFIX", - "statuses": "RESOLVED", - "types": "SECURITY_HOTSPOT", - }, - } - } - > - 10 - </Link> + </React.Fragment> </td> </tr> </React.Fragment> diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index 5b3b5b031e6..aaeadbb45f8 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -2044,8 +2044,7 @@ organizations_permissions.provisioning.desc=Ability to initialize a project so i # SECURITY REPORTS PAGE # #------------------------------------------------------------------------------ -security_reports.info={total} additional rules related to {standard} Security Standards {link} but not used in this project's profiles. -security_reports.info.link=are available +security_reports.more_rules=Additional security-related rules are available but not active in your profiles. security_reports.owaspTop10.page=OWASP Top 10 security_reports.sansTop25.page=SANS Top 25 security_reports.owaspTop10.description=Track Vulnerabilities and Security Hotspots conforming to OWASP Top 10 standard. @@ -2058,7 +2057,7 @@ security_reports.line.wont_fix=Won't Fix security_reports.line.in_review=In Review security_reports.cwe.show=Show CWE distribution security_reports.activate_rules=Activate rules in this category to detect more security hotspots -security_reports.activate_rules.link=See all {0} rules related to this category +security_reports.activate_rules.link=See all rules related to this category #------------------------------------------------------------------------------ # |