diff --git a/monkey/infection_monkey/system_info/collectors/scoutsuite_collector/scoutsuite_api.py b/monkey/infection_monkey/system_info/collectors/scoutsuite_collector/scoutsuite_api.py index 3235f7d34..575058946 100644 --- a/monkey/infection_monkey/system_info/collectors/scoutsuite_collector/scoutsuite_api.py +++ b/monkey/infection_monkey/system_info/collectors/scoutsuite_collector/scoutsuite_api.py @@ -10,6 +10,8 @@ def _add_scoutsuite_to_python_path(): sys.path.append(scoutsuite_path) +# Add ScoutSuite to python path because this way +# we don't need to change any imports in ScoutSuite code _add_scoutsuite_to_python_path() import common.cloud.scoutsuite.ScoutSuite.api_run as scoutsuite_api diff --git a/monkey/infection_monkey/system_info/collectors/scoutsuite_collector/scoutsuite_collector.py b/monkey/infection_monkey/system_info/collectors/scoutsuite_collector/scoutsuite_collector.py index 25b0ea833..7726e980e 100644 --- a/monkey/infection_monkey/system_info/collectors/scoutsuite_collector/scoutsuite_collector.py +++ b/monkey/infection_monkey/system_info/collectors/scoutsuite_collector/scoutsuite_collector.py @@ -1,6 +1,7 @@ import logging import infection_monkey.system_info.collectors.scoutsuite_collector.scoutsuite_api as scoutsuite_api +from common.cloud.scoutsuite.ScoutSuite.providers.aws.provider import AWSProvider from common.cloud.scoutsuite_consts import CloudProviders from common.utils.exceptions import ScoutSuiteScanError from infection_monkey.config import WormConfiguration @@ -26,5 +27,5 @@ def run_scoutsuite(cloud_type: str): aws_session_token=WormConfiguration.aws_session_token) -def send_results(results): +def send_results(results: AWSProvider): ScoutSuiteTelem(results).send() diff --git a/monkey/infection_monkey/telemetry/scoutsuite_telem.py b/monkey/infection_monkey/telemetry/scoutsuite_telem.py index 816042d7c..4e49c0695 100644 --- a/monkey/infection_monkey/telemetry/scoutsuite_telem.py +++ b/monkey/infection_monkey/telemetry/scoutsuite_telem.py @@ -1,11 +1,12 @@ from common.cloud.scoutsuite.ScoutSuite.output.result_encoder import ScoutJsonEncoder +from common.cloud.scoutsuite.ScoutSuite.providers.aws.provider import AWSProvider from common.common_consts.telem_categories import TelemCategoryEnum from infection_monkey.telemetry.base_telem import BaseTelem class ScoutSuiteTelem(BaseTelem): - def __init__(self, data): + def __init__(self, data: AWSProvider): """ Default ScoutSuite telemetry constructor :param data: Data gathered via ScoutSuite diff --git a/monkey/monkey_island/cc/services/zero_trust/scoutsuite/consts/findings.py b/monkey/monkey_island/cc/services/zero_trust/scoutsuite/consts/findings.py index 762f6bf80..3368cbbdf 100644 --- a/monkey/monkey_island/cc/services/zero_trust/scoutsuite/consts/findings.py +++ b/monkey/monkey_island/cc/services/zero_trust/scoutsuite/consts/findings.py @@ -1,4 +1,5 @@ from abc import ABC, abstractmethod +from typing import List from common.common_consts import zero_trust_consts from .rule_names.cloudformation_rules import CloudformationRules @@ -21,12 +22,12 @@ from .rule_names.vpc_rules import VPCRules class ScoutSuiteFinding(ABC): @property @abstractmethod - def rules(self): + def rules(self) -> List[str]: pass @property @abstractmethod - def test(self): + def test(self) -> str: pass diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteDataParser.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteDataParser.js index 729499dec..9657c0bba 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteDataParser.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteDataParser.js @@ -4,10 +4,11 @@ export default class ScoutSuiteDataParser { } /** - * + * Gets value of cloud resource based on path of specific checked field and more abstract template path, + * which describes the scope of resource values. * @param itemPath contains path to a specific value e.g. s3.buckets.da1e7081077ce92.secure_transport_enabled * @param templatePath contains a template path for resource we would want to display e.g. s3.buckets.id - * @returns {*[]|*} + * @returns {*[]|*} resource value e.g. {'bucket_id': 123, 'bucket_max_size': '123GB'} */ getResourceValue(itemPath, templatePath) { let resourcePath = this.fillTemplatePath(itemPath, templatePath); diff --git a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteRuleButton.js b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteRuleButton.js index 316f2f90b..4b46c7c3b 100644 --- a/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteRuleButton.js +++ b/monkey/monkey_island/cc/ui/src/components/report-components/zerotrust/scoutsuite/ScoutSuiteRuleButton.js @@ -40,11 +40,11 @@ export default class ScoutSuiteRuleButton extends Component { } function RuleCountBadge(props) { - const maxRuleCountToShow = 9; - const textForMoreThanMaxRuleCount = maxRuleCountToShow + '+'; + const MAX_RULE_COUNT_TO_SHOW = 9; + const TEXT_FOR_LARGE_RULE_COUNT = MAX_RULE_COUNT_TO_SHOW + '+'; - const ruleCountText = props.count > maxRuleCountToShow ? - textForMoreThanMaxRuleCount : props.count; + const ruleCountText = props.count > MAX_RULE_COUNT_TO_SHOW ? + TEXT_FOR_LARGE_RULE_COUNT : props.count; return {ruleCountText}; }