From 1472382387ea967166c3fdea9d09d1315b33806f Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Tue, 12 Jan 2021 10:42:21 +0200 Subject: [PATCH] Fixed react warnings related to keys and
in

--- .../zerotrust/scoutsuite/ResourceDropdown.js | 2 +- .../zerotrust/scoutsuite/RuleDisplay.js | 11 +++++++---- .../zerotrust/scoutsuite/ScoutSuiteRuleModal.js | 5 +++-- .../scoutsuite/ScoutSuiteSingleRuleDropdown.js | 2 +- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ResourceDropdown.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ResourceDropdown.js index 5149219d7..001aa4ef7 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ResourceDropdown.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ResourceDropdown.js @@ -43,7 +43,7 @@ export default function ResourceDropdown(props) { for (let i = 0; i < path_vars.length; i++) { display_path.push(path_vars[i]) if (i !== path_vars.length - 1) { - display_path.push() + display_path.push() } } return display_path; diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/RuleDisplay.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/RuleDisplay.js index b2ba34c79..ddd9968bb 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/RuleDisplay.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/RuleDisplay.js @@ -31,7 +31,8 @@ export default function RuleDisplay(props) { references.push({reference}) + rel="noopener noreferrer" + key={reference}>{reference}) }) return (

@@ -42,13 +43,15 @@ export default function RuleDisplay(props) { function getResources() { let resources = [] - props.rule.items.forEach(item => { + for (let i = 0; i < props.rule.items.length; i++) { + let item = props.rule.items[i]; let template_path = Object.prototype.hasOwnProperty.call(props.rule, 'display_path') ? props.rule.display_path : props.rule.path; resources.push() - }) + scoutsuite_data={props.scoutsuite_data} + key={template_path+i}/>) + } return (

Resources:

diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteRuleModal.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteRuleModal.js index 05058ef8f..926d52b9a 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteRuleModal.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteRuleModal.js @@ -51,7 +51,8 @@ export default function ScoutSuiteRuleModal(props) { let dropdown = ( toggleRuleDropdown(rule.description)} rule={rule} - scoutsuite_data={props.scoutsuite_data}/>) + scoutsuite_data={props.scoutsuite_data} + key={rule.description+rule.path}/>) dropdowns.push(dropdown) }); return dropdowns; @@ -67,7 +68,7 @@ export default function ScoutSuiteRuleModal(props) {

There {Pluralize('is', props.scoutsuite_rules.length)} { -

{props.scoutsuite_rules.length}
+ {props.scoutsuite_rules.length} } ScoutSuite {Pluralize('rule', props.scoutsuite_rules.length)} associated with this finding.

{renderRuleDropdowns()} diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteSingleRuleDropdown.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteSingleRuleDropdown.js index 3500ffe20..72853a1e0 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteSingleRuleDropdown.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteSingleRuleDropdown.js @@ -15,7 +15,7 @@ export default function ScoutSuiteSingleRuleDropdown(props) { function getRuleCollapse() { return ( -