cartography 0.108.0rc1__py3-none-any.whl → 0.109.0__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/_version.py +2 -2
- cartography/cli.py +14 -0
- cartography/config.py +4 -0
- cartography/data/indexes.cypher +0 -17
- cartography/data/jobs/cleanup/gcp_compute_vpc_cleanup.json +0 -12
- cartography/intel/aws/cloudtrail.py +17 -4
- cartography/intel/aws/cloudtrail_management_events.py +614 -16
- cartography/intel/aws/cloudwatch.py +73 -4
- cartography/intel/aws/ec2/subnets.py +37 -63
- cartography/intel/aws/ecr.py +55 -80
- cartography/intel/aws/elasticache.py +102 -79
- cartography/intel/aws/eventbridge.py +91 -0
- cartography/intel/aws/glue.py +117 -0
- cartography/intel/aws/identitycenter.py +71 -23
- cartography/intel/aws/kms.py +160 -200
- cartography/intel/aws/lambda_function.py +206 -190
- cartography/intel/aws/rds.py +243 -458
- cartography/intel/aws/resourcegroupstaggingapi.py +77 -18
- cartography/intel/aws/resources.py +4 -0
- cartography/intel/aws/route53.py +334 -332
- cartography/intel/aws/secretsmanager.py +62 -44
- cartography/intel/entra/groups.py +29 -1
- cartography/intel/gcp/__init__.py +10 -0
- cartography/intel/gcp/compute.py +19 -42
- cartography/intel/trivy/__init__.py +73 -13
- cartography/intel/trivy/scanner.py +115 -92
- cartography/models/aws/cloudtrail/management_events.py +95 -6
- cartography/models/aws/cloudtrail/trail.py +21 -0
- cartography/models/aws/cloudwatch/metric_alarm.py +53 -0
- cartography/models/aws/ec2/subnets.py +65 -0
- cartography/models/aws/ecr/__init__.py +0 -0
- cartography/models/aws/ecr/image.py +41 -0
- cartography/models/aws/ecr/repository.py +72 -0
- cartography/models/aws/ecr/repository_image.py +95 -0
- cartography/models/aws/elasticache/__init__.py +0 -0
- cartography/models/aws/elasticache/cluster.py +65 -0
- cartography/models/aws/elasticache/topic.py +67 -0
- cartography/models/aws/eventbridge/__init__.py +0 -0
- cartography/models/aws/eventbridge/rule.py +77 -0
- cartography/models/aws/glue/__init__.py +0 -0
- cartography/models/aws/glue/connection.py +51 -0
- cartography/models/aws/identitycenter/awspermissionset.py +44 -0
- cartography/models/aws/kms/__init__.py +0 -0
- cartography/models/aws/kms/aliases.py +86 -0
- cartography/models/aws/kms/grants.py +65 -0
- cartography/models/aws/kms/keys.py +88 -0
- cartography/models/aws/lambda_function/__init__.py +0 -0
- cartography/models/aws/lambda_function/alias.py +74 -0
- cartography/models/aws/lambda_function/event_source_mapping.py +88 -0
- cartography/models/aws/lambda_function/lambda_function.py +89 -0
- cartography/models/aws/lambda_function/layer.py +72 -0
- cartography/models/aws/rds/__init__.py +0 -0
- cartography/models/aws/rds/cluster.py +89 -0
- cartography/models/aws/rds/instance.py +154 -0
- cartography/models/aws/rds/snapshot.py +108 -0
- cartography/models/aws/rds/subnet_group.py +101 -0
- cartography/models/aws/route53/__init__.py +0 -0
- cartography/models/aws/route53/dnsrecord.py +214 -0
- cartography/models/aws/route53/nameserver.py +63 -0
- cartography/models/aws/route53/subzone.py +40 -0
- cartography/models/aws/route53/zone.py +47 -0
- cartography/models/aws/secretsmanager/secret.py +106 -0
- cartography/models/entra/group.py +26 -0
- cartography/models/entra/user.py +6 -0
- cartography/models/gcp/compute/__init__.py +0 -0
- cartography/models/gcp/compute/vpc.py +50 -0
- cartography/util.py +8 -1
- {cartography-0.108.0rc1.dist-info → cartography-0.109.0.dist-info}/METADATA +2 -2
- {cartography-0.108.0rc1.dist-info → cartography-0.109.0.dist-info}/RECORD +73 -44
- cartography/data/jobs/cleanup/aws_dns_cleanup.json +0 -65
- cartography/data/jobs/cleanup/aws_import_identity_center_cleanup.json +0 -16
- cartography/data/jobs/cleanup/aws_import_lambda_cleanup.json +0 -50
- cartography/data/jobs/cleanup/aws_import_rds_clusters_cleanup.json +0 -23
- cartography/data/jobs/cleanup/aws_import_rds_instances_cleanup.json +0 -47
- cartography/data/jobs/cleanup/aws_import_rds_snapshots_cleanup.json +0 -23
- cartography/data/jobs/cleanup/aws_import_secrets_cleanup.json +0 -8
- cartography/data/jobs/cleanup/aws_kms_details.json +0 -10
- {cartography-0.108.0rc1.dist-info → cartography-0.109.0.dist-info}/WHEEL +0 -0
- {cartography-0.108.0rc1.dist-info → cartography-0.109.0.dist-info}/entry_points.txt +0 -0
- {cartography-0.108.0rc1.dist-info → cartography-0.109.0.dist-info}/licenses/LICENSE +0 -0
- {cartography-0.108.0rc1.dist-info → cartography-0.109.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,101 @@
|
|
|
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 DBSubnetGroupNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("id")
|
|
17
|
+
name: PropertyRef = PropertyRef("name")
|
|
18
|
+
vpc_id: PropertyRef = PropertyRef("vpc_id")
|
|
19
|
+
description: PropertyRef = PropertyRef("description")
|
|
20
|
+
status: PropertyRef = PropertyRef("status")
|
|
21
|
+
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
22
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass(frozen=True)
|
|
26
|
+
class DBSubnetGroupToAWSAccountRelProperties(CartographyRelProperties):
|
|
27
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dataclass(frozen=True)
|
|
31
|
+
class DBSubnetGroupToAWSAccountRel(CartographyRelSchema):
|
|
32
|
+
target_node_label: str = "AWSAccount"
|
|
33
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
34
|
+
{"id": PropertyRef("AWS_ID", set_in_kwargs=True)},
|
|
35
|
+
)
|
|
36
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
37
|
+
rel_label: str = "RESOURCE"
|
|
38
|
+
properties: DBSubnetGroupToAWSAccountRelProperties = (
|
|
39
|
+
DBSubnetGroupToAWSAccountRelProperties()
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass(frozen=True)
|
|
44
|
+
class DBSubnetGroupToRDSInstanceRelProperties(CartographyRelProperties):
|
|
45
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
@dataclass(frozen=True)
|
|
49
|
+
class DBSubnetGroupToRDSInstanceRel(CartographyRelSchema):
|
|
50
|
+
target_node_label: str = "RDSInstance"
|
|
51
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
52
|
+
{
|
|
53
|
+
"db_instance_identifier": PropertyRef(
|
|
54
|
+
"db_instance_identifier", one_to_many=True
|
|
55
|
+
),
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
59
|
+
rel_label: str = "MEMBER_OF_DB_SUBNET_GROUP"
|
|
60
|
+
properties: DBSubnetGroupToRDSInstanceRelProperties = (
|
|
61
|
+
DBSubnetGroupToRDSInstanceRelProperties()
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@dataclass(frozen=True)
|
|
66
|
+
class DBSubnetGroupToEC2SubnetRelProperties(CartographyRelProperties):
|
|
67
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@dataclass(frozen=True)
|
|
71
|
+
class DBSubnetGroupToEC2SubnetRel(CartographyRelSchema):
|
|
72
|
+
target_node_label: str = "EC2Subnet"
|
|
73
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
74
|
+
{
|
|
75
|
+
"subnetid": PropertyRef("subnet_ids", one_to_many=True),
|
|
76
|
+
}
|
|
77
|
+
)
|
|
78
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
79
|
+
rel_label: str = "RESOURCE"
|
|
80
|
+
properties: DBSubnetGroupToEC2SubnetRelProperties = (
|
|
81
|
+
DBSubnetGroupToEC2SubnetRelProperties()
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
@dataclass(frozen=True)
|
|
86
|
+
class DBSubnetGroupSchema(CartographyNodeSchema):
|
|
87
|
+
"""
|
|
88
|
+
DB Subnet Group schema
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
label: str = "DBSubnetGroup"
|
|
92
|
+
properties: DBSubnetGroupNodeProperties = DBSubnetGroupNodeProperties()
|
|
93
|
+
sub_resource_relationship: DBSubnetGroupToAWSAccountRel = (
|
|
94
|
+
DBSubnetGroupToAWSAccountRel()
|
|
95
|
+
)
|
|
96
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
97
|
+
[
|
|
98
|
+
DBSubnetGroupToRDSInstanceRel(),
|
|
99
|
+
DBSubnetGroupToEC2SubnetRel(),
|
|
100
|
+
]
|
|
101
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,214 @@
|
|
|
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 AWSDNSRecordNodeProperties(CartographyNodeProperties):
|
|
17
|
+
id: PropertyRef = PropertyRef("id")
|
|
18
|
+
name: PropertyRef = PropertyRef("name", extra_index=True)
|
|
19
|
+
type: PropertyRef = PropertyRef("type")
|
|
20
|
+
value: PropertyRef = PropertyRef("value")
|
|
21
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass(frozen=True)
|
|
25
|
+
class AWSDNSRecordToZoneRelProperties(CartographyRelProperties):
|
|
26
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@dataclass(frozen=True)
|
|
30
|
+
class AWSDNSRecordToZoneRel(CartographyRelSchema):
|
|
31
|
+
target_node_label: str = "AWSDNSZone"
|
|
32
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
33
|
+
{"zoneid": PropertyRef("zoneid")}
|
|
34
|
+
)
|
|
35
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
36
|
+
rel_label: str = "MEMBER_OF_DNS_ZONE"
|
|
37
|
+
properties: AWSDNSRecordToZoneRelProperties = AWSDNSRecordToZoneRelProperties()
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass(frozen=True)
|
|
41
|
+
class AWSDNSRecordToAWSAccountRelProperties(CartographyRelProperties):
|
|
42
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass(frozen=True)
|
|
46
|
+
class AWSDNSRecordToAWSAccountRel(CartographyRelSchema):
|
|
47
|
+
target_node_label: str = "AWSAccount"
|
|
48
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
49
|
+
{"id": PropertyRef("AWS_ID", set_in_kwargs=True)}
|
|
50
|
+
)
|
|
51
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
52
|
+
rel_label: str = "RESOURCE"
|
|
53
|
+
properties: AWSDNSRecordToAWSAccountRelProperties = (
|
|
54
|
+
AWSDNSRecordToAWSAccountRelProperties()
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass(frozen=True)
|
|
59
|
+
class AWSDNSRecordToNameServerRelProperties(CartographyRelProperties):
|
|
60
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@dataclass(frozen=True)
|
|
64
|
+
class AWSDNSRecordToNameServerRel(CartographyRelSchema):
|
|
65
|
+
target_node_label: str = "NameServer"
|
|
66
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
67
|
+
{
|
|
68
|
+
"id": PropertyRef("servers", one_to_many=True),
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
72
|
+
rel_label: str = "DNS_POINTS_TO"
|
|
73
|
+
properties: AWSDNSRecordToNameServerRelProperties = (
|
|
74
|
+
AWSDNSRecordToNameServerRelProperties()
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
@dataclass(frozen=True)
|
|
79
|
+
class AWSDNSRecordToEC2InstanceRelProperties(CartographyRelProperties):
|
|
80
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
@dataclass(frozen=True)
|
|
84
|
+
class AWSDNSRecordToEC2InstanceRel(CartographyRelSchema):
|
|
85
|
+
target_node_label: str = "EC2Instance"
|
|
86
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
87
|
+
{
|
|
88
|
+
"publicdnsname": PropertyRef("value"),
|
|
89
|
+
}
|
|
90
|
+
)
|
|
91
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
92
|
+
rel_label: str = "DNS_POINTS_TO"
|
|
93
|
+
properties: AWSDNSRecordToEC2InstanceRelProperties = (
|
|
94
|
+
AWSDNSRecordToEC2InstanceRelProperties()
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@dataclass(frozen=True)
|
|
99
|
+
class AWSDNSRecordToLoadBalancerRelProperties(CartographyRelProperties):
|
|
100
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@dataclass(frozen=True)
|
|
104
|
+
class AWSDNSRecordToLoadBalancerRel(CartographyRelSchema):
|
|
105
|
+
target_node_label: str = "LoadBalancer"
|
|
106
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
107
|
+
{
|
|
108
|
+
"dnsname": PropertyRef("value"),
|
|
109
|
+
}
|
|
110
|
+
)
|
|
111
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
112
|
+
rel_label: str = "DNS_POINTS_TO"
|
|
113
|
+
properties: AWSDNSRecordToLoadBalancerRelProperties = (
|
|
114
|
+
AWSDNSRecordToLoadBalancerRelProperties()
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
@dataclass(frozen=True)
|
|
119
|
+
class AWSDNSRecordToLoadBalancerV2RelProperties(CartographyRelProperties):
|
|
120
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
@dataclass(frozen=True)
|
|
124
|
+
class AWSDNSRecordToLoadBalancerV2Rel(CartographyRelSchema):
|
|
125
|
+
target_node_label: str = "LoadBalancerV2"
|
|
126
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
127
|
+
{
|
|
128
|
+
"dnsname": PropertyRef("value"),
|
|
129
|
+
}
|
|
130
|
+
)
|
|
131
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
132
|
+
rel_label: str = "DNS_POINTS_TO"
|
|
133
|
+
properties: AWSDNSRecordToLoadBalancerV2RelProperties = (
|
|
134
|
+
AWSDNSRecordToLoadBalancerV2RelProperties()
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
@dataclass(frozen=True)
|
|
139
|
+
class AWSDNSRecordToESDomainRelProperties(CartographyRelProperties):
|
|
140
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@dataclass(frozen=True)
|
|
144
|
+
class AWSDNSRecordToESDomainRel(CartographyRelSchema):
|
|
145
|
+
target_node_label: str = "ESDomain"
|
|
146
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
147
|
+
{
|
|
148
|
+
"endpoint": PropertyRef("value"),
|
|
149
|
+
}
|
|
150
|
+
)
|
|
151
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
152
|
+
rel_label: str = "DNS_POINTS_TO"
|
|
153
|
+
properties: AWSDNSRecordToESDomainRelProperties = (
|
|
154
|
+
AWSDNSRecordToESDomainRelProperties()
|
|
155
|
+
)
|
|
156
|
+
|
|
157
|
+
|
|
158
|
+
@dataclass(frozen=True)
|
|
159
|
+
class AWSDNSRecordToDNSRecordRelProperties(CartographyRelProperties):
|
|
160
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
@dataclass(frozen=True)
|
|
164
|
+
class AWSDNSRecordToDNSRecordRel(CartographyRelSchema):
|
|
165
|
+
target_node_label: str = "AWSDNSRecord"
|
|
166
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
167
|
+
{
|
|
168
|
+
"name": PropertyRef("value"),
|
|
169
|
+
}
|
|
170
|
+
)
|
|
171
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
172
|
+
rel_label: str = "DNS_POINTS_TO"
|
|
173
|
+
properties: AWSDNSRecordToDNSRecordRelProperties = (
|
|
174
|
+
AWSDNSRecordToDNSRecordRelProperties()
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
@dataclass(frozen=True)
|
|
179
|
+
class AWSDNSRecordToIpRelProperties(CartographyRelProperties):
|
|
180
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
@dataclass(frozen=True)
|
|
184
|
+
class AWSDNSRecordToIpRel(CartographyRelSchema):
|
|
185
|
+
target_node_label: str = "Ip"
|
|
186
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
187
|
+
{
|
|
188
|
+
"id": PropertyRef("ip_addresses", one_to_many=True),
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
192
|
+
rel_label: str = "DNS_POINTS_TO"
|
|
193
|
+
properties: AWSDNSRecordToIpRelProperties = AWSDNSRecordToIpRelProperties()
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
class AWSDNSRecordSchema(CartographyNodeSchema):
|
|
197
|
+
label: str = "AWSDNSRecord"
|
|
198
|
+
properties: AWSDNSRecordNodeProperties = AWSDNSRecordNodeProperties()
|
|
199
|
+
extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["DNSRecord"])
|
|
200
|
+
sub_resource_relationship: AWSDNSRecordToAWSAccountRel = (
|
|
201
|
+
AWSDNSRecordToAWSAccountRel()
|
|
202
|
+
)
|
|
203
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
204
|
+
[
|
|
205
|
+
AWSDNSRecordToNameServerRel(),
|
|
206
|
+
AWSDNSRecordToEC2InstanceRel(),
|
|
207
|
+
AWSDNSRecordToLoadBalancerRel(),
|
|
208
|
+
AWSDNSRecordToLoadBalancerV2Rel(),
|
|
209
|
+
AWSDNSRecordToESDomainRel(),
|
|
210
|
+
AWSDNSRecordToDNSRecordRel(),
|
|
211
|
+
AWSDNSRecordToZoneRel(),
|
|
212
|
+
AWSDNSRecordToIpRel(),
|
|
213
|
+
]
|
|
214
|
+
)
|
|
@@ -0,0 +1,63 @@
|
|
|
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 NameServerNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("id")
|
|
17
|
+
name: PropertyRef = PropertyRef("id", extra_index=True)
|
|
18
|
+
zoneid: PropertyRef = PropertyRef("zoneid")
|
|
19
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(frozen=True)
|
|
23
|
+
class NameServerToZoneRelProperties(CartographyRelProperties):
|
|
24
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass(frozen=True)
|
|
28
|
+
class NameServerToZoneRel(CartographyRelSchema):
|
|
29
|
+
target_node_label: str = "AWSDNSZone"
|
|
30
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
31
|
+
{"zoneid": PropertyRef("zoneid")}
|
|
32
|
+
)
|
|
33
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
34
|
+
rel_label: str = "NAMESERVER"
|
|
35
|
+
properties: NameServerToZoneRelProperties = NameServerToZoneRelProperties()
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass(frozen=True)
|
|
39
|
+
class NameServerToAWSAccountRelProperties(CartographyRelProperties):
|
|
40
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass(frozen=True)
|
|
44
|
+
class NameServerToAWSAccountRel(CartographyRelSchema):
|
|
45
|
+
target_node_label: str = "AWSAccount"
|
|
46
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
47
|
+
{"id": PropertyRef("AWS_ID", set_in_kwargs=True)}
|
|
48
|
+
)
|
|
49
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
50
|
+
rel_label: str = "RESOURCE"
|
|
51
|
+
properties: NameServerToAWSAccountRelProperties = (
|
|
52
|
+
NameServerToAWSAccountRelProperties()
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@dataclass(frozen=True)
|
|
57
|
+
class NameServerSchema(CartographyNodeSchema):
|
|
58
|
+
label: str = "NameServer"
|
|
59
|
+
properties: NameServerNodeProperties = NameServerNodeProperties()
|
|
60
|
+
sub_resource_relationship: NameServerToAWSAccountRel = NameServerToAWSAccountRel()
|
|
61
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
62
|
+
[NameServerToZoneRel()]
|
|
63
|
+
)
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
5
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
6
|
+
from cartography.models.core.relationships import LinkDirection
|
|
7
|
+
from cartography.models.core.relationships import make_source_node_matcher
|
|
8
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
9
|
+
from cartography.models.core.relationships import SourceNodeMatcher
|
|
10
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@dataclass(frozen=True)
|
|
14
|
+
class AWSDNSZoneSubzoneRelProperties(CartographyRelProperties):
|
|
15
|
+
# Mandatory fields for MatchLinks
|
|
16
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
17
|
+
_sub_resource_label: PropertyRef = PropertyRef(
|
|
18
|
+
"_sub_resource_label", set_in_kwargs=True
|
|
19
|
+
)
|
|
20
|
+
_sub_resource_id: PropertyRef = PropertyRef("_sub_resource_id", set_in_kwargs=True)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
# MatchLink for creating SUBZONE relationships between DNS zones
|
|
24
|
+
@dataclass(frozen=True)
|
|
25
|
+
class AWSDNSZoneSubzoneMatchLink(CartographyRelSchema):
|
|
26
|
+
target_node_label: str = "AWSDNSZone"
|
|
27
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
28
|
+
{
|
|
29
|
+
"zoneid": PropertyRef("subzone_id"),
|
|
30
|
+
}
|
|
31
|
+
)
|
|
32
|
+
source_node_label: str = "AWSDNSZone"
|
|
33
|
+
source_node_matcher: SourceNodeMatcher = make_source_node_matcher(
|
|
34
|
+
{
|
|
35
|
+
"zoneid": PropertyRef("zone_id"),
|
|
36
|
+
}
|
|
37
|
+
)
|
|
38
|
+
properties: AWSDNSZoneSubzoneRelProperties = AWSDNSZoneSubzoneRelProperties()
|
|
39
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
40
|
+
rel_label: str = "SUBZONE"
|
|
@@ -0,0 +1,47 @@
|
|
|
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 TargetNodeMatcher
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
@dataclass(frozen=True)
|
|
15
|
+
class AWSDNSZoneNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("zoneid")
|
|
17
|
+
zoneid: PropertyRef = PropertyRef("zoneid")
|
|
18
|
+
name: PropertyRef = PropertyRef("name", extra_index=True)
|
|
19
|
+
comment: PropertyRef = PropertyRef("comment")
|
|
20
|
+
privatezone: PropertyRef = PropertyRef("privatezone")
|
|
21
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
@dataclass(frozen=True)
|
|
25
|
+
class AWSDNSZoneToAWSAccountRelProperties(CartographyRelProperties):
|
|
26
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
@dataclass(frozen=True)
|
|
30
|
+
class AWSDNSZoneToAWSAccountRel(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: AWSDNSZoneToAWSAccountRelProperties = (
|
|
38
|
+
AWSDNSZoneToAWSAccountRelProperties()
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@dataclass(frozen=True)
|
|
43
|
+
class AWSDNSZoneSchema(CartographyNodeSchema):
|
|
44
|
+
label: str = "AWSDNSZone"
|
|
45
|
+
properties: AWSDNSZoneNodeProperties = AWSDNSZoneNodeProperties()
|
|
46
|
+
extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["DNSZone"])
|
|
47
|
+
sub_resource_relationship: AWSDNSZoneToAWSAccountRel = AWSDNSZoneToAWSAccountRel()
|
|
@@ -0,0 +1,106 @@
|
|
|
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 SecretsManagerSecretNodeProperties(CartographyNodeProperties):
|
|
16
|
+
"""
|
|
17
|
+
Properties for AWS Secrets Manager Secret
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
id: PropertyRef = PropertyRef("ARN")
|
|
21
|
+
arn: PropertyRef = PropertyRef("ARN", extra_index=True)
|
|
22
|
+
name: PropertyRef = PropertyRef("Name", extra_index=True)
|
|
23
|
+
description: PropertyRef = PropertyRef("Description")
|
|
24
|
+
|
|
25
|
+
# Rotation properties
|
|
26
|
+
rotation_enabled: PropertyRef = PropertyRef("RotationEnabled")
|
|
27
|
+
rotation_lambda_arn: PropertyRef = PropertyRef("RotationLambdaARN")
|
|
28
|
+
rotation_rules_automatically_after_days: PropertyRef = PropertyRef(
|
|
29
|
+
"RotationRulesAutomaticallyAfterDays"
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
# Date properties (will be converted to epoch timestamps)
|
|
33
|
+
created_date: PropertyRef = PropertyRef("CreatedDate")
|
|
34
|
+
last_rotated_date: PropertyRef = PropertyRef("LastRotatedDate")
|
|
35
|
+
last_changed_date: PropertyRef = PropertyRef("LastChangedDate")
|
|
36
|
+
last_accessed_date: PropertyRef = PropertyRef("LastAccessedDate")
|
|
37
|
+
deleted_date: PropertyRef = PropertyRef("DeletedDate")
|
|
38
|
+
|
|
39
|
+
# Other properties
|
|
40
|
+
kms_key_id: PropertyRef = PropertyRef("KmsKeyId")
|
|
41
|
+
owning_service: PropertyRef = PropertyRef("OwningService")
|
|
42
|
+
primary_region: PropertyRef = PropertyRef("PrimaryRegion")
|
|
43
|
+
|
|
44
|
+
# Standard cartography properties
|
|
45
|
+
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
46
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
@dataclass(frozen=True)
|
|
50
|
+
class SecretsManagerSecretRelProperties(CartographyRelProperties):
|
|
51
|
+
"""
|
|
52
|
+
Properties for relationships between Secret and other nodes
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
@dataclass(frozen=True)
|
|
59
|
+
class SecretsManagerSecretToAWSAccountRel(CartographyRelSchema):
|
|
60
|
+
"""
|
|
61
|
+
Relationship between Secret and AWS Account
|
|
62
|
+
"""
|
|
63
|
+
|
|
64
|
+
target_node_label: str = "AWSAccount"
|
|
65
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
66
|
+
{"id": PropertyRef("AWS_ID", set_in_kwargs=True)},
|
|
67
|
+
)
|
|
68
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
69
|
+
rel_label: str = "RESOURCE"
|
|
70
|
+
properties: SecretsManagerSecretRelProperties = SecretsManagerSecretRelProperties()
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
@dataclass(frozen=True)
|
|
74
|
+
class SecretsManagerSecretToKMSKeyRel(CartographyRelSchema):
|
|
75
|
+
"""
|
|
76
|
+
Relationship between Secret and its KMS key
|
|
77
|
+
Only created when KmsKeyId is present
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
target_node_label: str = "AWSKMSKey"
|
|
81
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
82
|
+
{"id": PropertyRef("KmsKeyId")},
|
|
83
|
+
)
|
|
84
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
85
|
+
rel_label: str = "ENCRYPTED_BY"
|
|
86
|
+
properties: SecretsManagerSecretRelProperties = SecretsManagerSecretRelProperties()
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
@dataclass(frozen=True)
|
|
90
|
+
class SecretsManagerSecretSchema(CartographyNodeSchema):
|
|
91
|
+
"""
|
|
92
|
+
Schema for AWS Secrets Manager Secret
|
|
93
|
+
"""
|
|
94
|
+
|
|
95
|
+
label: str = "SecretsManagerSecret"
|
|
96
|
+
properties: SecretsManagerSecretNodeProperties = (
|
|
97
|
+
SecretsManagerSecretNodeProperties()
|
|
98
|
+
)
|
|
99
|
+
sub_resource_relationship: SecretsManagerSecretToAWSAccountRel = (
|
|
100
|
+
SecretsManagerSecretToAWSAccountRel()
|
|
101
|
+
)
|
|
102
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
103
|
+
[
|
|
104
|
+
SecretsManagerSecretToKMSKeyRel(),
|
|
105
|
+
],
|
|
106
|
+
)
|
|
@@ -3,6 +3,7 @@ from dataclasses import dataclass
|
|
|
3
3
|
from cartography.models.core.common import PropertyRef
|
|
4
4
|
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
5
|
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.nodes import ExtraNodeLabels
|
|
6
7
|
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
8
|
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
9
|
from cartography.models.core.relationships import LinkDirection
|
|
@@ -78,6 +79,25 @@ class EntraGroupToGroupRel(CartographyRelSchema):
|
|
|
78
79
|
properties: EntraGroupToGroupRelProperties = EntraGroupToGroupRelProperties()
|
|
79
80
|
|
|
80
81
|
|
|
82
|
+
@dataclass(frozen=True)
|
|
83
|
+
class EntraGroupToOwnerRelProperties(CartographyRelProperties):
|
|
84
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@dataclass(frozen=True)
|
|
88
|
+
# (:EntraGroup)<-[:OWNER_OF]-(:EntraUser)
|
|
89
|
+
class EntraGroupToOwnerRel(CartographyRelSchema):
|
|
90
|
+
# EntraUsers and Entra service principals can be owners of a group, so we match on the general label
|
|
91
|
+
# Because id is indexed, this should be fast even though EntraIdentity will also include EntraGroups
|
|
92
|
+
target_node_label: str = "EntraIdentity"
|
|
93
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
94
|
+
{"id": PropertyRef("owner_ids", one_to_many=True)}
|
|
95
|
+
)
|
|
96
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
97
|
+
rel_label: str = "OWNER_OF"
|
|
98
|
+
properties: EntraGroupToOwnerRelProperties = EntraGroupToOwnerRelProperties()
|
|
99
|
+
|
|
100
|
+
|
|
81
101
|
@dataclass(frozen=True)
|
|
82
102
|
class EntraGroupSchema(CartographyNodeSchema):
|
|
83
103
|
label: str = "EntraGroup"
|
|
@@ -87,5 +107,11 @@ class EntraGroupSchema(CartographyNodeSchema):
|
|
|
87
107
|
[
|
|
88
108
|
EntraGroupToGroupRel(),
|
|
89
109
|
EntraGroupToUserRel(),
|
|
110
|
+
EntraGroupToOwnerRel(),
|
|
111
|
+
]
|
|
112
|
+
)
|
|
113
|
+
extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(
|
|
114
|
+
[
|
|
115
|
+
"EntraIdentity",
|
|
90
116
|
]
|
|
91
117
|
)
|
cartography/models/entra/user.py
CHANGED
|
@@ -3,6 +3,7 @@ from dataclasses import dataclass
|
|
|
3
3
|
from cartography.models.core.common import PropertyRef
|
|
4
4
|
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
5
|
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.nodes import ExtraNodeLabels
|
|
6
7
|
from cartography.models.core.relationships import CartographyRelProperties
|
|
7
8
|
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
9
|
from cartography.models.core.relationships import LinkDirection
|
|
@@ -63,3 +64,8 @@ class EntraUserSchema(CartographyNodeSchema):
|
|
|
63
64
|
label: str = "EntraUser"
|
|
64
65
|
properties: EntraUserNodeProperties = EntraUserNodeProperties()
|
|
65
66
|
sub_resource_relationship: EntraUserToTenantRel = EntraUserToTenantRel()
|
|
67
|
+
extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(
|
|
68
|
+
[
|
|
69
|
+
"EntraIdentity",
|
|
70
|
+
]
|
|
71
|
+
)
|
|
File without changes
|