cartography 0.84.0__py3-none-any.whl → 0.85.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of cartography might be problematic. Click here for more details.

Files changed (33) hide show
  1. cartography/data/indexes.cypher +0 -8
  2. cartography/data/jobs/analysis/aws_s3acl_analysis.json +7 -2
  3. cartography/intel/aws/ec2/instances.py +6 -6
  4. cartography/intel/aws/ec2/network_interfaces.py +186 -213
  5. cartography/intel/aws/ec2/security_groups.py +2 -2
  6. cartography/intel/aws/ec2/subnets.py +2 -2
  7. cartography/intel/aws/eks.py +46 -54
  8. cartography/intel/aws/inspector.py +44 -142
  9. cartography/intel/aws/s3.py +6 -1
  10. cartography/models/aws/ec2/loadbalancerv2.py +0 -0
  11. cartography/models/aws/ec2/networkinterface_instance.py +109 -0
  12. cartography/models/aws/ec2/networkinterfaces.py +36 -49
  13. cartography/models/aws/ec2/privateip_networkinterface.py +72 -0
  14. cartography/models/aws/ec2/{securitygroups.py → securitygroup_instance.py} +9 -6
  15. cartography/models/aws/ec2/securitygroup_networkinterface.py +52 -0
  16. cartography/models/aws/ec2/{subnets.py → subnet_instance.py} +7 -4
  17. cartography/models/aws/ec2/subnet_networkinterface.py +87 -0
  18. cartography/models/aws/eks/__init__.py +0 -0
  19. cartography/models/aws/eks/clusters.py +50 -0
  20. cartography/models/aws/inspector/__init__.py +0 -0
  21. cartography/models/aws/inspector/findings.py +124 -0
  22. cartography/models/aws/inspector/packages.py +73 -0
  23. cartography/util.py +8 -0
  24. {cartography-0.84.0.dist-info → cartography-0.85.1.dist-info}/METADATA +1 -1
  25. {cartography-0.84.0.dist-info → cartography-0.85.1.dist-info}/RECORD +30 -23
  26. cartography/data/jobs/cleanup/aws_import_eks_cleanup.json +0 -15
  27. cartography/data/jobs/cleanup/aws_import_inspector_cleanup.json +0 -35
  28. cartography/data/jobs/cleanup/aws_ingest_network_interfaces_cleanup.json +0 -30
  29. {cartography-0.84.0.dist-info → cartography-0.85.1.dist-info}/LICENSE +0 -0
  30. {cartography-0.84.0.dist-info → cartography-0.85.1.dist-info}/NOTICE +0 -0
  31. {cartography-0.84.0.dist-info → cartography-0.85.1.dist-info}/WHEEL +0 -0
  32. {cartography-0.84.0.dist-info → cartography-0.85.1.dist-info}/entry_points.txt +0 -0
  33. {cartography-0.84.0.dist-info → cartography-0.85.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,72 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.nodes import CartographyNodeProperties
5
+ from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.relationships import CartographyRelProperties
7
+ from cartography.models.core.relationships import CartographyRelSchema
8
+ from cartography.models.core.relationships import LinkDirection
9
+ from cartography.models.core.relationships import make_target_node_matcher
10
+ from cartography.models.core.relationships import OtherRelationships
11
+ from cartography.models.core.relationships import TargetNodeMatcher
12
+
13
+
14
+ @dataclass(frozen=True)
15
+ class EC2PrivateIpNetworkInterfaceNodeProperties(CartographyNodeProperties):
16
+ """
17
+ Selection of properties of a private IP as known by an EC2 network interface
18
+ """
19
+ id: PropertyRef = PropertyRef('Id')
20
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
21
+ network_interface_id: PropertyRef = PropertyRef('NetworkInterfaceId')
22
+ primary: PropertyRef = PropertyRef('Primary')
23
+ private_ip_address: PropertyRef = PropertyRef('PrivateIpAddress')
24
+ public_ip: PropertyRef = PropertyRef('PublicIp')
25
+ ip_owner_id: PropertyRef = PropertyRef('IpOwnerId')
26
+
27
+
28
+ @dataclass(frozen=True)
29
+ class EC2PrivateIpToAwsAccountRelProperties(CartographyRelProperties):
30
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
31
+
32
+
33
+ @dataclass(frozen=True)
34
+ class EC2PrivateIpToAWSAccount(CartographyRelSchema):
35
+ target_node_label: str = 'AWSAccount'
36
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
37
+ {'id': PropertyRef('AWS_ID', set_in_kwargs=True)},
38
+ )
39
+ direction: LinkDirection = LinkDirection.INWARD
40
+ rel_label: str = "RESOURCE"
41
+ properties: EC2PrivateIpToAwsAccountRelProperties = EC2PrivateIpToAwsAccountRelProperties()
42
+
43
+
44
+ @dataclass(frozen=True)
45
+ class EC2NetworkInterfaceToPrivateIpRelProperties(CartographyRelProperties):
46
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
47
+
48
+
49
+ @dataclass(frozen=True)
50
+ class EC2PrivateIpToNetworkInterface(CartographyRelSchema):
51
+ target_node_label: str = 'NetworkInterface'
52
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
53
+ {'id': PropertyRef('NetworkInterfaceId')},
54
+ )
55
+ direction: LinkDirection = LinkDirection.INWARD
56
+ rel_label: str = "PRIVATE_IP_ADDRESS"
57
+ properties: EC2NetworkInterfaceToPrivateIpRelProperties = EC2NetworkInterfaceToPrivateIpRelProperties()
58
+
59
+
60
+ @dataclass(frozen=True)
61
+ class EC2PrivateIpNetworkInterfaceSchema(CartographyNodeSchema):
62
+ """
63
+ PrivateIp as known by a Network Interface
64
+ """
65
+ label: str = 'EC2PrivateIp'
66
+ properties: EC2PrivateIpNetworkInterfaceNodeProperties = EC2PrivateIpNetworkInterfaceNodeProperties()
67
+ sub_resource_relationship: EC2PrivateIpToAWSAccount = EC2PrivateIpToAWSAccount()
68
+ other_relationships: OtherRelationships = OtherRelationships(
69
+ [
70
+ EC2PrivateIpToNetworkInterface(),
71
+ ],
72
+ )
@@ -12,8 +12,8 @@ from cartography.models.core.relationships import TargetNodeMatcher
12
12
 
