cartography 0.104.0rc3__py3-none-any.whl → 0.106.0rc1__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 +26 -1
- cartography/client/aws/__init__.py +19 -0
- cartography/client/aws/ecr.py +51 -0
- cartography/config.py +8 -0
- cartography/data/indexes.cypher +0 -37
- cartography/data/jobs/cleanup/aws_import_lambda_cleanup.json +1 -1
- cartography/graph/cleanupbuilder.py +151 -41
- cartography/intel/aws/acm.py +124 -0
- cartography/intel/aws/cloudtrail.py +3 -38
- cartography/intel/aws/ecr.py +8 -2
- cartography/intel/aws/ecs.py +228 -380
- cartography/intel/aws/efs.py +99 -11
- cartography/intel/aws/iam.py +1 -1
- cartography/intel/aws/identitycenter.py +14 -3
- cartography/intel/aws/inspector.py +106 -53
- cartography/intel/aws/lambda_function.py +1 -1
- cartography/intel/aws/rds.py +2 -1
- cartography/intel/aws/resources.py +2 -0
- cartography/intel/aws/s3.py +195 -4
- cartography/intel/aws/sqs.py +36 -90
- cartography/intel/entra/__init__.py +22 -0
- cartography/intel/entra/applications.py +366 -0
- cartography/intel/entra/groups.py +151 -0
- cartography/intel/entra/ou.py +21 -5
- cartography/intel/kubernetes/__init__.py +30 -14
- cartography/intel/kubernetes/clusters.py +86 -0
- cartography/intel/kubernetes/namespaces.py +59 -57
- cartography/intel/kubernetes/pods.py +140 -77
- cartography/intel/kubernetes/secrets.py +95 -45
- cartography/intel/kubernetes/services.py +131 -67
- cartography/intel/kubernetes/util.py +125 -14
- cartography/intel/trivy/__init__.py +161 -0
- cartography/intel/trivy/scanner.py +363 -0
- cartography/models/aws/acm/__init__.py +0 -0
- cartography/models/aws/acm/certificate.py +75 -0
- cartography/models/aws/cloudtrail/trail.py +24 -0
- cartography/models/aws/ecs/__init__.py +0 -0
- cartography/models/aws/ecs/clusters.py +64 -0
- cartography/models/aws/ecs/container_definitions.py +93 -0
- cartography/models/aws/ecs/container_instances.py +84 -0
- cartography/models/aws/ecs/containers.py +80 -0
- cartography/models/aws/ecs/services.py +117 -0
- cartography/models/aws/ecs/task_definitions.py +97 -0
- cartography/models/aws/ecs/tasks.py +110 -0
- cartography/models/aws/efs/file_system.py +60 -0
- cartography/models/aws/efs/mount_target.py +29 -2
- cartography/models/aws/s3/notification.py +24 -0
- cartography/models/aws/secretsmanager/secret_version.py +0 -2
- cartography/models/aws/sqs/__init__.py +0 -0
- cartography/models/aws/sqs/queue.py +89 -0
- cartography/models/core/nodes.py +15 -2
- cartography/models/entra/app_role_assignment.py +115 -0
- cartography/models/entra/application.py +47 -0
- cartography/models/entra/group.py +91 -0
- cartography/models/kubernetes/__init__.py +0 -0
- cartography/models/kubernetes/clusters.py +26 -0
- cartography/models/kubernetes/containers.py +108 -0
- cartography/models/kubernetes/namespaces.py +51 -0
- cartography/models/kubernetes/pods.py +80 -0
- cartography/models/kubernetes/secrets.py +79 -0
- cartography/models/kubernetes/services.py +108 -0
- cartography/models/trivy/__init__.py +0 -0
- cartography/models/trivy/findings.py +66 -0
- cartography/models/trivy/fix.py +66 -0
- cartography/models/trivy/package.py +71 -0
- cartography/sync.py +2 -0
- cartography/util.py +15 -10
- {cartography-0.104.0rc3.dist-info → cartography-0.106.0rc1.dist-info}/METADATA +3 -2
- {cartography-0.104.0rc3.dist-info → cartography-0.106.0rc1.dist-info}/RECORD +74 -40
- cartography/data/jobs/cleanup/kubernetes_import_cleanup.json +0 -70
- {cartography-0.104.0rc3.dist-info → cartography-0.106.0rc1.dist-info}/WHEEL +0 -0
- {cartography-0.104.0rc3.dist-info → cartography-0.106.0rc1.dist-info}/entry_points.txt +0 -0
- {cartography-0.104.0rc3.dist-info → cartography-0.106.0rc1.dist-info}/licenses/LICENSE +0 -0
- {cartography-0.104.0rc3.dist-info → cartography-0.106.0rc1.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,89 @@
|
|
|
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 SQSQueueNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("QueueArn")
|
|
17
|
+
arn: PropertyRef = PropertyRef("QueueArn", extra_index=True)
|
|
18
|
+
name: PropertyRef = PropertyRef("name")
|
|
19
|
+
url: PropertyRef = PropertyRef("url")
|
|
20
|
+
created_timestamp: PropertyRef = PropertyRef("CreatedTimestamp")
|
|
21
|
+
delay_seconds: PropertyRef = PropertyRef("DelaySeconds")
|
|
22
|
+
last_modified_timestamp: PropertyRef = PropertyRef("LastModifiedTimestamp")
|
|
23
|
+
maximum_message_size: PropertyRef = PropertyRef("MaximumMessageSize")
|
|
24
|
+
message_retention_period: PropertyRef = PropertyRef("MessageRetentionPeriod")
|
|
25
|
+
policy: PropertyRef = PropertyRef("Policy")
|
|
26
|
+
receive_message_wait_time_seconds: PropertyRef = PropertyRef(
|
|
27
|
+
"ReceiveMessageWaitTimeSeconds"
|
|
28
|
+
)
|
|
29
|
+
redrive_policy_dead_letter_target_arn: PropertyRef = PropertyRef(
|
|
30
|
+
"redrive_policy_dead_letter_target_arn"
|
|
31
|
+
)
|
|
32
|
+
redrive_policy_max_receive_count: PropertyRef = PropertyRef(
|
|
33
|
+
"redrive_policy_max_receive_count"
|
|
34
|
+
)
|
|
35
|
+
visibility_timeout: PropertyRef = PropertyRef("VisibilityTimeout")
|
|
36
|
+
kms_master_key_id: PropertyRef = PropertyRef("KmsMasterKeyId")
|
|
37
|
+
kms_data_key_reuse_period_seconds: PropertyRef = PropertyRef(
|
|
38
|
+
"KmsDataKeyReusePeriodSeconds"
|
|
39
|
+
)
|
|
40
|
+
fifo_queue: PropertyRef = PropertyRef("FifoQueue")
|
|
41
|
+
content_based_deduplication: PropertyRef = PropertyRef("ContentBasedDeduplication")
|
|
42
|
+
deduplication_scope: PropertyRef = PropertyRef("DeduplicationScope")
|
|
43
|
+
fifo_throughput_limit: PropertyRef = PropertyRef("FifoThroughputLimit")
|
|
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 SQSQueueToAWSAccountRelProperties(CartographyRelProperties):
|
|
50
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@dataclass(frozen=True)
|
|
54
|
+
class SQSQueueToAWSAccountRel(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: SQSQueueToAWSAccountRelProperties = SQSQueueToAWSAccountRelProperties()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass(frozen=True)
|
|
65
|
+
class SQSQueueToDeadLetterQueueRelProperties(CartographyRelProperties):
|
|
66
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass(frozen=True)
|
|
70
|
+
class SQSQueueToDeadLetterQueueRel(CartographyRelSchema):
|
|
71
|
+
target_node_label: str = "SQSQueue"
|
|
72
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
73
|
+
{"id": PropertyRef("redrive_policy_dead_letter_target_arn")}
|
|
74
|
+
)
|
|
75
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
76
|
+
rel_label: str = "HAS_DEADLETTER_QUEUE"
|
|
77
|
+
properties: SQSQueueToDeadLetterQueueRelProperties = (
|
|
78
|
+
SQSQueueToDeadLetterQueueRelProperties()
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@dataclass(frozen=True)
|
|
83
|
+
class SQSQueueSchema(CartographyNodeSchema):
|
|
84
|
+
label: str = "SQSQueue"
|
|
85
|
+
properties: SQSQueueNodeProperties = SQSQueueNodeProperties()
|
|
86
|
+
sub_resource_relationship: SQSQueueToAWSAccountRel = SQSQueueToAWSAccountRel()
|
|
87
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
88
|
+
[SQSQueueToDeadLetterQueueRel()]
|
|
89
|
+
)
|
cartography/models/core/nodes.py
CHANGED
|
@@ -91,7 +91,7 @@ class CartographyNodeSchema(abc.ABC):
|
|
|
91
91
|
"""
|
|
92
92
|
Optional.
|
|
93
93
|
Allows subclasses to specify additional cartography relationships on the node.
|
|
94
|
-
:return: None if not
|
|
94
|
+
:return: None if not overridden. Else return the node's OtherRelationships.
|
|
95
95
|
"""
|
|
96
96
|
return None
|
|
97
97
|
|
|
@@ -100,6 +100,19 @@ class CartographyNodeSchema(abc.ABC):
|
|
|
100
100
|
"""
|
|
101
101
|
Optional.
|
|
102
102
|
Allows specifying extra labels on the node.
|
|
103
|
-
:return: None if not
|
|
103
|
+
:return: None if not overridden. Else return the ExtraNodeLabels specified on the node.
|
|
104
104
|
"""
|
|
105
105
|
return None
|
|
106
|
+
|
|
107
|
+
@property
|
|
108
|
+
def scoped_cleanup(self) -> bool:
|
|
109
|
+
"""
|
|
110
|
+
Optional.
|
|
111
|
+
Allows specifying whether cleanups of this node must be scoped to the sub resource relationship.
|
|
112
|
+
If True (default), when we clean up nodes of this type, we will only delete stale nodes in the current sub
|
|
113
|
+
resource. This is how our AWS sync behaves.
|
|
114
|
+
If False, when we clean up node of this type, we will delete all stale nodes. This is designed for resource
|
|
115
|
+
types that don't have a "tenant"-like entity.
|
|
116
|
+
:return: True if not overridden. Else return the boolean value specified on the node.
|
|
117
|
+
"""
|
|
118
|
+
return True
|
|
@@ -0,0 +1,115 @@
|
|
|
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 EntraAppRoleAssignmentNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("id")
|
|
17
|
+
app_role_id: PropertyRef = PropertyRef("app_role_id")
|
|
18
|
+
created_date_time: PropertyRef = PropertyRef("created_date_time")
|
|
19
|
+
principal_id: PropertyRef = PropertyRef("principal_id")
|
|
20
|
+
principal_display_name: PropertyRef = PropertyRef("principal_display_name")
|
|
21
|
+
principal_type: PropertyRef = PropertyRef("principal_type")
|
|
22
|
+
resource_display_name: PropertyRef = PropertyRef("resource_display_name")
|
|
23
|
+
resource_id: PropertyRef = PropertyRef("resource_id")
|
|
24
|
+
application_app_id: PropertyRef = PropertyRef("application_app_id")
|
|
25
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass(frozen=True)
|
|
29
|
+
class EntraAppRoleAssignmentToTenantRelProperties(CartographyRelProperties):
|
|
30
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass(frozen=True)
|
|
34
|
+
class EntraAppRoleAssignmentToTenantRel(CartographyRelSchema):
|
|
35
|
+
target_node_label: str = "EntraTenant"
|
|
36
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
37
|
+
{"id": PropertyRef("TENANT_ID", set_in_kwargs=True)},
|
|
38
|
+
)
|
|
39
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
40
|
+
rel_label: str = "RESOURCE"
|
|
41
|
+
properties: EntraAppRoleAssignmentToTenantRelProperties = (
|
|
42
|
+
EntraAppRoleAssignmentToTenantRelProperties()
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True)
|
|
47
|
+
class EntraAppRoleAssignmentToApplicationRelProperties(CartographyRelProperties):
|
|
48
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
@dataclass(frozen=True)
|
|
52
|
+
class EntraAppRoleAssignmentToApplicationRel(CartographyRelSchema):
|
|
53
|
+
target_node_label: str = "EntraApplication"
|
|
54
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
55
|
+
{"app_id": PropertyRef("application_app_id")},
|
|
56
|
+
)
|
|
57
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
58
|
+
rel_label: str = "ASSIGNED_TO"
|
|
59
|
+
properties: EntraAppRoleAssignmentToApplicationRelProperties = (
|
|
60
|
+
EntraAppRoleAssignmentToApplicationRelProperties()
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass(frozen=True)
|
|
65
|
+
class EntraAppRoleAssignmentToUserRelProperties(CartographyRelProperties):
|
|
66
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass(frozen=True)
|
|
70
|
+
class EntraAppRoleAssignmentToUserRel(CartographyRelSchema):
|
|
71
|
+
target_node_label: str = "EntraUser"
|
|
72
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
73
|
+
{"id": PropertyRef("principal_id")},
|
|
74
|
+
)
|
|
75
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
76
|
+
rel_label: str = "HAS_APP_ROLE"
|
|
77
|
+
properties: EntraAppRoleAssignmentToUserRelProperties = (
|
|
78
|
+
EntraAppRoleAssignmentToUserRelProperties()
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@dataclass(frozen=True)
|
|
83
|
+
class EntraAppRoleAssignmentToGroupRelProperties(CartographyRelProperties):
|
|
84
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
@dataclass(frozen=True)
|
|
88
|
+
class EntraAppRoleAssignmentToGroupRel(CartographyRelSchema):
|
|
89
|
+
target_node_label: str = "EntraGroup"
|
|
90
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
91
|
+
{"id": PropertyRef("principal_id")},
|
|
92
|
+
)
|
|
93
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
94
|
+
rel_label: str = "HAS_APP_ROLE"
|
|
95
|
+
properties: EntraAppRoleAssignmentToGroupRelProperties = (
|
|
96
|
+
EntraAppRoleAssignmentToGroupRelProperties()
|
|
97
|
+
)
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@dataclass(frozen=True)
|
|
101
|
+
class EntraAppRoleAssignmentSchema(CartographyNodeSchema):
|
|
102
|
+
label: str = "EntraAppRoleAssignment"
|
|
103
|
+
properties: EntraAppRoleAssignmentNodeProperties = (
|
|
104
|
+
EntraAppRoleAssignmentNodeProperties()
|
|
105
|
+
)
|
|
106
|
+
sub_resource_relationship: EntraAppRoleAssignmentToTenantRel = (
|
|
107
|
+
EntraAppRoleAssignmentToTenantRel()
|
|
108
|
+
)
|
|
109
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
110
|
+
[
|
|
111
|
+
EntraAppRoleAssignmentToApplicationRel(),
|
|
112
|
+
EntraAppRoleAssignmentToUserRel(),
|
|
113
|
+
EntraAppRoleAssignmentToGroupRel(),
|
|
114
|
+
],
|
|
115
|
+
)
|
|
@@ -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.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 EntraApplicationNodeProperties(CartographyNodeProperties):
|
|
15
|
+
id: PropertyRef = PropertyRef("id")
|
|
16
|
+
app_id: PropertyRef = PropertyRef("app_id")
|
|
17
|
+
display_name: PropertyRef = PropertyRef("display_name")
|
|
18
|
+
publisher_domain: PropertyRef = PropertyRef("publisher_domain")
|
|
19
|
+
sign_in_audience: PropertyRef = PropertyRef("sign_in_audience")
|
|
20
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(frozen=True)
|
|
24
|
+
class EntraApplicationToTenantRelProperties(CartographyRelProperties):
|
|
25
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass(frozen=True)
|
|
29
|
+
class EntraApplicationToTenantRel(CartographyRelSchema):
|
|
30
|
+
target_node_label: str = "EntraTenant"
|
|
31
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
32
|
+
{"id": PropertyRef("TENANT_ID", set_in_kwargs=True)},
|
|
33
|
+
)
|
|
34
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
35
|
+
rel_label: str = "RESOURCE"
|
|
36
|
+
properties: EntraApplicationToTenantRelProperties = (
|
|
37
|
+
EntraApplicationToTenantRelProperties()
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass(frozen=True)
|
|
42
|
+
class EntraApplicationSchema(CartographyNodeSchema):
|
|
43
|
+
label: str = "EntraApplication"
|
|
44
|
+
properties: EntraApplicationNodeProperties = EntraApplicationNodeProperties()
|
|
45
|
+
sub_resource_relationship: EntraApplicationToTenantRel = (
|
|
46
|
+
EntraApplicationToTenantRel()
|
|
47
|
+
)
|
|
@@ -0,0 +1,91 @@
|
|
|
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 EntraGroupNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("id")
|
|
17
|
+
display_name: PropertyRef = PropertyRef("display_name")
|
|
18
|
+
description: PropertyRef = PropertyRef("description")
|
|
19
|
+
mail: PropertyRef = PropertyRef("mail")
|
|
20
|
+
mail_nickname: PropertyRef = PropertyRef("mail_nickname")
|
|
21
|
+
mail_enabled: PropertyRef = PropertyRef("mail_enabled")
|
|
22
|
+
security_enabled: PropertyRef = PropertyRef("security_enabled")
|
|
23
|
+
group_types: PropertyRef = PropertyRef("group_types")
|
|
24
|
+
visibility: PropertyRef = PropertyRef("visibility")
|
|
25
|
+
is_assignable_to_role: PropertyRef = PropertyRef("is_assignable_to_role")
|
|
26
|
+
created_date_time: PropertyRef = PropertyRef("created_date_time")
|
|
27
|
+
deleted_date_time: PropertyRef = PropertyRef("deleted_date_time")
|
|
28
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass(frozen=True)
|
|
32
|
+
class EntraGroupToTenantRelProperties(CartographyRelProperties):
|
|
33
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass(frozen=True)
|
|
37
|
+
class EntraGroupToTenantRel(CartographyRelSchema):
|
|
38
|
+
target_node_label: str = "EntraTenant"
|
|
39
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
40
|
+
{"id": PropertyRef("TENANT_ID", set_in_kwargs=True)}
|
|
41
|
+
)
|
|
42
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
43
|
+
rel_label: str = "RESOURCE"
|
|
44
|
+
properties: EntraGroupToTenantRelProperties = EntraGroupToTenantRelProperties()
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@dataclass(frozen=True)
|
|
48
|
+
class EntraGroupToUserRelProperties(CartographyRelProperties):
|
|
49
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@dataclass(frozen=True)
|
|
53
|
+
# (:EntraUser)-[:MEMBER_OF]->(:EntraGroup)
|
|
54
|
+
class EntraGroupToUserRel(CartographyRelSchema):
|
|
55
|
+
target_node_label: str = "EntraUser"
|
|
56
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
57
|
+
{"id": PropertyRef("member_ids", one_to_many=True)}
|
|
58
|
+
)
|
|
59
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
60
|
+
rel_label: str = "MEMBER_OF"
|
|
61
|
+
properties: EntraGroupToUserRelProperties = EntraGroupToUserRelProperties()
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
@dataclass(frozen=True)
|
|
65
|
+
class EntraGroupToGroupRelProperties(CartographyRelProperties):
|
|
66
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
@dataclass(frozen=True)
|
|
70
|
+
# (:EntraGroup)-[:MEMBER_OF]->(:EntraGroup)
|
|
71
|
+
class EntraGroupToGroupRel(CartographyRelSchema):
|
|
72
|
+
target_node_label: str = "EntraGroup"
|
|
73
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
74
|
+
{"id": PropertyRef("member_group_ids", one_to_many=True)}
|
|
75
|
+
)
|
|
76
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
77
|
+
rel_label: str = "MEMBER_OF"
|
|
78
|
+
properties: EntraGroupToGroupRelProperties = EntraGroupToGroupRelProperties()
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@dataclass(frozen=True)
|
|
82
|
+
class EntraGroupSchema(CartographyNodeSchema):
|
|
83
|
+
label: str = "EntraGroup"
|
|
84
|
+
properties: EntraGroupNodeProperties = EntraGroupNodeProperties()
|
|
85
|
+
sub_resource_relationship: EntraGroupToTenantRel = EntraGroupToTenantRel()
|
|
86
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
87
|
+
[
|
|
88
|
+
EntraGroupToGroupRel(),
|
|
89
|
+
EntraGroupToUserRel(),
|
|
90
|
+
]
|
|
91
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
|
|
7
|
+
|
|
8
|
+
@dataclass(frozen=True)
|
|
9
|
+
class KubernetesClusterNodeProperties(CartographyNodeProperties):
|
|
10
|
+
id: PropertyRef = PropertyRef("id")
|
|
11
|
+
name: PropertyRef = PropertyRef("name", extra_index=True)
|
|
12
|
+
creation_timestamp: PropertyRef = PropertyRef("creation_timestamp")
|
|
13
|
+
external_id: PropertyRef = PropertyRef("external_id", extra_index=True)
|
|
14
|
+
version: PropertyRef = PropertyRef("git_version")
|
|
15
|
+
version_major: PropertyRef = PropertyRef("version_major")
|
|
16
|
+
version_minor: PropertyRef = PropertyRef("version_minor")
|
|
17
|
+
go_version: PropertyRef = PropertyRef("go_version")
|
|
18
|
+
compiler: PropertyRef = PropertyRef("compiler")
|
|
19
|
+
platform: PropertyRef = PropertyRef("platform")
|
|
20
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(frozen=True)
|
|
24
|
+
class KubernetesClusterSchema(CartographyNodeSchema):
|
|
25
|
+
label: str = "KubernetesCluster"
|
|
26
|
+
properties: KubernetesClusterNodeProperties = KubernetesClusterNodeProperties()
|
|
@@ -0,0 +1,108 @@
|
|
|
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 KubernetesContainerNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("uid")
|
|
17
|
+
name: PropertyRef = PropertyRef("name", extra_index=True)
|
|
18
|
+
image: PropertyRef = PropertyRef("image", extra_index=True)
|
|
19
|
+
namespace: PropertyRef = PropertyRef("namespace", extra_index=True)
|
|
20
|
+
cluster_name: PropertyRef = PropertyRef(
|
|
21
|
+
"CLUSTER_NAME", set_in_kwargs=True, extra_index=True
|
|
22
|
+
)
|
|
23
|
+
image_pull_policy: PropertyRef = PropertyRef("image_pull_policy")
|
|
24
|
+
status_image_id: PropertyRef = PropertyRef("status_image_id")
|
|
25
|
+
status_image_sha: PropertyRef = PropertyRef("status_image_sha")
|
|
26
|
+
status_ready: PropertyRef = PropertyRef("status_ready")
|
|
27
|
+
status_started: PropertyRef = PropertyRef("status_started")
|
|
28
|
+
status_state: PropertyRef = PropertyRef("status_state")
|
|
29
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
@dataclass(frozen=True)
|
|
33
|
+
class KubernetesContainerToKubernetesNamespaceRelProperties(CartographyRelProperties):
|
|
34
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@dataclass(frozen=True)
|
|
38
|
+
class KubernetesContainerToKubernetesPodRelProperties(CartographyRelProperties):
|
|
39
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@dataclass(frozen=True)
|
|
43
|
+
# (:KubernetesContainer)<-[:CONTAINS]-(:KubernetesNamespace)
|
|
44
|
+
class KubernetesContainerToKubernetesNamespaceRel(CartographyRelSchema):
|
|
45
|
+
target_node_label: str = "KubernetesNamespace"
|
|
46
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
47
|
+
{
|
|
48
|
+
"cluster_name": PropertyRef("CLUSTER_NAME", set_in_kwargs=True),
|
|
49
|
+
"name": PropertyRef("namespace"),
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
53
|
+
rel_label: str = "CONTAINS"
|
|
54
|
+
properties: KubernetesContainerToKubernetesNamespaceRelProperties = (
|
|
55
|
+
KubernetesContainerToKubernetesNamespaceRelProperties()
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@dataclass(frozen=True)
|
|
60
|
+
# (:KubernetesContainer)<-[:CONTAINS]-(:KubernetesPod)
|
|
61
|
+
class KubernetesContainerToKubernetesPodRel(CartographyRelSchema):
|
|
62
|
+
target_node_label: str = "KubernetesPod"
|
|
63
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
64
|
+
{
|
|
65
|
+
"cluster_name": PropertyRef("CLUSTER_NAME", set_in_kwargs=True),
|
|
66
|
+
"namespace": PropertyRef("namespace"),
|
|
67
|
+
"id": PropertyRef("pod_id"),
|
|
68
|
+
}
|
|
69
|
+
)
|
|
70
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
71
|
+
rel_label: str = "CONTAINS"
|
|
72
|
+
properties: KubernetesContainerToKubernetesPodRelProperties = (
|
|
73
|
+
KubernetesContainerToKubernetesPodRelProperties()
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@dataclass(frozen=True)
|
|
78
|
+
class KubernetesContainerToKubernetesClusterRelProperties(CartographyRelProperties):
|
|
79
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
@dataclass(frozen=True)
|
|
83
|
+
# (:KubernetesContainer)<-[:RESOURCE]-(:KubernetesCluster)
|
|
84
|
+
class KubernetesContainerToKubernetesClusterRel(CartographyRelSchema):
|
|
85
|
+
target_node_label: str = "KubernetesCluster"
|
|
86
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
87
|
+
{"id": PropertyRef("CLUSTER_ID", set_in_kwargs=True)}
|
|
88
|
+
)
|
|
89
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
90
|
+
rel_label: str = "RESOURCE"
|
|
91
|
+
properties: KubernetesContainerToKubernetesClusterRelProperties = (
|
|
92
|
+
KubernetesContainerToKubernetesClusterRelProperties()
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
@dataclass(frozen=True)
|
|
97
|
+
class KubernetesContainerSchema(CartographyNodeSchema):
|
|
98
|
+
label: str = "KubernetesContainer"
|
|
99
|
+
properties: KubernetesContainerNodeProperties = KubernetesContainerNodeProperties()
|
|
100
|
+
sub_resource_relationship: KubernetesContainerToKubernetesClusterRel = (
|
|
101
|
+
KubernetesContainerToKubernetesClusterRel()
|
|
102
|
+
)
|
|
103
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
104
|
+
[
|
|
105
|
+
KubernetesContainerToKubernetesNamespaceRel(),
|
|
106
|
+
KubernetesContainerToKubernetesPodRel(),
|
|
107
|
+
]
|
|
108
|
+
)
|
|
@@ -0,0 +1,51 @@
|
|
|
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 KubernetesNamespaceNodeProperties(CartographyNodeProperties):
|
|
15
|
+
id: PropertyRef = PropertyRef("uid")
|
|
16
|
+
name: PropertyRef = PropertyRef("name", extra_index=True)
|
|
17
|
+
creation_timestamp: PropertyRef = PropertyRef("creation_timestamp")
|
|
18
|
+
deletion_timestamp: PropertyRef = PropertyRef("deletion_timestamp")
|
|
19
|
+
status_phase: PropertyRef = PropertyRef("status_phase")
|
|
20
|
+
cluster_name: PropertyRef = PropertyRef(
|
|
21
|
+
"cluster_name", set_in_kwargs=True, extra_index=True
|
|
22
|
+
)
|
|
23
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass(frozen=True)
|
|
27
|
+
class KubernetesNamespaceToKubernetesClusterRelProperties(CartographyRelProperties):
|
|
28
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass(frozen=True)
|
|
32
|
+
# (:KubernetesNamespace)<-[:RESOURCE]-(:KubernetesCluster)
|
|
33
|
+
class KubernetesNamespaceToKubernetesClusterRel(CartographyRelSchema):
|
|
34
|
+
target_node_label: str = "KubernetesCluster"
|
|
35
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
36
|
+
{"id": PropertyRef("CLUSTER_ID", set_in_kwargs=True)},
|
|
37
|
+
)
|
|
38
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
39
|
+
rel_label: str = "RESOURCE"
|
|
40
|
+
properties: KubernetesNamespaceToKubernetesClusterRelProperties = (
|
|
41
|
+
KubernetesNamespaceToKubernetesClusterRelProperties()
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass(frozen=True)
|
|
46
|
+
class KubernetesNamespaceSchema(CartographyNodeSchema):
|
|
47
|
+
label: str = "KubernetesNamespace"
|
|
48
|
+
properties: KubernetesNamespaceNodeProperties = KubernetesNamespaceNodeProperties()
|
|
49
|
+
sub_resource_relationship: KubernetesNamespaceToKubernetesClusterRel = (
|
|
50
|
+
KubernetesNamespaceToKubernetesClusterRel()
|
|
51
|
+
)
|
|
@@ -0,0 +1,80 @@
|
|
|
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 KubernetesPodNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("uid")
|
|
17
|
+
name: PropertyRef = PropertyRef("name", extra_index=True)
|
|
18
|
+
status_phase: PropertyRef = PropertyRef("status_phase")
|
|
19
|
+
creation_timestamp: PropertyRef = PropertyRef("creation_timestamp")
|
|
20
|
+
deletion_timestamp: PropertyRef = PropertyRef("deletion_timestamp")
|
|
21
|
+
namespace: PropertyRef = PropertyRef("namespace", extra_index=True)
|
|
22
|
+
labels: PropertyRef = PropertyRef("labels")
|
|
23
|
+
cluster_name: PropertyRef = PropertyRef(
|
|
24
|
+
"CLUSTER_NAME", set_in_kwargs=True, extra_index=True
|
|
25
|
+
)
|
|
26
|
+
node: PropertyRef = PropertyRef("node")
|
|
27
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dataclass(frozen=True)
|
|
31
|
+
class KubernetesPodToKubernetesNamespaceRelProperties(CartographyRelProperties):
|
|
32
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@dataclass(frozen=True)
|
|
36
|
+
# (:KubernetesPod)<-[:CONTAINS]-(:KubernetesNamespace)
|
|
37
|
+
class KubernetesPodToKubernetesNamespaceRel(CartographyRelSchema):
|
|
38
|
+
target_node_label: str = "KubernetesNamespace"
|
|
39
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
40
|
+
{
|
|
41
|
+
"cluster_name": PropertyRef("CLUSTER_NAME", set_in_kwargs=True),
|
|
42
|
+
"name": PropertyRef("namespace"),
|
|
43
|
+
}
|
|
44
|
+
)
|
|
45
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
46
|
+
rel_label: str = "CONTAINS"
|
|
47
|
+
properties: KubernetesPodToKubernetesNamespaceRelProperties = (
|
|
48
|
+
KubernetesPodToKubernetesNamespaceRelProperties()
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
@dataclass(frozen=True)
|
|
53
|
+
class KubernetesPodToKubernetesClusterRelProperties(CartographyRelProperties):
|
|
54
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@dataclass(frozen=True)
|
|
58
|
+
# (:KubernetesPod)<-[:RESOURCE]-(:KubernetesCluster)
|
|
59
|
+
class KubernetesPodToKubernetesClusterRel(CartographyRelSchema):
|
|
60
|
+
target_node_label: str = "KubernetesCluster"
|
|
61
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
62
|
+
{"id": PropertyRef("CLUSTER_ID", set_in_kwargs=True)}
|
|
63
|
+
)
|
|
64
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
65
|
+
rel_label: str = "RESOURCE"
|
|
66
|
+
properties: KubernetesPodToKubernetesClusterRelProperties = (
|
|
67
|
+
KubernetesPodToKubernetesClusterRelProperties()
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass(frozen=True)
|
|
72
|
+
class KubernetesPodSchema(CartographyNodeSchema):
|
|
73
|
+
label: str = "KubernetesPod"
|
|
74
|
+
properties: KubernetesPodNodeProperties = KubernetesPodNodeProperties()
|
|
75
|
+
sub_resource_relationship: KubernetesPodToKubernetesClusterRel = (
|
|
76
|
+
KubernetesPodToKubernetesClusterRel()
|
|
77
|
+
)
|
|
78
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
79
|
+
[KubernetesPodToKubernetesNamespaceRel()]
|
|
80
|
+
)
|