Skip to content
Merged
Prev Previous commit
Next Next commit
brendan foodback round 2
  • Loading branch information
exterkamp committed Jun 25, 2019
commit fa189b67bdeb30ec7ad595e7bd191cb2d02150b6
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ const Audit = require('../audit.js');
const i18n = require('../../lib/i18n/i18n.js');

const UIStrings = {
/** Title of a Lighthouse audit that provides detail on the cross-origin links that the page contains, and whether they can be considered safe. This descriptive title is shown to users when all links are safe. */
/** Title of a Lighthouse audit that provides detail on the cross-origin links that the web page contains, and whether the links can be considered safe. This descriptive title is shown to users when all links are safe. */
title: 'Links to cross-origin destinations are safe',
/** Title of a Lighthouse audit that provides detail on the cross-origin links that the page contains, and whether they can be considered safe. This descriptive title is shown to users when not all links can be considered safe. */
/** Title of a Lighthouse audit that provides detail on the cross-origin links that the web page contains, and whether the links can be considered safe. This descriptive title is shown to users when not all links can be considered safe. */
failureTitle: 'Links to cross-origin destinations are unsafe',
/** Description of a Lighthouse audit that tells the user why and how they should secure cross-origin links. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Add `rel="noopener"` or `rel="noreferrer"` to any external links to improve ' +
Expand All @@ -21,9 +21,9 @@ const UIStrings = {
/** Warning that some links' destinations cannot be determined and therefore the audit cannot evaluate the link's safety. */
warning: 'Unable to determine the destination for anchor ({anchorHTML}). ' +
'If not used as a hyperlink, consider removing target=_blank.',
/** Table column header for the target attribute of the link. Each entry is either an empty string or a string like `_blank`. */
/** Label for a column in a data table; entries will be the target attribute of a link. Each entry is either an empty string or a string like `_blank`. */
columnTarget: 'Target',
/** Table column header for the `rel=` value from the link. */
/** Label for a column in a data table; entries will be the values of the html "rel" attribute from link in a page. */
columnRel: 'Rel',
};

Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/audits/dobetterweb/js-libraries.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ const UIStrings = {
title: 'Detected JavaScript libraries',
/** Description of a Lighthouse audit that tells the user what this audit is detecting. This is displayed after a user expands the section to see more. No character length limits. */
description: 'All front-end JavaScript libraries detected on the page.',
/** Table column header for the name of the Javascript library. */
/** Label for a column in a data table; entries will be the names of the detected Javascript libraries. */
columnName: 'Name',
/** Table column header for the version of the detected Javascript library. */
/** Label for a column in a data table; entries will be the version numbers of the detected Javascript libraries. */
columnVersion: 'Version',
};