13
13
 
14
14
  @dataclass(frozen=True)
15
- class EC2SecurityGroupNodeProperties(CartographyNodeProperties):
16
- # arn: PropertyRef = PropertyRef('Arn', extra_index=True) # TODO decide on this
15
+ class EC2SecurityGroupInstanceNodeProperties(CartographyNodeProperties):
16
+ # arn: PropertyRef = PropertyRef('Arn', extra_index=True) # TODO use arn; #1024
17
17
  id: PropertyRef = PropertyRef('GroupId')
18
18
  groupid: PropertyRef = PropertyRef('GroupId', extra_index=True)
19
19
  region: PropertyRef = PropertyRef('Region', set_in_kwargs=True)
@@ -37,7 +37,7 @@ class EC2SecurityGroupToAWSAccount(CartographyRelSchema):
37
37
 
38
38
 
39
39
  @dataclass(frozen=True)
40
- class EC2SubnetToEC2InstanceRelProperties(CartographyRelProperties):
40
+ class EC2SecurityGroupToEC2InstanceRelProperties(CartographyRelProperties):
41
41
  lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
42
42
 
43
43
 
@@ -49,13 +49,16 @@ class EC2SecurityGroupToEC2Instance(CartographyRelSchema):
49
49
  )
50
50
  direction: LinkDirection = LinkDirection.INWARD
51
51
  rel_label: str = "MEMBER_OF_EC2_SECURITY_GROUP"
