Skip to content

Commit

Permalink
Update NodeIntegrationJSCheck to respect the default changes
Browse files Browse the repository at this point in the history
  • Loading branch information
baltpeter committed Jun 29, 2020
1 parent 29a8627 commit 3d1beb7
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/finder/checks/AtomicChecks/NodeIntegrationJSCheck.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default class NodeIntegrationJSCheck {
//nodeIntegrationInWorker Boolean (optional) - Whether node integration is enabled in web workers. Default is false
//nodeIntegrationInSubFrames Boolean (optional) - Whether node integration is enabled in in sub-frames such as iframes. Default is false

match(astNode, astHelper, scope){
match(astNode, astHelper, scope, defaults){
if (astNode.type !== 'NewExpression') return null;
if (astNode.callee.name !== 'BrowserWindow' && astNode.callee.name !== 'BrowserView') return null;

Expand All @@ -37,7 +37,7 @@ export default class NodeIntegrationJSCheck {
locations = locations.concat(loc);
}

if (!nodeIntegrationFound) {
if (!nodeIntegrationFound && defaults.nodeIntegration) {
locations.push({ line: astNode.loc.start.line, column: astNode.loc.start.column, id: this.id, description: this.description, shortenedURL: this.shortenedURL, severity: severity.HIGH, confidence: confidence.FIRM, manualReview: false });
}

Expand All @@ -61,7 +61,7 @@ export default class NodeIntegrationJSCheck {
if ((node.key.value === "sandbox" || node.key.name === "sandbox") && isIdentifier) continue;
if ((nodeIntegrationStrings.includes(node.key.value) || nodeIntegrationStrings.includes(node.key.name)) && !isIdentifier) continue;
}

locations.push({
line: node.key.loc.start.line,
column: node.key.loc.start.column,
Expand Down

0 comments on commit 3d1beb7

Please sign in to comment.