From c736560f09592fb88e60d5382ef6755aecf0462d Mon Sep 17 00:00:00 2001 From: Shreya Date: Mon, 12 Apr 2021 17:30:17 +0530 Subject: [PATCH] Fix "Do not access Object.prototype method 'hasOwnProperty' from target object" eslint warnings --- .../pages/RunMonkeyPage/RunOnAWS/AWSRunOptions.js | 2 +- .../src/components/report-components/SecurityReport.js | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunOnAWS/AWSRunOptions.js b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunOnAWS/AWSRunOptions.js index eba4cf0f3..a1c3cb491 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunOnAWS/AWSRunOptions.js +++ b/monkey/monkey_island/cc/ui/src/components/pages/RunMonkeyPage/RunOnAWS/AWSRunOptions.js @@ -56,7 +56,7 @@ const getContents = (props) => { // update existing state, not run-over let prevRes = result; for (let key in result) { - if (result.hasOwnProperty(key)) { + if (Object.prototype.hasOwnProperty.call(result, key)) { prevRes[key] = result[key]; } } diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js b/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js index c95df5c84..c9fdd2c52 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/SecurityReport.js @@ -437,9 +437,9 @@ class ReportPageComponent extends AuthComponent { isIssuePotentialSecurityIssue(issueName) { let issueDescriptor = this.IssueDescriptorEnum[issueName]; - return issueDescriptor.hasOwnProperty(this.issueContentTypes.TYPE) && + return Object.prototype.hasOwnProperty.call(issueDescriptor, this.issueContentTypes.TYPE) && issueDescriptor[this.issueContentTypes.TYPE] === this.issueTypes.WARNING && - issueDescriptor.hasOwnProperty(this.issueContentTypes.OVERVIEW); + Object.prototype.hasOwnProperty.call(issueDescriptor, this.issueContentTypes.OVERVIEW); } getImmediateThreats() { @@ -476,9 +476,9 @@ class ReportPageComponent extends AuthComponent { isIssueImmediateThreat(issueName) { let issueDescriptor = this.IssueDescriptorEnum[issueName]; - return issueDescriptor.hasOwnProperty(this.issueContentTypes.TYPE) && + return Object.prototype.hasOwnProperty.call(issueDescriptor, this.issueContentTypes.TYPE) && issueDescriptor[this.issueContentTypes.TYPE] === this.issueTypes.DANGER && - issueDescriptor.hasOwnProperty(this.issueContentTypes.OVERVIEW); + Object.prototype.hasOwnProperty.call(issueDescriptor, this.issueContentTypes.OVERVIEW); } getImmediateThreatsOverviews() { @@ -598,7 +598,7 @@ class ReportPageComponent extends AuthComponent { let issueDescriptor = this.IssueDescriptorEnum[issue.type]; let reportFnc = {}; - if (issue.hasOwnProperty('credential_type') && issue.credential_type !== null) { + if (Object.prototype.hasOwnProperty.call(issue, 'credential_type') && issue.credential_type !== null) { reportFnc = issueDescriptor[this.issueContentTypes.REPORT][issue.credential_type]; } else { reportFnc = issueDescriptor[this.issueContentTypes.REPORT];