52
- properties: EC2SubnetToEC2InstanceRelProperties = EC2SubnetToEC2InstanceRelProperties()
52
+ properties: EC2SecurityGroupToEC2InstanceRelProperties = EC2SecurityGroupToEC2InstanceRelProperties()
53
53
 
54
54
 
55
55
  @dataclass(frozen=True)
56
- class EC2SecurityGroupSchema(CartographyNodeSchema):
56
+ class EC2SecurityGroupInstanceSchema(CartographyNodeSchema):
57
+ """
58
+ Security groups as known by describe-ec2-instances
59
+ """
57
60
  label: str = 'EC2SecurityGroup'
58
- properties: EC2SecurityGroupNodeProperties = EC2SecurityGroupNodeProperties()
61
+ properties: EC2SecurityGroupInstanceNodeProperties = EC2SecurityGroupInstanceNodeProperties()
59
62
  sub_resource_relationship: EC2SecurityGroupToAWSAccount = EC2SecurityGroupToAWSAccount()
60
63
  other_relationships: OtherRelationships = OtherRelationships(
61
64
  [
@@ -0,0 +1,52 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.aws.ec2.securitygroup_instance import EC2SecurityGroupToAWSAccount
4
+ from cartography.models.core.common import PropertyRef
5
+ from cartography.models.core.nodes import CartographyNodeProperties
6
+ from cartography.models.core.nodes import CartographyNodeSchema
7
+ from cartography.models.core.relationships import CartographyRelProperties
8
+ from cartography.models.core.relationships import CartographyRelSchema
9
+ from cartography.models.core.relationships import LinkDirection
10
+ from cartography.models.core.relationships import make_target_node_matcher
11
+ from cartography.models.core.relationships import OtherRelationships
12
+ from cartography.models.core.relationships import TargetNodeMatcher
13
+
14
+
15
+ @dataclass(frozen=True)
16
+ class EC2SecurityGroupNetworkInterfaceNodeProperties(CartographyNodeProperties):
17
+ # arn: PropertyRef = PropertyRef('Arn', extra_index=True) # TODO use arn; issue #1024
18
+ id: PropertyRef = PropertyRef('GroupId')
19
+ groupid: PropertyRef = PropertyRef('GroupId', extra_index=True)
20
+ region: PropertyRef = PropertyRef('Region', set_in_kwargs=True)
21
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
22
+
23
+
24
+ @dataclass(frozen=True)
25
+ class EC2SubnetToNetworkInterfaceRelProperties(CartographyRelProperties):
26
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
27
+
28
+
29
+ @dataclass(frozen=True)
30
+ class EC2SecurityGroupToNetworkInterface(CartographyRelSchema):
31
+ target_node_label: str = 'NetworkInterface'
32
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
33
+ {'id': PropertyRef('NetworkInterfaceId')},
34
+ )
35
+ direction: LinkDirection = LinkDirection.INWARD
36
+ rel_label: str = "MEMBER_OF_EC2_SECURITY_GROUP"
37
+ properties: EC2SubnetToNetworkInterfaceRelProperties = EC2SubnetToNetworkInterfaceRelProperties()
38
+
39
+
40
+ @dataclass(frozen=True)
41
+ class EC2SecurityGroupNetworkInterfaceSchema(CartographyNodeSchema):
42
+ """
43
+ Security groups as known by describe-network-interfaces.
44
+ """
45
+ label: str = 'EC2SecurityGroup'
46
+ properties: EC2SecurityGroupNetworkInterfaceNodeProperties = EC2SecurityGroupNetworkInterfaceNodeProperties()
47
+ sub_resource_relationship: EC2SecurityGroupToAWSAccount = EC2SecurityGroupToAWSAccount()
48
+ other_relationships: OtherRelationships = OtherRelationships(
49
+ [
50
+ EC2SecurityGroupToNetworkInterface(),
51
+ ],
52
+ )
@@ -12,8 +12,8 @@ from cartography.models.core.relationships import TargetNodeMatcher
12
12
 
13
13
 
14
14
  @dataclass(frozen=True)
15
- class EC2SubnetNodeProperties(CartographyNodeProperties):
16
- # arn: PropertyRef = PropertyRef('Arn', extra_index=True) TODO decide this
15
+ class EC2SubnetInstanceNodeProperties(CartographyNodeProperties):
16
+ # arn: PropertyRef = PropertyRef('Arn', extra_index=True) TODO use arn; issue #1024
17
17
  id: PropertyRef = PropertyRef('SubnetId')
18
18
  subnet_id: PropertyRef = PropertyRef('SubnetId', extra_index=True)
19
19
  region: PropertyRef = PropertyRef('Region', set_in_kwargs=True)
@@ -53,9 +53,12 @@ class EC2SubnetToEC2Instance(CartographyRelSchema):
53
53
 
54
54
 
55
55
  @dataclass(frozen=True)
56
- class EC2SubnetSchema(CartographyNodeSchema):
56
+ class EC2SubnetInstanceSchema(CartographyNodeSchema):
57
+ """
58
+ EC2 Subnet as known by describe-ec2-instances
59
+ """
57
60
  label: str = 'EC2Subnet'
58
- properties: EC2SubnetNodeProperties = EC2SubnetNodeProperties()
61
+ properties: EC2SubnetInstanceNodeProperties = EC2SubnetInstanceNodeProperties()
59
62
  sub_resource_relationship: EC2SubnetToAWSAccount = EC2SubnetToAWSAccount()
60
63
  other_relationships: OtherRelationships = OtherRelationships(
61
64
  [
@@ -0,0 +1,87 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.aws.ec2.subnet_instance import EC2SubnetToAWSAccount
4
+ from cartography.models.aws.ec2.subnet_instance import EC2SubnetToEC2Instance
5
+ from cartography.models.core.common import PropertyRef
6
+ from cartography.models.core.nodes import CartographyNodeProperties
7
+ from cartography.models.core.nodes import CartographyNodeSchema
8
+ from cartography.models.core.relationships import CartographyRelProperties
9
+ from cartography.models.core.relationships import CartographyRelSchema
10
+ from cartography.models.core.relationships import LinkDirection
11
+ from cartography.models.core.relationships import make_target_node_matcher
12
+ from cartography.models.core.relationships import OtherRelationships
13
+ from cartography.models.core.relationships import TargetNodeMatcher
14
+
15
+
16
+ @dataclass(frozen=True)
17
+ class EC2SubnetNetworkInterfaceNodeProperties(CartographyNodeProperties):
18
+ id: PropertyRef = PropertyRef('SubnetId')
19
+ subnet_id: PropertyRef = PropertyRef('SubnetId', extra_index=True)
20
+ region: PropertyRef = PropertyRef('Region', set_in_kwargs=True)
21
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
22
+
23
+
24
+ @dataclass(frozen=True)
25
+ class EC2SubnetToNetworkInterfaceRelProperties(CartographyRelProperties):
26
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
27
+
28
+
29
+ @dataclass(frozen=True)
30
+ class EC2SubnetToNetworkInterface(CartographyRelSchema):
31
+ target_node_label: str = 'NetworkInterface'
32
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
33
+ {'id': PropertyRef('NetworkInterfaceId')},
34
+ )
35
+ direction: LinkDirection = LinkDirection.INWARD
36
+ rel_label: str = "PART_OF_SUBNET"
37
+ properties: EC2SubnetToNetworkInterfaceRelProperties = EC2SubnetToNetworkInterfaceRelProperties()
38
+
39
+
40
+ @dataclass(frozen=True)
41
+ class EC2SubnetToLoadBalancerRelProperties(CartographyRelProperties):
42
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
43
+
44
+
45
+ @dataclass(frozen=True)
46
+ class EC2SubnetToLoadBalancer(CartographyRelSchema):
47
+ target_node_label: str = 'LoadBalancer'
48
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
49
+ {'id': PropertyRef('ElbV1Id')},
50
+ )
51
+ direction: LinkDirection = LinkDirection.INWARD
52
+ rel_label: str = "PART_OF_SUBNET"
53
+ properties: EC2SubnetToLoadBalancerRelProperties = EC2SubnetToLoadBalancerRelProperties()
54
+
55
+
56
+ @dataclass(frozen=True)
57
+ class EC2SubnetToLoadBalancerV2RelProperties(CartographyRelProperties):
58
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
59
+
60
+
61
+ @dataclass(frozen=True)
62
+ class EC2SubnetToLoadBalancerV2(CartographyRelSchema):
63
+ target_node_label: str = 'LoadBalancerV2'
64
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
65
+ {'id': PropertyRef('ElbV2Id')},
66
+ )
67
+ direction: LinkDirection = LinkDirection.INWARD
68
+ rel_label: str = "PART_OF_SUBNET"
69
+ properties: EC2SubnetToLoadBalancerV2RelProperties = EC2SubnetToLoadBalancerV2RelProperties()
70
+
71
+
72
+ @dataclass(frozen=True)
73
+ class EC2SubnetNetworkInterfaceSchema(CartographyNodeSchema):
74
+ """
75
+ Subnet as known by describe-network-interfaces
76
+ """
77
+ label: str = 'EC2Subnet'
78
+ properties: EC2SubnetNetworkInterfaceNodeProperties = EC2SubnetNetworkInterfaceNodeProperties()
79
+ sub_resource_relationship: EC2SubnetToAWSAccount = EC2SubnetToAWSAccount()
80
+ other_relationships: OtherRelationships = OtherRelationships(
81
+ [
82
+ EC2SubnetToNetworkInterface(),
83
+ EC2SubnetToEC2Instance(),
84
+ EC2SubnetToLoadBalancer(),
85
+ EC2SubnetToLoadBalancerV2(),
86
+ ],
87
+ )
File without changes
@@ -0,0 +1,50 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.nodes import CartographyNodeProperties
5
+ from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.relationships import CartographyRelProperties
7
+ from cartography.models.core.relationships import CartographyRelSchema
8
+ from cartography.models.core.relationships import LinkDirection
9
+ from cartography.models.core.relationships import make_target_node_matcher
10
+ from cartography.models.core.relationships import TargetNodeMatcher
11
+
12
+
13
+ @dataclass(frozen=True)
14
+ class EKSClusterNodeProperties(CartographyNodeProperties):
15
+ id: PropertyRef = PropertyRef('arn')
16
+ arn: PropertyRef = PropertyRef('arn', extra_index=True)
17
+ name: PropertyRef = PropertyRef('name', extra_index=True)
18
+ region: PropertyRef = PropertyRef('Region', set_in_kwargs=True)
19
+ created_at: PropertyRef = PropertyRef('created_at')
20
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
21
+ endpoint: PropertyRef = PropertyRef('endpoint')
22
+ endpoint_public_access: PropertyRef = PropertyRef('ClusterEndpointPublic')
23
+ rolearn: PropertyRef = PropertyRef('roleArn')
24
+ version: PropertyRef = PropertyRef('version')
25
+ platform_version: PropertyRef = PropertyRef('platformVersion')
26
+ status: PropertyRef = PropertyRef('status')
27
+ audit_logging: PropertyRef = PropertyRef('ClusterLogging')
28
+
29
+
30
+ @dataclass(frozen=True)
31
+ class EKSClusterToAwsAccountRelProperties(CartographyRelProperties):
32
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
33
+
34
+
35
+ @dataclass(frozen=True)
36
+ class EKSClusterToAWSAccount(CartographyRelSchema):
37
+ target_node_label: str = 'AWSAccount'
38
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
39
+ {'id': PropertyRef('AWS_ID', set_in_kwargs=True)},
40
+ )
41
+ direction: LinkDirection = LinkDirection.INWARD
42
+ rel_label: str = "RESOURCE"
43
+ properties: EKSClusterToAwsAccountRelProperties = EKSClusterToAwsAccountRelProperties()
44
+
45
+
46
+ @dataclass(frozen=True)
47
+ class EKSClusterSchema(CartographyNodeSchema):
48
+ label: str = 'EKSCluster'
49
+ properties: EKSClusterNodeProperties = EKSClusterNodeProperties()
50
+ sub_resource_relationship: EKSClusterToAWSAccount = EKSClusterToAWSAccount()
File without changes
@@ -0,0 +1,124 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.nodes import CartographyNodeProperties
5
+ from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.nodes import ExtraNodeLabels
7
+ from cartography.models.core.relationships import CartographyRelProperties
8
+ from cartography.models.core.relationships import CartographyRelSchema
9
+ from cartography.models.core.relationships import LinkDirection
10
+ from cartography.models.core.relationships import make_target_node_matcher
11
+ from cartography.models.core.relationships import OtherRelationships
12
+ from cartography.models.core.relationships import TargetNodeMatcher
13
+
14
+
15
+ @dataclass(frozen=True)
16
+ class AWSInspectorNodeProperties(CartographyNodeProperties):
17
+ id: PropertyRef = PropertyRef('id')
18
+ arn: PropertyRef = PropertyRef('arn', extra_index=True)
19
+ awsaccount: PropertyRef = PropertyRef('awsaccount')
20
+ name: PropertyRef = PropertyRef('title')
21
+ instanceid: PropertyRef = PropertyRef('instanceid')
22
+ ecrimageid: PropertyRef = PropertyRef('ecrimageid')
23
+ ecrrepositoryid: PropertyRef = PropertyRef('ecrrepositoryid')
24
+ severity: PropertyRef = PropertyRef('severity')
25
+ firstobservedat: PropertyRef = PropertyRef('firstobservedat')
26
+ updatedat: PropertyRef = PropertyRef('updatedat')
27
+ description: PropertyRef = PropertyRef('description')
28
+ type: PropertyRef = PropertyRef('type')
29
+ cvssscore: PropertyRef = PropertyRef('cvssscore', extra_index=True)
30
+ protocol: PropertyRef = PropertyRef('protocol')
31
+ portrange: PropertyRef = PropertyRef('portrange')
32
+ portrangebegin: PropertyRef = PropertyRef('portrangebegin')
33
+ portrangeend: PropertyRef = PropertyRef('portrangeend')
34
+ vulnerabilityid: PropertyRef = PropertyRef('vulnerabilityid')
35
+ referenceurls: PropertyRef = PropertyRef('referenceurls')
36
+ relatedvulnerabilities: PropertyRef = PropertyRef('relatedvulnerabilities')
37
+ source: PropertyRef = PropertyRef('source')
38
+ sourceurl: PropertyRef = PropertyRef('sourceurl')
39
+ status: PropertyRef = PropertyRef('status')
40
+ vendorcreatedat: PropertyRef = PropertyRef('vendorcreatedat')
41
+ vendorseverity: PropertyRef = PropertyRef('vendorseverity')
42
+ vendorupdatedat: PropertyRef = PropertyRef('vendorupdatedat')
43
+ vulnerablepackageids: PropertyRef = PropertyRef('vulnerablepackageids')
44
+ region: PropertyRef = PropertyRef('Region', set_in_kwargs=True)
45
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
46
+
47
+
48
+ @dataclass(frozen=True)
49
+ class InspectorFindingToAwsAccountRelProperties(CartographyRelProperties):
50
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ class InspectorFindingToAWSAccount(CartographyRelSchema):
55
+ target_node_label: str = 'AWSAccount'
56
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
57
+ {'id': PropertyRef('AWS_ID', set_in_kwargs=True)},
58
+ )
59
+ direction: LinkDirection = LinkDirection.INWARD
60
+ rel_label: str = "RESOURCE"
61
+ properties: InspectorFindingToAwsAccountRelProperties = InspectorFindingToAwsAccountRelProperties()
62
+
63
+
64
+ @dataclass(frozen=True)
65
+ class InspectorFindingToEC2InstanceRelProperties(CartographyRelProperties):
66
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
67
+
68
+
69
+ @dataclass(frozen=True)
70
+ class InspectorFindingToEC2Instance(CartographyRelSchema):
71
+ target_node_label: str = 'EC2Instance'
72
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
73
+ {'id': PropertyRef('instanceid')},
74
+ )
75
+ direction: LinkDirection = LinkDirection.OUTWARD
76
+ rel_label: str = "AFFECTS"
77
+ properties: InspectorFindingToEC2InstanceRelProperties = InspectorFindingToEC2InstanceRelProperties()
78
+
79
+
80
+ @dataclass(frozen=True)
81
+ class InspectorFindingToECRRepositoryRelProperties(CartographyRelProperties):
82
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
83
+
84
+
85
+ @dataclass(frozen=True)
86
+ class InspectorFindingToECRRepository(CartographyRelSchema):
87
+ target_node_label: str = 'ECRRepository'
88
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
89
+ {'id': PropertyRef('ecrrepositoryid')},
90
+ )
91
+ direction: LinkDirection = LinkDirection.OUTWARD
92
+ rel_label: str = "AFFECTS"
93
+ properties: InspectorFindingToECRRepositoryRelProperties = InspectorFindingToECRRepositoryRelProperties()
94
+
95
+
96
+ @dataclass(frozen=True)
97
+ class InspectorFindingToECRImageRelProperties(CartographyRelProperties):
98
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
99
+
100
+
101
+ @dataclass(frozen=True)
102
+ class InspectorFindingToECRImage(CartographyRelSchema):
103
+ target_node_label: str = 'ECRImage'
104
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
105
+ {'id': PropertyRef('ecrimageid')},
106
+ )
107
+ direction: LinkDirection = LinkDirection.OUTWARD
108
+ rel_label: str = "AFFECTS"
109
+ properties: InspectorFindingToECRImageRelProperties = InspectorFindingToECRImageRelProperties()
110
+
111
+
112
+ @dataclass(frozen=True)
113
+ class AWSInspectorFindingSchema(CartographyNodeSchema):
114
+ label: str = 'AWSInspectorFinding'
115
+ properties: AWSInspectorNodeProperties = AWSInspectorNodeProperties()
116
+ extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["Risk"])
117
+ sub_resource_relationship: InspectorFindingToAWSAccount = InspectorFindingToAWSAccount()
118
+ other_relationships: OtherRelationships = OtherRelationships(
119
+ [
120
+ InspectorFindingToEC2Instance(),
121
+ InspectorFindingToECRRepository(),
122
+ InspectorFindingToECRImage(),
123
+ ],
124
+ )
@@ -0,0 +1,73 @@
1
+ from dataclasses import dataclass
2
+
3
+ from cartography.models.core.common import PropertyRef
4
+ from cartography.models.core.nodes import CartographyNodeProperties
5
+ from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.relationships import CartographyRelProperties
7
+ from cartography.models.core.relationships import CartographyRelSchema
8
+ from cartography.models.core.relationships import LinkDirection
9
+ from cartography.models.core.relationships import make_target_node_matcher
10
+ from cartography.models.core.relationships import OtherRelationships
11
+ from cartography.models.core.relationships import TargetNodeMatcher
12
+
13
+
14
+ @dataclass(frozen=True)
15
+ class AWSInspectorPackageNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef('id')
17
+ region: PropertyRef = PropertyRef('Region', set_in_kwargs=True)
18
+ awsaccount: PropertyRef = PropertyRef('AWS_ID', set_in_kwargs=True)
19
+ findingarn: PropertyRef = PropertyRef('findingarn', extra_index=True)
20
+ name: PropertyRef = PropertyRef('name', extra_index=True)
21
+ arch: PropertyRef = PropertyRef('arch')
22
+ version: PropertyRef = PropertyRef('version', extra_index=True)
23
+ release: PropertyRef = PropertyRef('release', extra_index=True)
24
+ epoch: PropertyRef = PropertyRef('epoch')
25
+ manager: PropertyRef = PropertyRef('packageManager')
26
+ filepath: PropertyRef = PropertyRef('filePath')
27
+ fixedinversion: PropertyRef = PropertyRef('fixedInVersion')
28
+ sourcelayerhash: PropertyRef = PropertyRef('sourceLayerHash')
29
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
30
+
31
+
32
+ @dataclass(frozen=True)
33
+ class InspectorPackageToAwsAccountRelProperties(CartographyRelProperties):
34
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
35
+
36
+
37
+ @dataclass(frozen=True)
38
+ class InspectorPackageToAWSAccount(CartographyRelSchema):
39
+ target_node_label: str = 'AWSAccount'
40
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
41
+ {'id': PropertyRef('AWS_ID', set_in_kwargs=True)},
42
+ )
43
+ direction: LinkDirection = LinkDirection.INWARD
44
+ rel_label: str = "RESOURCE"
45
+ properties: InspectorPackageToAwsAccountRelProperties = InspectorPackageToAwsAccountRelProperties()
46
+
47
+
48
+ @dataclass(frozen=True)
49
+ class InspectorPackageToFindingRelProperties(CartographyRelProperties):
50
+ lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
51
+
52
+
53
+ @dataclass(frozen=True)
54
+ class InspectorPackageToFinding(CartographyRelSchema):
55
+ target_node_label: str = 'AWSInspectorFinding'
56
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
57
+ {'id': PropertyRef('findingarn')},
58
+ )
59
+ direction: LinkDirection = LinkDirection.INWARD
60
+ rel_label: str = "HAS"
61
+ properties: InspectorPackageToFindingRelProperties = InspectorPackageToFindingRelProperties()
62
+
63
+
64
+ @dataclass(frozen=True)
65
+ class AWSInspectorPackageSchema(CartographyNodeSchema):
66
+ label: str = 'AWSInspectorPackage'
67
+ properties: AWSInspectorPackageNodeProperties = AWSInspectorPackageNodeProperties()
68
+ sub_resource_relationship: InspectorPackageToAWSAccount = InspectorPackageToAWSAccount()
69
+ other_relationships: OtherRelationships = OtherRelationships(
70
+ [
71
+ InspectorPackageToFinding(),
72
+ ],
73
+ )
cartography/util.py CHANGED
@@ -49,6 +49,14 @@ def run_analysis_job(
49
49
  common_job_parameters: Dict,
50
50
  package: str = 'cartography.data.jobs.analysis',
51
51
  ) -> None:
52
+ """
53
+ Enriches existing graph data with analysis jobs. This is designed for use with the sync stage
54
+ cartography.intel.analysis.
55
+ Runs the queries in the given Python `package` directory (cartography.data.jobs.analysis by default) for the given
56
+ `filename`. All queries in this directory are intended to be run at the end of a full graph sync. As such, they are
57
+ not scoped to a single sub resource. That is they will apply to _all_ AWS accounts/_all_ GCP projects/_all_ Okta
58
+ organizations/etc.
59
+ """
52
60
  GraphJob.run_from_json(
53
61
  neo4j_session,
54
62
  read_text(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cartography
3
- Version: 0.84.0
3
+ Version: 0.85.1
4
4
  Summary: Explore assets and their relationships across your technical infrastructure.
5
5
  Home-page: https://www.github.com/lyft/cartography
6
6
  Maintainer: Lyft