cartography 0.96.0rc2__py3-none-any.whl → 0.96.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.
- cartography/client/core/tx.py +1 -1
- cartography/config.py +2 -2
- cartography/data/jobs/cleanup/github_repos_cleanup.json +25 -0
- cartography/intel/aws/apigateway.py +3 -3
- cartography/intel/aws/ec2/auto_scaling_groups.py +147 -185
- cartography/intel/aws/ec2/instances.py +2 -0
- cartography/intel/aws/ec2/network_acls.py +2 -1
- cartography/intel/aws/ec2/subnets.py +2 -0
- cartography/intel/aws/iam.py +4 -3
- cartography/intel/cve/__init__.py +1 -1
- cartography/intel/cve/feed.py +10 -7
- cartography/intel/github/repos.py +209 -27
- cartography/intel/github/teams.py +160 -38
- cartography/models/aws/ec2/auto_scaling_groups.py +204 -0
- cartography/models/aws/ec2/launch_configurations.py +55 -0
- cartography/models/aws/ec2/network_acl_rules.py +1 -0
- cartography/models/aws/identitycenter/__init__.py +0 -0
- cartography/models/aws/identitycenter/awsidentitycenter.py +44 -0
- cartography/models/aws/identitycenter/awspermissionset.py +84 -0
- cartography/models/aws/identitycenter/awsssouser.py +68 -0
- cartography/models/github/teams.py +29 -0
- cartography/util.py +22 -0
- cartography-0.96.1.dist-info/METADATA +53 -0
- {cartography-0.96.0rc2.dist-info → cartography-0.96.1.dist-info}/RECORD +28 -22
- {cartography-0.96.0rc2.dist-info → cartography-0.96.1.dist-info}/WHEEL +1 -1
- cartography-0.96.0rc2.dist-info/METADATA +0 -53
- {cartography-0.96.0rc2.dist-info → cartography-0.96.1.dist-info}/LICENSE +0 -0
- {cartography-0.96.0rc2.dist-info → cartography-0.96.1.dist-info}/entry_points.txt +0 -0
- {cartography-0.96.0rc2.dist-info → cartography-0.96.1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,204 @@
|
|
|
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 AutoScalingGroupNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef('AutoScalingGroupARN')
|
|
17
|
+
arn: PropertyRef = PropertyRef('AutoScalingGroupARN')
|
|
18
|
+
capacityrebalance: PropertyRef = PropertyRef('CapacityRebalance')
|
|
19
|
+
createdtime: PropertyRef = PropertyRef('CreatedTime')
|
|
20
|
+
defaultcooldown: PropertyRef = PropertyRef('DefaultCooldown')
|
|
21
|
+
desiredcapacity: PropertyRef = PropertyRef('DesiredCapacity')
|
|
22
|
+
healthcheckgraceperiod: PropertyRef = PropertyRef('HealthCheckGracePeriod')
|
|
23
|
+
healthchecktype: PropertyRef = PropertyRef('HealthCheckType')
|
|
24
|
+
launchconfigurationname: PropertyRef = PropertyRef('LaunchConfigurationName')
|
|
25
|
+
launchtemplatename: PropertyRef = PropertyRef('LaunchTemplateName')
|
|
26
|
+
launchtemplateid: PropertyRef = PropertyRef('LaunchTemplateId')
|
|
27
|
+
launchtemplateversion: PropertyRef = PropertyRef('LaunchTemplateVersion')
|
|
28
|
+
maxinstancelifetime: PropertyRef = PropertyRef('MaxInstanceLifetime')
|
|
29
|
+
maxsize: PropertyRef = PropertyRef('MaxSize')
|
|
30
|
+
minsize: PropertyRef = PropertyRef('MinSize')
|
|
31
|
+
name: PropertyRef = PropertyRef('AutoScalingGroupName')
|
|
32
|
+
newinstancesprotectedfromscalein: PropertyRef = PropertyRef('NewInstancesProtectedFromScaleIn')
|
|
33
|
+
region: PropertyRef = PropertyRef('Region', set_in_kwargs=True)
|
|
34
|
+
status: PropertyRef = PropertyRef('Status')
|
|
35
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
# EC2 to AutoScalingGroup
|
|
39
|
+
@dataclass(frozen=True)
|
|
40
|
+
class EC2InstanceToAwsAccountRelProperties(CartographyRelProperties):
|
|
41
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass(frozen=True)
|
|
45
|
+
class EC2InstanceToAWSAccount(CartographyRelSchema):
|
|
46
|
+
target_node_label: str = 'AWSAccount'
|
|
47
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
48
|
+
{'id': PropertyRef('AWS_ID', set_in_kwargs=True)},
|
|
49
|
+
)
|
|
50
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
51
|
+
rel_label: str = "RESOURCE"
|
|
52
|
+
properties: EC2InstanceToAwsAccountRelProperties = EC2InstanceToAwsAccountRelProperties()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(frozen=True)
|
|
56
|
+
class EC2InstanceToAutoScalingGroupRelProperties(CartographyRelProperties):
|
|
57
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass(frozen=True)
|
|
61
|
+
class EC2InstanceToAutoScalingGroup(CartographyRelSchema):
|
|
62
|
+
target_node_label: str = 'AutoScalingGroup'
|
|
63
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
64
|
+
{'id': PropertyRef('AutoScalingGroupARN')},
|
|
65
|
+
)
|
|
66
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
67
|
+
rel_label: str = "MEMBER_AUTO_SCALE_GROUP"
|
|
68
|
+
properties: EC2InstanceToAutoScalingGroupRelProperties = EC2InstanceToAutoScalingGroupRelProperties()
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass(frozen=True)
|
|
72
|
+
class EC2InstanceAutoScalingGroupProperties(CartographyNodeProperties):
|
|
73
|
+
id: PropertyRef = PropertyRef('InstanceId')
|
|
74
|
+
instanceid: PropertyRef = PropertyRef('InstanceId', extra_index=True)
|
|
75
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
76
|
+
region: PropertyRef = PropertyRef('Region', set_in_kwargs=True)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass(frozen=True)
|
|
80
|
+
class EC2InstanceAutoScalingGroupSchema(CartographyNodeSchema):
|
|
81
|
+
label: str = 'EC2Instance'
|
|
82
|
+
properties: EC2InstanceAutoScalingGroupProperties = EC2InstanceAutoScalingGroupProperties()
|
|
83
|
+
sub_resource_relationship: EC2InstanceToAWSAccount = EC2InstanceToAWSAccount()
|
|
84
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
85
|
+
[
|
|
86
|
+
EC2InstanceToAutoScalingGroup(),
|
|
87
|
+
],
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# EC2Subnet to AutoScalingGroup
|
|
92
|
+
@dataclass(frozen=True)
|
|
93
|
+
class EC2SubnetToAwsAccountRelProperties(CartographyRelProperties):
|
|
94
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
@dataclass(frozen=True)
|
|
98
|
+
class EC2SubnetToAWSAccount(CartographyRelSchema):
|
|
99
|
+
target_node_label: str = 'AWSAccount'
|
|
100
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
101
|
+
{'id': PropertyRef('AWS_ID', set_in_kwargs=True)},
|
|
102
|
+
)
|
|
103
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
104
|
+
rel_label: str = "RESOURCE"
|
|
105
|
+
properties: EC2SubnetToAwsAccountRelProperties = EC2SubnetToAwsAccountRelProperties()
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
@dataclass(frozen=True)
|
|
109
|
+
class EC2SubnetToAutoScalingGroupRelProperties(CartographyRelProperties):
|
|
110
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
@dataclass(frozen=True)
|
|
114
|
+
class EC2SubnetToAutoScalingGroup(CartographyRelSchema):
|
|
115
|
+
target_node_label: str = 'AutoScalingGroup'
|
|
116
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
117
|
+
{'id': PropertyRef('AutoScalingGroupARN')},
|
|
118
|
+
)
|
|
119
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
120
|
+
rel_label: str = "VPC_IDENTIFIER"
|
|
121
|
+
properties: EC2SubnetToAutoScalingGroupRelProperties = EC2SubnetToAutoScalingGroupRelProperties()
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@dataclass(frozen=True)
|
|
125
|
+
class EC2SubnetAutoScalingGroupNodeProperties(CartographyNodeProperties):
|
|
126
|
+
id: PropertyRef = PropertyRef('VPCZoneIdentifier')
|
|
127
|
+
subnetid: PropertyRef = PropertyRef('VPCZoneIdentifier', extra_index=True)
|
|
128
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
@dataclass(frozen=True)
|
|
132
|
+
class EC2SubnetAutoScalingGroupSchema(CartographyNodeSchema):
|
|
133
|
+
label: str = 'EC2Subnet'
|
|
134
|
+
properties: EC2SubnetAutoScalingGroupNodeProperties = EC2SubnetAutoScalingGroupNodeProperties()
|
|
135
|
+
sub_resource_relationship: EC2SubnetToAWSAccount = EC2SubnetToAWSAccount()
|
|
136
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
137
|
+
[
|
|
138
|
+
EC2SubnetToAutoScalingGroup(),
|
|
139
|
+
],
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
# AutoScalingGroup
|
|
144
|
+
@dataclass(frozen=True)
|
|
145
|
+
class AutoScalingGroupToAwsAccountRelProperties(CartographyRelProperties):
|
|
146
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
@dataclass(frozen=True)
|
|
150
|
+
class AutoScalingGroupToAWSAccount(CartographyRelSchema):
|
|
151
|
+
target_node_label: str = 'AWSAccount'
|
|
152
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
153
|
+
{'id': PropertyRef('AWS_ID', set_in_kwargs=True)},
|
|
154
|
+
)
|
|
155
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
156
|
+
rel_label: str = "RESOURCE"
|
|
157
|
+
properties: AutoScalingGroupToAwsAccountRelProperties = AutoScalingGroupToAwsAccountRelProperties()
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
@dataclass(frozen=True)
|
|
161
|
+
class AutoScalingGroupToLaunchTemplateRelProperties(CartographyRelProperties):
|
|
162
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
@dataclass(frozen=True)
|
|
166
|
+
class AutoScalingGroupToLaunchTemplate(CartographyRelSchema):
|
|
167
|
+
target_node_label: str = 'LaunchTemplate'
|
|
168
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
169
|
+
{'id': PropertyRef('LaunchTemplateId')},
|
|
170
|
+
)
|
|
171
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
172
|
+
rel_label: str = "HAS_LAUNCH_TEMPLATE"
|
|
173
|
+
properties: AutoScalingGroupToLaunchTemplateRelProperties = AutoScalingGroupToLaunchTemplateRelProperties()
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
@dataclass(frozen=True)
|
|
177
|
+
class AutoScalingGroupToLaunchConfigurationRelProperties(CartographyRelProperties):
|
|
178
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
@dataclass(frozen=True)
|
|
182
|
+
class AutoScalingGroupToLaunchConfiguration(CartographyRelSchema):
|
|
183
|
+
target_node_label: str = 'LaunchConfiguration'
|
|
184
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
185
|
+
{'name': PropertyRef('LaunchConfigurationName')},
|
|
186
|
+
)
|
|
187
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
188
|
+
rel_label: str = "HAS_LAUNCH_CONFIG"
|
|
189
|
+
properties: AutoScalingGroupToLaunchConfigurationRelProperties = (
|
|
190
|
+
AutoScalingGroupToLaunchConfigurationRelProperties()
|
|
191
|
+
)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
@dataclass(frozen=True)
|
|
195
|
+
class AutoScalingGroupSchema(CartographyNodeSchema):
|
|
196
|
+
label: str = 'AutoScalingGroup'
|
|
197
|
+
properties: AutoScalingGroupNodeProperties = AutoScalingGroupNodeProperties()
|
|
198
|
+
sub_resource_relationship: AutoScalingGroupToAWSAccount = AutoScalingGroupToAWSAccount()
|
|
199
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
200
|
+
[
|
|
201
|
+
AutoScalingGroupToLaunchTemplate(),
|
|
202
|
+
AutoScalingGroupToLaunchConfiguration(),
|
|
203
|
+
],
|
|
204
|
+
)
|
|
@@ -0,0 +1,55 @@
|
|
|
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 LaunchConfigurationNodeProperties(CartographyNodeProperties):
|
|
15
|
+
id: PropertyRef = PropertyRef('LaunchConfigurationARN')
|
|
16
|
+
arn: PropertyRef = PropertyRef('LaunchConfigurationARN')
|
|
17
|
+
created_time = PropertyRef('CreatedTime')
|
|
18
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
19
|
+
image_id: PropertyRef = PropertyRef('ImageId')
|
|
20
|
+
key_name: PropertyRef = PropertyRef('KeyName')
|
|
21
|
+
name: PropertyRef = PropertyRef('LaunchConfigurationName')
|
|
22
|
+
security_groups: PropertyRef = PropertyRef('SecurityGroups')
|
|
23
|
+
instance_type: PropertyRef = PropertyRef('InstanceType')
|
|
24
|
+
kernel_id: PropertyRef = PropertyRef('KernelId')
|
|
25
|
+
ramdisk_id: PropertyRef = PropertyRef('RamdiskId')
|
|
26
|
+
instance_monitoring_enabled: PropertyRef = PropertyRef('InstanceMonitoringEnabled')
|
|
27
|
+
spot_price: PropertyRef = PropertyRef('SpotPrice')
|
|
28
|
+
iam_instance_profile: PropertyRef = PropertyRef('IamInstanceProfile')
|
|
29
|
+
ebs_optimized: PropertyRef = PropertyRef('EbsOptimized')
|
|
30
|
+
associate_public_ip_address: PropertyRef = PropertyRef('AssociatePublicIpAddress')
|
|
31
|
+
placement_tenancy: PropertyRef = PropertyRef('PlacementTenancy')
|
|
32
|
+
region: PropertyRef = PropertyRef('Region', set_in_kwargs=True)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass(frozen=True)
|
|
36
|
+
class LaunchConfigurationToAwsAccountRelProperties(CartographyRelProperties):
|
|
37
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass(frozen=True)
|
|
41
|
+
class LaunchConfigurationToAwsAccount(CartographyRelSchema):
|
|
42
|
+
target_node_label: str = 'AWSAccount'
|
|
43
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
44
|
+
{'id': PropertyRef('AWS_ID', set_in_kwargs=True)},
|
|
45
|
+
)
|
|
46
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
47
|
+
rel_label: str = "RESOURCE"
|
|
48
|
+
properties: LaunchConfigurationToAwsAccountRelProperties = LaunchConfigurationToAwsAccountRelProperties()
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@dataclass(frozen=True)
|
|
52
|
+
class LaunchConfigurationSchema(CartographyNodeSchema):
|
|
53
|
+
label: str = 'LaunchConfiguration'
|
|
54
|
+
properties: LaunchConfigurationNodeProperties = LaunchConfigurationNodeProperties()
|
|
55
|
+
sub_resource_relationship: LaunchConfigurationToAwsAccount = LaunchConfigurationToAwsAccount()
|
|
@@ -21,6 +21,7 @@ class EC2NetworkAclRuleNodeProperties(CartographyNodeProperties):
|
|
|
21
21
|
fromport: PropertyRef = PropertyRef('FromPort')
|
|
22
22
|
toport: PropertyRef = PropertyRef('ToPort')
|
|
23
23
|
cidrblock: PropertyRef = PropertyRef('CidrBlock')
|
|
24
|
+
ipv6cidrblock: PropertyRef = PropertyRef('Ipv6CidrBlock')
|
|
24
25
|
egress: PropertyRef = PropertyRef('Egress')
|
|
25
26
|
rulenumber: PropertyRef = PropertyRef('RuleNumber')
|
|
26
27
|
ruleaction: PropertyRef = PropertyRef('RuleAction')
|
|
File without changes
|
|
@@ -0,0 +1,44 @@
|
|
|
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 IdentityCenterInstanceProperties(CartographyNodeProperties):
|
|
15
|
+
identity_store_id: PropertyRef = PropertyRef('IdentityStoreId')
|
|
16
|
+
arn: PropertyRef = PropertyRef('InstanceArn')
|
|
17
|
+
created_date: PropertyRef = PropertyRef('CreatedDate')
|
|
18
|
+
id: PropertyRef = PropertyRef('InstanceArn')
|
|
19
|
+
status: PropertyRef = PropertyRef('Status')
|
|
20
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(frozen=True)
|
|
24
|
+
class IdentityCenterToAwsAccountRelProperties(CartographyRelProperties):
|
|
25
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass(frozen=True)
|
|
29
|
+
# (:IdentityCenter)<-[:RESOURCE]-(:AWSAccount)
|
|
30
|
+
class IdentityCenterToAWSAccount(CartographyRelSchema):
|
|
31
|
+
target_node_label: str = 'AWSAccount'
|
|
32
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
33
|
+
{'id': PropertyRef('AWS_ID', set_in_kwargs=True)},
|
|
34
|
+
)
|
|
35
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
36
|
+
rel_label: str = "RESOURCE"
|
|
37
|
+
properties: IdentityCenterToAwsAccountRelProperties = IdentityCenterToAwsAccountRelProperties()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass(frozen=True)
|
|
41
|
+
class AWSIdentityCenterInstanceSchema(CartographyNodeSchema):
|
|
42
|
+
label: str = 'AWSIdentityCenter'
|
|
43
|
+
properties: IdentityCenterInstanceProperties = IdentityCenterInstanceProperties()
|
|
44
|
+
sub_resource_relationship: IdentityCenterToAWSAccount = IdentityCenterToAWSAccount()
|
|
@@ -0,0 +1,84 @@
|
|
|
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 PermissionSetProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef('PermissionSetArn')
|
|
17
|
+
name: PropertyRef = PropertyRef('Name')
|
|
18
|
+
arn: PropertyRef = PropertyRef('PermissionSetArn')
|
|
19
|
+
description: PropertyRef = PropertyRef('Description')
|
|
20
|
+
session_duration: PropertyRef = PropertyRef('SessionDuration')
|
|
21
|
+
instance_arn: PropertyRef = PropertyRef('InstanceArn', set_in_kwargs=True)
|
|
22
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass(frozen=True)
|
|
26
|
+
class PermissionSetToInstanceRelProperties(CartographyRelProperties):
|
|
27
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dataclass(frozen=True)
|
|
31
|
+
class PermissionSetToInstance(CartographyRelSchema):
|
|
32
|
+
target_node_label: str = 'AWSIdentityCenter'
|
|
33
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
34
|
+
{'arn': PropertyRef('InstanceArn', set_in_kwargs=True)},
|
|
35
|
+
)
|
|
36
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
37
|
+
rel_label: str = "HAS_PERMISSION_SET"
|
|
38
|
+
properties: PermissionSetToInstanceRelProperties = PermissionSetToInstanceRelProperties()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass(frozen=True)
|
|
42
|
+
class PermissionSetToAWSRoleRelProperties(CartographyRelProperties):
|
|
43
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True)
|
|
47
|
+
class PermissionSetToAWSRole(CartographyRelSchema):
|
|
48
|
+
target_node_label: str = 'AWSRole'
|
|
49
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
50
|
+
{'arn': PropertyRef('RoleHint', fuzzy_and_ignore_case=True)},
|
|
51
|
+
)
|
|
52
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
53
|
+
rel_label: str = "ASSIGNED_TO_ROLE"
|
|
54
|
+
properties: PermissionSetToAWSRoleRelProperties = PermissionSetToAWSRoleRelProperties()
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass(frozen=True)
|
|
58
|
+
class AWSPermissionSetToAwsAccountRelProperties(CartographyRelProperties):
|
|
59
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
@dataclass(frozen=True)
|
|
63
|
+
# (:IdentityCenter)<-[:RESOURCE]-(:AWSAccount)
|
|
64
|
+
class AWSPermissionSetToAWSAccount(CartographyRelSchema):
|
|
65
|
+
target_node_label: str = 'AWSAccount'
|
|
66
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
67
|
+
{'id': PropertyRef('AWS_ID', set_in_kwargs=True)},
|
|
68
|
+
)
|
|
69
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
70
|
+
rel_label: str = "RESOURCE"
|
|
71
|
+
properties: AWSPermissionSetToAwsAccountRelProperties = AWSPermissionSetToAwsAccountRelProperties()
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass(frozen=True)
|
|
75
|
+
class AWSPermissionSetSchema(CartographyNodeSchema):
|
|
76
|
+
label: str = 'AWSPermissionSet'
|
|
77
|
+
properties: PermissionSetProperties = PermissionSetProperties()
|
|
78
|
+
sub_resource_relationship: AWSPermissionSetToAWSAccount = AWSPermissionSetToAWSAccount()
|
|
79
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
80
|
+
[
|
|
81
|
+
PermissionSetToInstance(),
|
|
82
|
+
PermissionSetToAWSRole(),
|
|
83
|
+
],
|
|
84
|
+
)
|
|
@@ -0,0 +1,68 @@
|
|
|
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 SSOUserProperties(CartographyNodeProperties):
|
|
17
|
+
id: PropertyRef = PropertyRef('UserId', extra_index=True)
|
|
18
|
+
user_name: PropertyRef = PropertyRef('UserName')
|
|
19
|
+
identity_store_id: PropertyRef = PropertyRef('IdentityStoreId')
|
|
20
|
+
external_id: PropertyRef = PropertyRef('ExternalId', extra_index=True)
|
|
21
|
+
region: PropertyRef = PropertyRef('Region')
|
|
22
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass(frozen=True)
|
|
26
|
+
class SSOUserToOktaUserRelProperties(CartographyRelProperties):
|
|
27
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dataclass(frozen=True)
|
|
31
|
+
class SSOUserToOktaUser(CartographyRelSchema):
|
|
32
|
+
target_node_label: str = 'UserAccount'
|
|
33
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
34
|
+
{'id': PropertyRef('ExternalId')},
|
|
35
|
+
)
|
|
36
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
37
|
+
rel_label: str = "CAN_ASSUME_IDENTITY"
|
|
38
|
+
properties: SSOUserToOktaUserRelProperties = SSOUserToOktaUserRelProperties()
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass(frozen=True)
|
|
42
|
+
class AWSSSOUserToAwsAccountRelProperties(CartographyRelProperties):
|
|
43
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True)
|
|
47
|
+
# (:IdentityCenter)<-[:RESOURCE]-(:AWSAccount)
|
|
48
|
+
class AWSSSOUserToAWSAccount(CartographyRelSchema):
|
|
49
|
+
target_node_label: str = 'AWSAccount'
|
|
50
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
51
|
+
{'id': PropertyRef('AWS_ID', set_in_kwargs=True)},
|
|
52
|
+
)
|
|
53
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
54
|
+
rel_label: str = "RESOURCE"
|
|
55
|
+
properties: AWSSSOUserToAwsAccountRelProperties = AWSSSOUserToAwsAccountRelProperties()
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass(frozen=True)
|
|
59
|
+
class AWSSSOUserSchema(CartographyNodeSchema):
|
|
60
|
+
label: str = 'AWSSSOUser'
|
|
61
|
+
properties: SSOUserProperties = SSOUserProperties()
|
|
62
|
+
extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["UserAccount"])
|
|
63
|
+
sub_resource_relationship: AWSSSOUserToAWSAccount = AWSSSOUserToAWSAccount()
|
|
64
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
65
|
+
[
|
|
66
|
+
SSOUserToOktaUser(),
|
|
67
|
+
],
|
|
68
|
+
)
|
|
@@ -80,6 +80,33 @@ class GitHubTeamWriteRepoRel(CartographyRelSchema):
|
|
|
80
80
|
properties: GitHubTeamToRepoRelProperties = GitHubTeamToRepoRelProperties()
|
|
81
81
|
|
|
82
82
|
|
|
83
|
+
@dataclass(frozen=True)
|
|
84
|
+
class GitHubTeamToUserRelProperties(CartographyRelProperties):
|
|
85
|
+
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
@dataclass(frozen=True)
|
|
89
|
+
class GitHubTeamMaintainerUserRel(CartographyRelSchema):
|
|
90
|
+
target_node_label: str = 'GitHubUser'
|
|
91
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
92
|
+
{'id': PropertyRef('MAINTAINER')},
|
|
93
|
+
)
|
|
94
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
95
|
+
rel_label: str = "MAINTAINER"
|
|
96
|
+
properties: GitHubTeamToUserRelProperties = GitHubTeamToUserRelProperties()
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
@dataclass(frozen=True)
|
|
100
|
+
class GitHubTeamMemberUserRel(CartographyRelSchema):
|
|
101
|
+
target_node_label: str = 'GitHubUser'
|
|
102
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
103
|
+
{'id': PropertyRef('MEMBER')},
|
|
104
|
+
)
|
|
105
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
106
|
+
rel_label: str = "MEMBER"
|
|
107
|
+
properties: GitHubTeamToUserRelProperties = GitHubTeamToUserRelProperties()
|
|
108
|
+
|
|
109
|
+
|
|
83
110
|
@dataclass(frozen=True)
|
|
84
111
|
class GitHubTeamToOrganizationRelProperties(CartographyRelProperties):
|
|
85
112
|
lastupdated: PropertyRef = PropertyRef('lastupdated', set_in_kwargs=True)
|
|
@@ -107,6 +134,8 @@ class GitHubTeamSchema(CartographyNodeSchema):
|
|
|
107
134
|
GitHubTeamReadRepoRel(),
|
|
108
135
|
GitHubTeamTriageRepoRel(),
|
|
109
136
|
GitHubTeamWriteRepoRel(),
|
|
137
|
+
GitHubTeamMaintainerUserRel(),
|
|
138
|
+
GitHubTeamMemberUserRel(),
|
|
110
139
|
],
|
|
111
140
|
)
|
|
112
141
|
sub_resource_relationship: GitHubTeamToOrganizationRel = GitHubTeamToOrganizationRel()
|
cartography/util.py
CHANGED
|
@@ -15,6 +15,7 @@ from typing import Iterable
|
|
|
15
15
|
from typing import List
|
|
16
16
|
from typing import Optional
|
|
17
17
|
from typing import Set
|
|
18
|
+
from typing import Type
|
|
18
19
|
from typing import TypeVar
|
|
19
20
|
from typing import Union
|
|
20
21
|
|
|
@@ -288,6 +289,27 @@ def aws_handle_regions(func: AWSGetFunc) -> AWSGetFunc:
|
|
|
288
289
|
return cast(AWSGetFunc, inner_function)
|
|
289
290
|
|
|
290
291
|
|
|
292
|
+
def retries_with_backoff(
|
|
293
|
+
func: Callable,
|
|
294
|
+
exception_type: Type[Exception],
|
|
295
|
+
max_tries: int,
|
|
296
|
+
on_backoff: Callable,
|
|
297
|
+
) -> Callable:
|
|
298
|
+
"""
|
|
299
|
+
Adds retry with backoff to the given function. (Could expand the possible input parameters as needed.)
|
|
300
|
+
"""
|
|
301
|
+
@wraps(func)
|
|
302
|
+
@backoff.on_exception(
|
|
303
|
+
backoff.expo,
|
|
304
|
+
exception_type,
|
|
305
|
+
max_tries=max_tries,
|
|
306
|
+
on_backoff=on_backoff,
|
|
307
|
+
)
|
|
308
|
+
def inner_function(*args, **kwargs): # type: ignore
|
|
309
|
+
return func(*args, **kwargs)
|
|
310
|
+
return cast(Callable, inner_function)
|
|
311
|
+
|
|
312
|
+
|
|
291
313
|
def dict_value_to_str(obj: Dict, key: str) -> Optional[str]:
|
|
292
314
|
"""
|
|
293
315
|
Convert the value referenced by the key in the dict to a string, if it exists, and return it. If it doesn't exist,
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: cartography
|
|
3
|
+
Version: 0.96.1
|
|
4
|
+
Summary: Explore assets and their relationships across your technical infrastructure.
|
|
5
|
+
Home-page: https://www.github.com/cartography-cncf/cartography
|
|
6
|
+
Maintainer: Cartography Contributors
|
|
7
|
+
License: apache2
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
11
|
+
Classifier: Natural Language :: English
|
|
12
|
+
Classifier: Programming Language :: Python
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
15
|
+
Classifier: Topic :: Security
|
|
16
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
License-File: LICENSE
|
|
20
|
+
Requires-Dist: backoff>=2.1.2
|
|
21
|
+
Requires-Dist: boto3>=1.15.1
|
|
22
|
+
Requires-Dist: botocore>=1.18.1
|
|
23
|
+
Requires-Dist: dnspython>=1.15.0
|
|
24
|
+
Requires-Dist: neo4j<5.0.0,>=4.4.4
|
|
25
|
+
Requires-Dist: policyuniverse>=1.1.0.0
|
|
26
|
+
Requires-Dist: google-api-python-client>=1.7.8
|
|
27
|
+
Requires-Dist: oauth2client>=4.1.3
|
|
28
|
+
Requires-Dist: marshmallow>=3.0.0rc7
|
|
29
|
+
Requires-Dist: oci>=2.71.0
|
|
30
|
+
Requires-Dist: okta<1.0.0
|
|
31
|
+
Requires-Dist: pyyaml>=5.3.1
|
|
32
|
+
Requires-Dist: requests>=2.22.0
|
|
33
|
+
Requires-Dist: statsd
|
|
34
|
+
Requires-Dist: packaging
|
|
35
|
+
Requires-Dist: python-digitalocean>=1.16.0
|
|
36
|
+
Requires-Dist: adal>=1.2.4
|
|
37
|
+
Requires-Dist: azure-cli-core>=2.26.0
|
|
38
|
+
Requires-Dist: azure-mgmt-compute>=5.0.0
|
|
39
|
+
Requires-Dist: azure-mgmt-resource>=10.2.0
|
|
40
|
+
Requires-Dist: azure-mgmt-cosmosdb>=6.0.0
|
|
41
|
+
Requires-Dist: msrestazure>=0.6.4
|
|
42
|
+
Requires-Dist: azure-mgmt-storage>=16.0.0
|
|
43
|
+
Requires-Dist: azure-mgmt-sql<=1.0.0
|
|
44
|
+
Requires-Dist: azure-identity>=1.5.0
|
|
45
|
+
Requires-Dist: kubernetes>=22.6.0
|
|
46
|
+
Requires-Dist: pdpyras>=4.3.0
|
|
47
|
+
Requires-Dist: crowdstrike-falconpy>=0.5.1
|
|
48
|
+
Requires-Dist: python-dateutil
|
|
49
|
+
Requires-Dist: xmltodict
|
|
50
|
+
Requires-Dist: duo-client
|
|
51
|
+
Requires-Dist: importlib-resources; python_version < "3.7"
|
|
52
|
+
|
|
53
|
+
file: README.md
|