Expand Down
23 changes: 18 additions & 5 deletions lighthouse-core/audits/dobetterweb/no-vulnerable-libraries.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,31 @@ const UIStrings = {
=1 {1 vulnerability detected}
other {# vulnerabilities detected}
}`,
/** Table column header for the version of the Javascript library found. */
/** Label for a column in a data table; entries will be the version numbers of the Javascript libraries found. */
columnVersion: 'Library Version',
/** Table column header for the count of vulnerabilities found within a JavaSscript library. */
/** Label for a column in a data table; entries will be the counts of JavaScript-library vulnerabilities found. */
columnVuln: 'Vulnerability Count',
/** Table column header for the severity of the vulnerabilities found within a Javascript library. */
/** Label for a column in a data table; entries will be the severity of the vulnerabilities found within a Javascript library. */
columnSeverity: 'Highest Severity',
/** Table row value for the severity of a small, or low impact Javascript vulnerability. Part of a ranking scale in the form: low, medium, high. */
rowSeverityLow: 'Low',
/** Table row value for the severity of a Javascript vulnerability. Part of a ranking scale in the form: low, medium, high. */
rowSeverityMedium: 'Medium',
/** Table row value for the severity of a high impact, or dangerous Javascript vulnerability. Part of a ranking scale in the form: low, medium, high. */
rowSeverityHigh: 'High',
};

const str_ = i18n.createMessageInstanceIdFn(__filename, UIStrings);

const SEMVER_REGEX = /^(\d+\.\d+\.\d+)[^-0-9]+/;

/** @type {Object<string, string>} */
const rowMap = {
'low': str_(UIStrings.rowSeverityLow),
'medium': str_(UIStrings.rowSeverityMedium),
'high': str_(UIStrings.rowSeverityHigh),
};

/** @typedef {{npm: Object<string, Array<{id: string, severity: string, semver: {vulnerable: Array<string>}}>>}} SnykDB */
/** @typedef {{severity: string, numericSeverity: number, library: string, url: string}} Vulnerability */

Expand Down Expand Up @@ -133,7 +146,7 @@ class NoVulnerableLibrariesAudit extends Audit {

const vulns = matchingVulns.map(vuln => {
return {
severity: vuln.severity,
severity: rowMap[vuln.severity],
numericSeverity: this.severityMap[vuln.severity],
library: `${lib.name}@${normalizedVersion}`,
url: 'https://snyk.io/vuln/' + vuln.id,
Expand Down Expand Up @@ -179,7 +192,7 @@ class NoVulnerableLibrariesAudit extends Audit {

let highestSeverity;
if (vulns.length > 0) {
highestSeverity = this.highestSeverity(vulns).replace(/^\w/, l => l.toUpperCase());
highestSeverity = this.highestSeverity(vulns);

vulnerabilityResults.push({
highestSeverity,
Expand Down
2 changes: 1 addition & 1 deletion lighthouse-core/audits/image-aspect-ratio.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const UIStrings = {
/** Description of a Lighthouse audit that tells the user why they should maintain the correct aspect ratios for all images. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation. */
description: 'Image display dimensions should match natural aspect ratio. ' +
'[Learn more](https://developers.google.com/web/tools/lighthouse/audits/aspect-ratio).',
/** Warning that the sizing information cannot be collected for an image. */
/** Warning that the size information for an image was nonsensical. `url` will be replaced with the url of that image. */
warningCompute: 'Invalid image sizing information {url}',
/** Label for a column in a data table; entries in the column will be the numeric aspect ratio of an image as displayed in a web page. */
columnDisplayed: 'Aspect Ratio (Displayed)',
Expand Down
32 changes: 22 additions & 10 deletions lighthouse-core/lib/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -709,23 +709,23 @@
},
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | columnRel": {
"message": "Rel",
"description": "Table column header for the `rel=` value from the link."
"description": "Label for a column in a data table; entries will be the values of the html \"rel\" attribute from link in a page."
},
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | columnTarget": {
"message": "Target",
"description": "Table column header for the target attribute of the link. Each entry is either an empty string or a string like `_blank`."
"description": "Label for a column in a data table; entries will be the target attribute of a link. Each entry is either an empty string or a string like `_blank`."
},
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | description": {
"message": "Add `rel=\"noopener\"` or `rel=\"noreferrer\"` to any external links to improve performance and prevent security vulnerabilities. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/noopener).",
"description": "Description of a Lighthouse audit that tells the user why and how they should secure cross-origin links. This is displayed after a user expands the section to see more. No character length limits. 'Learn More' becomes link text to additional documentation."
},
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | failureTitle": {
"message": "Links to cross-origin destinations are unsafe",
"description": "Title of a Lighthouse audit that provides detail on the cross-origin links that the page contains, and whether they can be considered safe. This descriptive title is shown to users when not all links can be considered safe."
"description": "Title of a Lighthouse audit that provides detail on the cross-origin links that the web page contains, and whether the links can be considered safe. This descriptive title is shown to users when not all links can be considered safe."
},
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | title": {
"message": "Links to cross-origin destinations are safe",
"description": "Title of a Lighthouse audit that provides detail on the cross-origin links that the page contains, and whether they can be considered safe. This descriptive title is shown to users when all links are safe."
"description": "Title of a Lighthouse audit that provides detail on the cross-origin links that the web page contains, and whether the links can be considered safe. This descriptive title is shown to users when all links are safe."
},
"lighthouse-core/audits/dobetterweb/external-anchors-use-rel-noopener.js | warning": {
"message": "Unable to determine the destination for anchor ({anchorHTML}). If not used as a hyperlink, consider removing target=_blank.",
Expand All @@ -745,11 +745,11 @@
},
"lighthouse-core/audits/dobetterweb/js-libraries.js | columnName": {
"message": "Name",
"description": "Table column header for the name of the Javascript library."
"description": "Label for a column in a data table; entries will be the names of the detected Javascript libraries."
},
"lighthouse-core/audits/dobetterweb/js-libraries.js | columnVersion": {
"message": "Version",
"description": "Table column header for the version of the detected Javascript library."
"description": "Label for a column in a data table; entries will be the version numbers of the detected Javascript libraries."
},
"lighthouse-core/audits/dobetterweb/js-libraries.js | description": {
"message": "All front-end JavaScript libraries detected on the page.",
Expand All @@ -773,15 +773,15 @@
},
"lighthouse-core/audits/dobetterweb/no-vulnerable-libraries.js | columnSeverity": {
"message": "Highest Severity",
"description": "Table column header for the severity of the vulnerabilities found within a Javascript library."
"description": "Label for a column in a data table; entries will be the severity of the vulnerabilities found within a Javascript library."
},
"lighthouse-core/audits/dobetterweb/no-vulnerable-libraries.js | columnVersion": {
"message": "Library Version",
"description": "Table column header for the version of the Javascript library found."
"description": "Label for a column in a data table; entries will be the version numbers of the Javascript libraries found."
},
"lighthouse-core/audits/dobetterweb/no-vulnerable-libraries.js | columnVuln": {
"message": "Vulnerability Count",
"description": "Table column header for the count of vulnerabilities found within a JavaSscript library."
"description": "Label for a column in a data table; entries will be the counts of JavaScript-library vulnerabilities found."
},
"lighthouse-core/audits/dobetterweb/no-vulnerable-libraries.js | description": {
"message": "Some third-party scripts may contain known security vulnerabilities that are easily identified and exploited by attackers. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/vulnerabilities).",
Expand All @@ -795,6 +795,18 @@
"message": "Includes front-end JavaScript libraries with known security vulnerabilities",
"description": "Title of a Lighthouse audit that provides detail on Javascript libraries the page uses. This descriptive title is shown to users when some detected Javascript libraries have known security vulnerabilities."
},
"lighthouse-core/audits/dobetterweb/no-vulnerable-libraries.js | rowSeverityHigh": {
"message": "High",
"description": "Table row value for the severity of a high impact, or dangerous Javascript vulnerability. Part of a ranking scale in the form: low, medium, high."
},
"lighthouse-core/audits/dobetterweb/no-vulnerable-libraries.js | rowSeverityLow": {
"message": "Low",
"description": "Table row value for the severity of a small, or low impact Javascript vulnerability. Part of a ranking scale in the form: low, medium, high."
},
"lighthouse-core/audits/dobetterweb/no-vulnerable-libraries.js | rowSeverityMedium": {
"message": "Medium",
"description": "Table row value for the severity of a Javascript vulnerability. Part of a ranking scale in the form: low, medium, high."
},
"lighthouse-core/audits/dobetterweb/no-vulnerable-libraries.js | title": {
"message": "Avoids front-end JavaScript libraries with known security vulnerabilities",
"description": "Title of a Lighthouse audit that provides detail on Javascript libraries the page uses. This descriptive title is shown to users when all Javascript libraries are free of known security vulnerabilities."
Expand Down Expand Up @@ -913,7 +925,7 @@
},
"lighthouse-core/audits/image-aspect-ratio.js | warningCompute": {
"message": "Invalid image sizing information {url}",
"description": "Warning that the sizing information cannot be collected for an image."
"description": "Warning that the size information for an image was nonsensical. `url` will be replaced with the url of that image."
},
"lighthouse-core/audits/is-on-https.js | columnInsecureURL": {
"message": "Insecure URL",
Expand Down
5 changes: 4 additions & 1 deletion lighthouse-core/test/results/sample_v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -2701,7 +2701,7 @@
"geolocation-on-start": {
"id": "geolocation-on-start",
"title": "Requests the geolocation permission on page load",
"description": "Users are mistrustful of or confused by sites that request their location without context. Consider tying the request to user gestures instead. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/geolocation-on-load).",
"description": "Users are mistrustful of or confused by sites that request their location without context. Consider tying the request to a user action instead. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/geolocation-on-load).",
"score": 0,
"scoreDisplayMode": "binary",
"details": {
Expand Down Expand Up @@ -5931,6 +5931,9 @@
"lighthouse-core/audits/dobetterweb/no-vulnerable-libraries.js | columnSeverity": [
"audits[no-vulnerable-libraries].details.headings[2].text"
],
"lighthouse-core/audits/dobetterweb/no-vulnerable-libraries.js | rowSeverityMedium": [
"audits[no-vulnerable-libraries].details.items[0].highestSeverity"
],
"lighthouse-core/audits/dobetterweb/js-libraries.js | title": [
"audits[js-libraries].title"
],
Expand Down
2 changes: 1 addition & 1 deletion proto/sample_v2_round_trip.json
Original file line number Diff line number Diff line change
Expand Up @@ -810,7 +810,7 @@
"title": "`<frame>` or `<iframe>` elements have a title"
},
"geolocation-on-start": {
"description": "Users are mistrustful of or confused by sites that request their location without context. Consider tying the request to user gestures instead. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/geolocation-on-load).",
"description": "Users are mistrustful of or confused by sites that request their location without context. Consider tying the request to a user action instead. [Learn more](https://developers.google.com/web/tools/lighthouse/audits/geolocation-on-load).",
"details": {
"headings": [
{
Expand Down