Skip to content

Commit

Permalink
fix: fixed builder to pass dicationary correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
1101-1 committed Oct 21, 2024
1 parent b33890f commit dff0441
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 10 deletions.
5 changes: 2 additions & 3 deletions plugins/aws/fix_plugin_aws/resource/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
Cloud,
EdgeType,
Finding,
Assessment,
ModelReference,
PhantomBaseResource,
BaseOrganizationalRoot,
Expand Down Expand Up @@ -478,8 +477,8 @@ def __init__(
self.last_run_started_at = last_run_started_at
self.created_at = utc()
self.__builder_cache = {region.safe_name: self}
self._assessment_findings: Dict[AssessmentKey, ResourceFindings] = assessment_findings or defaultdict(
lambda: defaultdict(list)
self._assessment_findings = (
assessment_findings if assessment_findings is not None else defaultdict(lambda: defaultdict(list))
)

if last_run_started_at:
Expand Down
13 changes: 6 additions & 7 deletions plugins/aws/fix_plugin_aws/resource/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,7 @@
from boto3.exceptions import Boto3Error

from fix_plugin_aws.resource.base import AwsResource, AwsApiSpec, GraphBuilder
from fix_plugin_aws.resource.ec2 import AwsEc2Instance
from fix_plugin_aws.resource.ecr import AwsEcrRepository
from fix_plugin_aws.resource.lambda_ import AwsLambdaFunction
from fixlib.baseresources import Assessment, ModelReference, PhantomBaseResource, Severity, Finding
from fixlib.baseresources import Assessment, PhantomBaseResource, Severity, Finding
from fixlib.types import Json
from fixlib.json_bender import Bender, S, ForallBend, Bend, F

Expand Down Expand Up @@ -345,9 +342,6 @@ class AwsInspectorFinding(AwsResource, PhantomBaseResource):
_kind_service: ClassVar[str] = service_name
_metadata: ClassVar[Dict[str, Any]] = {"icon": "log", "group": "management"}
_docs_url: ClassVar[str] = "https://docs.aws.amazon.com/inspector/latest/user/findings-understanding.html"
_reference_kinds: ClassVar[ModelReference] = {
"successors": {"default": [AwsEc2Instance.kind, AwsEcrRepository.kind, AwsLambdaFunction.kind]},
}
_aws_metadata: ClassVar[Dict[str, Any]] = {
"provider_link_tpl": "https://{region_id}.console.aws.amazon.com/inspector/v2/home?region={region_id}#/findings/all",
}
Expand Down Expand Up @@ -454,6 +448,11 @@ def collect_resources(cls, builder: GraphBuilder) -> None:
def check_type_and_adjust_id(
class_type: Optional[str], class_id: Optional[str]
) -> Tuple[Optional[str], Optional[str]]:
# to avoid circular import, defined here
from fix_plugin_aws.resource.ec2 import AwsEc2Instance
from fix_plugin_aws.resource.ecr import AwsEcrRepository
from fix_plugin_aws.resource.lambda_ import AwsLambdaFunction

if not class_id or not class_type:
return None, None
match class_type:
Expand Down

0 comments on commit dff0441

Please sign in to comment.