forked from p15670423/monkey
"type" param renamed to "finding_type" in finding DAO
Fixed bug, which happened due to type -> finding_type refactoring
This commit is contained in:
parent
46abff412d
commit
ba947a6b30
|
@ -34,7 +34,7 @@ class Finding(Document):
|
|||
# SCHEMA
|
||||
test = StringField(required=True, choices=zero_trust_consts.TESTS)
|
||||
status = StringField(required=True, choices=zero_trust_consts.ORDERED_TEST_STATUSES)
|
||||
type = StringField(required=True, choices=zero_trust_consts.FINDING_TYPES)
|
||||
finding_type = StringField(required=True, choices=zero_trust_consts.FINDING_TYPES)
|
||||
details = GenericLazyReferenceField(choices=[MonkeyFindingDetails, ScoutSuiteFindingDetails], required=True)
|
||||
# http://docs.mongoengine.org/guide/defining-documents.html#document-inheritance
|
||||
meta = {'allow_inheritance': True}
|
||||
|
@ -54,7 +54,7 @@ class Finding(Document):
|
|||
temp_finding = Finding(test=test,
|
||||
status=status,
|
||||
details=detail_ref,
|
||||
type=Finding._get_finding_type_by_details(detail_ref))
|
||||
finding_type=Finding._get_finding_type_by_details(detail_ref))
|
||||
temp_finding.save()
|
||||
return temp_finding
|
||||
|
||||
|
|
|
@ -12,9 +12,9 @@ class FindingService:
|
|||
findings = list(Finding.objects)
|
||||
details = []
|
||||
for i in range(len(findings)):
|
||||
if findings[i].type == zero_trust_consts.MONKEY_FINDING:
|
||||
if findings[i].finding_type == zero_trust_consts.MONKEY_FINDING:
|
||||
details = MonkeyDetailsService.fetch_details_for_display(findings[i].details.id)
|
||||
elif findings[i].type == zero_trust_consts.SCOUTSUITE_FINDING:
|
||||
elif findings[i].finding_type == zero_trust_consts.SCOUTSUITE_FINDING:
|
||||
details = findings[i].details.fetch().to_mongo()
|
||||
findings[i] = findings[i].to_mongo()
|
||||
findings[i] = FindingService.get_enriched_finding(findings[i])
|
||||
|
@ -30,6 +30,6 @@ class FindingService:
|
|||
'test_key': finding['test'],
|
||||
'pillars': test_info[zero_trust_consts.PILLARS_KEY],
|
||||
'status': finding['status'],
|
||||
'type': finding['type']
|
||||
'finding_type': finding['finding_type']
|
||||
}
|
||||
return enriched_finding
|
||||
|
|
|
@ -12,7 +12,7 @@ class ScoutSuiteFindingService:
|
|||
@staticmethod
|
||||
# TODO add type hinting like finding: Union[SCOUTSUITE_FINDINGS]?
|
||||
def process_rule(finding, rule: ScoutSuiteRule):
|
||||
existing_findings = Finding.objects(test=finding.test, type=zero_trust_consts.SCOUTSUITE_FINDING)
|
||||
existing_findings = Finding.objects(test=finding.test, finding_type=zero_trust_consts.SCOUTSUITE_FINDING)
|
||||
assert (len(existing_findings) < 2), "More than one finding exists for {}".format(finding.test)
|
||||
|
||||
if len(existing_findings) == 0:
|
||||
|
|
|
@ -22,10 +22,10 @@ export class FindingsTable extends Component {
|
|||
{
|
||||
Header: 'Details', id: 'details',
|
||||
accessor: x => {
|
||||
if (x.type === 'scoutsuite_finding') {
|
||||
if (x.finding_type === 'scoutsuite_finding') {
|
||||
return <ScoutSuiteRuleButton scoutsuite_rules={x.details.scoutsuite_rules}
|
||||
scoutsuite_data={this.props.scoutsuite_data}/>;
|
||||
} else if (x.type === 'monkey_finding') {
|
||||
} else if (x.finding_type === 'monkey_finding') {
|
||||
return <EventsButton finding_id={x.finding_id}
|
||||
latest_events={x.details.latest_events}
|
||||
oldest_events={x.details.oldest_events}
|
||||
|
|
Loading…
Reference in New Issue