Skip to content

Commit 6e14dc8

Browse files
committed
add verbosity option (-v) to show the issues' description, migrate to shortened git.io links
1 parent 71acdd8 commit 6e14dc8

46 files changed

Lines changed: 130 additions & 122 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

npm-shrinkwrap.json

Lines changed: 16 additions & 56 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"chalk": "^2.4.1",
4242
"cheerio": "^1.0.0-rc.2",
4343
"cli-progress": "^2.0.0",
44-
"cli-table2": "^0.2.0",
44+
"cli-table3": "^0.5.1",
4545
"escope": "^3.6.0",
4646
"eslint": "^6.5.1",
4747
"esprima": "^4.0.0",

src/finder/checks/AtomicChecks/AffinityHTMLCheck.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export default class AffinityHTMLCheck {
77
this.id = 'AFFINITY_HTML_CHECK';
88
this.description = `Review the use of affinity property`;
99
this.type = sourceTypes.HTML;
10+
this.shortenedURL = "https://git.io/Jeu1z";
1011
}
1112

1213
match(cheerioObj, content) {
@@ -18,7 +19,7 @@ export default class AffinityHTMLCheck {
1819
if (wp) {
1920
let features = parseWebPreferencesFeaturesString(wp);
2021
if (features['affinity'] !== undefined)
21-
loc.push({ line: content.substr(0, elem.startIndex).split('\n').length, column: 0, id: self.id, description: self.description, severity: severity.MEDIUM, confidence: confidence.TENTATIVE, properties: { "AffinityString": features['affinity']}, manualReview: true });
22+
loc.push({ line: content.substr(0, elem.startIndex).split('\n').length, column: 0, id: self.id, description: self.description, shortenedURL: self.shortenedURL, severity: severity.MEDIUM, confidence: confidence.TENTATIVE, properties: { "AffinityString": features['affinity']}, manualReview: true });
2223
}
2324

2425
});

src/finder/checks/AtomicChecks/AffinityJSCheck.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default class AffinityJSCheck {
66
this.id = 'AFFINITY_JS_CHECK';
77
this.description = `Review the use of affinity property`;
88
this.type = sourceTypes.JAVASCRIPT;
9+
this.shortenedURL = "https://git.io/Jeu1z";
910
}
1011

1112
match(astNode, astHelper, scope) {
@@ -26,7 +27,7 @@ export default class AffinityJSCheck {
2627

2728
for (const node of found_nodes) {
2829
if (node.value.value) {
29-
location.push({ line: node.value.loc.start.line, column: node.value.loc.start.column, id: this.id, description: this.description, severity: severity.MEDIUM, confidence: confidence.TENTATIVE, properties: { "AffinityString": node.value.value }, manualReview: true });
30+
location.push({ line: node.value.loc.start.line, column: node.value.loc.start.column, id: this.id, description: this.description, shortenedURL: this.shortenedURL, severity: severity.MEDIUM, confidence: confidence.TENTATIVE, properties: { "AffinityString": node.value.value }, manualReview: true });
3031
}
3132
}
3233
}

src/finder/checks/AtomicChecks/AllowPopupHTMLCheck.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default class AllowPopupsHTMLCheck {
66
this.id = 'ALLOWPOPUPS_HTML_CHECK';
77
this.description = `Do not allow popups in webview`;
88
this.type = sourceTypes.HTML;
9+
this.shortenedURL = "https://git.io/Jeu1V";
910
}
1011

1112
match(cheerioObj, content) {
@@ -15,7 +16,7 @@ export default class AllowPopupsHTMLCheck {
1516
webviews.each(function (i, elem) {
1617
const allowpopups = cheerioObj(this).attr('allowpopups');
1718
if (allowpopups !== undefined) {
18-
loc.push({ line: content.substr(0, elem.startIndex).split('\n').length, column: 0, id: self.id, description: self.description, severity: severity.LOW, confidence: confidence.CERTAIN, manualReview: false });
19+
loc.push({ line: content.substr(0, elem.startIndex).split('\n').length, column: 0, id: self.id, description: self.description, shortenedURL: self.shortenedURL, severity: severity.LOW, confidence: confidence.CERTAIN, manualReview: false });
1920
}
2021

2122
});

src/finder/checks/AtomicChecks/AuxclickHTMLCheck.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default class AuxclickHTMLCheck {
66
this.id = 'AUXCLICK_HTML_CHECK';
77
this.description = `Limit navigation flows to untrusted origins. Middle-click may cause Electron to open a link within a new window`;
88
this.type = sourceTypes.HTML;
9+
this.shortenedURL = "https://git.io/Jeu1P";
910
}
1011

1112
match(cheerioObj, content) {
@@ -17,7 +18,7 @@ export default class AuxclickHTMLCheck {
1718
if(dbf && (dbf === "Auxclick")){
1819
//Nothing to report
1920
}else{
20-
loc.push({ line: content.substr(0, elem.startIndex).split('\n').length, column: 0, id: self.id, description: self.description, severity: severity.MEDIUM, confidence: confidence.FIRM, manualReview: false });
21+
loc.push({ line: content.substr(0, elem.startIndex).split('\n').length, column: 0, id: self.id, description: self.description, shortenedURL: self.shortenedURL, severity: severity.MEDIUM, confidence: confidence.FIRM, manualReview: false });
2122
}
2223
});
2324
return loc;

src/finder/checks/AtomicChecks/AuxclickJSCheck.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default class AuxclickJSCheck {
66
this.id = 'AUXCLICK_JS_CHECK';
77
this.description = `Limit navigation flows to untrusted origins. Middle-click may cause Electron to open a link within a new window`;
88
this.type = sourceTypes.JAVASCRIPT;
9+
this.shortenedURL = "https://git.io/Jeu1K";
910
}
1011

1112
match(astNode, astHelper, scope) {
@@ -27,12 +28,12 @@ export default class AuxclickJSCheck {
2728
if (found_nodes.length > 0) {
2829
for (const node of found_nodes) {
2930
if (node.value.value.indexOf("Auxclick") == -1) {
30-
location.push({ line: node.key.loc.start.line, column: node.key.loc.start.column, id: this.id, description: this.description, severity: severity.MEDIUM, confidence: confidence.FIRM, manualReview: false });
31+
location.push({ line: node.key.loc.start.line, column: node.key.loc.start.column, id: this.id, description: this.description, shortenedURL: this.shortenedURL, severity: severity.MEDIUM, confidence: confidence.FIRM, manualReview: false });
3132
}
3233
}
3334
}
3435
else {
35-
location.push({ line: astNode.loc.start.line, column: astNode.loc.start.column, id: this.id, description: this.description, severity: severity.MEDIUM, confidence: confidence.FIRM, manualReview: false });
36+
location.push({ line: astNode.loc.start.line, column: astNode.loc.start.column, id: this.id, description: this.description, shortenedURL: this.shortenedURL, severity: severity.MEDIUM, confidence: confidence.FIRM, manualReview: false });
3637
}
3738

3839
}

src/finder/checks/AtomicChecks/BlinkFeaturesHTMLCheck.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default class BlinkFeaturesHTMLCheck {
66
this.id = 'BLINK_FEATURES_HTML_CHECK';
77
this.description = `Do not use Chromium's experimental features`;
88
this.type = sourceTypes.HTML;
9+
this.shortenedURL = "https://git.io/Jeu19";
910
}
1011

1112
match(cheerioObj, content) {
@@ -15,15 +16,15 @@ export default class BlinkFeaturesHTMLCheck {
1516
webviews.each(function (i, elem) {
1617
let wp = cheerioObj(this).attr('enableblinkfeatures');
1718
if(wp){
18-
loc.push({ line: content.substr(0, elem.startIndex).split('\n').length, column: 0, id: self.id, description: self.description, severity: severity.LOW, confidence: confidence.CERTAIN, manualReview: true });
19+
loc.push({ line: content.substr(0, elem.startIndex).split('\n').length, column: 0, id: self.id, description: self.description, shortenedURL: self.shortenedURL, severity: severity.LOW, confidence: confidence.CERTAIN, manualReview: true });
1920
}
2021

2122
// search for both names for now
2223
// todo: implement taking electron version into account
2324
// https://github.com/electron/electron/blob/master/docs/api/breaking-changes.md#browserwindow
2425
wp = cheerioObj(this).attr('blinkfeatures');
2526
if(wp){
26-
loc.push({ line: content.substr(0, elem.startIndex).split('\n').length, column: 0, id: self.id, description: self.description, severity: severity.LOW, confidence: confidence.CERTAIN, manualReview: true });
27+
loc.push({ line: content.substr(0, elem.startIndex).split('\n').length, column: 0, id: self.id, description: self.description, shortenedURL: self.shortenedURL, severity: severity.LOW, confidence: confidence.CERTAIN, manualReview: true });
2728
}
2829
});
2930
return loc;

src/finder/checks/AtomicChecks/BlinkFeaturesJSCheck.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default class BlinkFeaturesJSCheck {
66
this.id = 'BLINK_FEATURES_JS_CHECK';
77
this.description = `Do not use Chromium’s experimental features`;
88
this.type = sourceTypes.JAVASCRIPT;
9+
this.shortenedURL = "https://git.io/Jeu1M";
910
}
1011

1112
match(astNode, astHelper, scope){
@@ -29,7 +30,7 @@ export default class BlinkFeaturesJSCheck {
2930
node.key.value === 'blinkFeatures' || node.key.name === 'blinkFeatures'));
3031

3132
for (const node of found_nodes) {
32-
location.push({ line: node.key.loc.start.line, column: node.key.loc.start.column, id: this.id, description: this.description, severity: severity.LOW, confidence: confidence.CERTAIN, manualReview: true });
33+
location.push({ line: node.key.loc.start.line, column: node.key.loc.start.column, id: this.id, description: this.description, shortenedURL: this.shortenedURL, severity: severity.LOW, confidence: confidence.CERTAIN, manualReview: true });
3334
}
3435
}
3536

src/finder/checks/AtomicChecks/CSPHTMLCheck.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ export default class CSPHTMLCheck {
66
this.id = 'CSP_HTML_CHECK';
77
this.description = `A CSP is set for this page using a meta tag`;
88
this.type = sourceTypes.HTML;
9+
this.shortenedURL = "https://git.io/JeuMe";
910
}
1011

1112
match(cheerioObj, content) {
@@ -16,7 +17,7 @@ export default class CSPHTMLCheck {
1617
const httpEquiv = cheerioObj(this).attr('http-equiv');
1718
const cspContent = cheerioObj(this).attr('content');
1819
if (httpEquiv && httpEquiv.toLowerCase() === "Content-Security-Policy".toLowerCase()) {
19-
loc.push({ line: content.substr(0, elem.startIndex).split('\n').length, column: 0, id: self.id, description: self.description, severity: severity.INFORMATIONAL, confidence: confidence.TENTATIVE, properties: { "CSPstring": cspContent }, manualReview: true });
20+
loc.push({ line: content.substr(0, elem.startIndex).split('\n').length, column: 0, id: self.id, description: self.description, shortenedURL: self.shortenedURL, severity: severity.INFORMATIONAL, confidence: confidence.TENTATIVE, properties: { "CSPstring": cspContent }, manualReview: true });
2021
}
2122
});
2223
return loc;

0 commit comments

Comments
 (0)