cartography 0.104.0rc3__py3-none-any.whl → 0.106.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 +104 -3
- cartography/client/aws/__init__.py +19 -0
- cartography/client/aws/ecr.py +51 -0
- cartography/client/core/tx.py +62 -0
- cartography/config.py +32 -0
- cartography/data/indexes.cypher +0 -37
- cartography/data/jobs/cleanup/aws_import_lambda_cleanup.json +1 -1
- cartography/driftdetect/cli.py +3 -2
- cartography/graph/cleanupbuilder.py +198 -41
- cartography/graph/job.py +42 -0
- cartography/graph/querybuilder.py +136 -2
- cartography/graph/statement.py +1 -1
- cartography/intel/airbyte/__init__.py +105 -0
- cartography/intel/airbyte/connections.py +120 -0
- cartography/intel/airbyte/destinations.py +81 -0
- cartography/intel/airbyte/organizations.py +59 -0
- cartography/intel/airbyte/sources.py +78 -0
- cartography/intel/airbyte/tags.py +64 -0
- cartography/intel/airbyte/users.py +106 -0
- cartography/intel/airbyte/util.py +122 -0
- cartography/intel/airbyte/workspaces.py +63 -0
- cartography/intel/aws/acm.py +124 -0
- cartography/intel/aws/cloudtrail.py +3 -38
- cartography/intel/aws/codebuild.py +132 -0
- cartography/intel/aws/ecr.py +8 -2
- cartography/intel/aws/ecs.py +228 -380
- cartography/intel/aws/efs.py +179 -11
- cartography/intel/aws/iam.py +1 -1
- cartography/intel/aws/identitycenter.py +14 -3
- cartography/intel/aws/inspector.py +96 -53
- cartography/intel/aws/lambda_function.py +1 -1
- cartography/intel/aws/rds.py +2 -1
- cartography/intel/aws/resources.py +4 -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/entra/users.py +84 -42
- 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/scaleway/__init__.py +127 -0
- cartography/intel/scaleway/iam/__init__.py +0 -0
- cartography/intel/scaleway/iam/apikeys.py +71 -0
- cartography/intel/scaleway/iam/applications.py +71 -0
- cartography/intel/scaleway/iam/groups.py +71 -0
- cartography/intel/scaleway/iam/users.py +71 -0
- cartography/intel/scaleway/instances/__init__.py +0 -0
- cartography/intel/scaleway/instances/flexibleips.py +86 -0
- cartography/intel/scaleway/instances/instances.py +92 -0
- cartography/intel/scaleway/projects.py +79 -0
- cartography/intel/scaleway/storage/__init__.py +0 -0
- cartography/intel/scaleway/storage/snapshots.py +86 -0
- cartography/intel/scaleway/storage/volumes.py +84 -0
- cartography/intel/scaleway/utils.py +37 -0
- cartography/intel/trivy/__init__.py +161 -0
- cartography/intel/trivy/scanner.py +363 -0
- cartography/models/airbyte/__init__.py +0 -0
- cartography/models/airbyte/connection.py +138 -0
- cartography/models/airbyte/destination.py +75 -0
- cartography/models/airbyte/organization.py +19 -0
- cartography/models/airbyte/source.py +75 -0
- cartography/models/airbyte/stream.py +74 -0
- cartography/models/airbyte/tag.py +69 -0
- cartography/models/airbyte/user.py +111 -0
- cartography/models/airbyte/workspace.py +46 -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/codebuild/__init__.py +0 -0
- cartography/models/aws/codebuild/project.py +49 -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 +99 -0
- cartography/models/aws/ecs/services.py +117 -0
- cartography/models/aws/ecs/task_definitions.py +135 -0
- cartography/models/aws/ecs/tasks.py +110 -0
- cartography/models/aws/efs/access_point.py +77 -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/common.py +1 -0
- cartography/models/core/nodes.py +15 -2
- cartography/models/core/relationships.py +44 -0
- 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/entra/user.py +17 -51
- 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/scaleway/__init__.py +0 -0
- cartography/models/scaleway/iam/__init__.py +0 -0
- cartography/models/scaleway/iam/apikey.py +96 -0
- cartography/models/scaleway/iam/application.py +52 -0
- cartography/models/scaleway/iam/group.py +95 -0
- cartography/models/scaleway/iam/user.py +60 -0
- cartography/models/scaleway/instance/__init__.py +0 -0
- cartography/models/scaleway/instance/flexibleip.py +52 -0
- cartography/models/scaleway/instance/instance.py +118 -0
- cartography/models/scaleway/organization.py +19 -0
- cartography/models/scaleway/project.py +48 -0
- cartography/models/scaleway/storage/__init__.py +0 -0
- cartography/models/scaleway/storage/snapshot.py +78 -0
- cartography/models/scaleway/storage/volume.py +51 -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 +10 -4
- cartography/util.py +15 -10
- {cartography-0.104.0rc3.dist-info → cartography-0.106.0.dist-info}/METADATA +6 -2
- {cartography-0.104.0rc3.dist-info → cartography-0.106.0.dist-info}/RECORD +133 -49
- cartography/data/jobs/cleanup/kubernetes_import_cleanup.json +0 -70
- {cartography-0.104.0rc3.dist-info → cartography-0.106.0.dist-info}/WHEEL +0 -0
- {cartography-0.104.0rc3.dist-info → cartography-0.106.0.dist-info}/entry_points.txt +0 -0
- {cartography-0.104.0rc3.dist-info → cartography-0.106.0.dist-info}/licenses/LICENSE +0 -0
- {cartography-0.104.0rc3.dist-info → cartography-0.106.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,60 @@
|
|
|
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 EfsFileSystemNodeProperties(CartographyNodeProperties):
|
|
15
|
+
id: PropertyRef = PropertyRef("FileSystemId")
|
|
16
|
+
arn: PropertyRef = PropertyRef("FileSystemArn", extra_index=True)
|
|
17
|
+
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
18
|
+
owner_id: PropertyRef = PropertyRef("OwnerId")
|
|
19
|
+
creation_token: PropertyRef = PropertyRef("CreationToken")
|
|
20
|
+
creation_time: PropertyRef = PropertyRef("CreationTime")
|
|
21
|
+
lifecycle_state: PropertyRef = PropertyRef("LifeCycleState")
|
|
22
|
+
name: PropertyRef = PropertyRef("Name")
|
|
23
|
+
number_of_mount_targets: PropertyRef = PropertyRef("NumberOfMountTargets")
|
|
24
|
+
size_in_bytes_value: PropertyRef = PropertyRef("SizeInBytesValue")
|
|
25
|
+
size_in_bytes_timestamp: PropertyRef = PropertyRef("SizeInBytesTimestamp")
|
|
26
|
+
performance_mode: PropertyRef = PropertyRef("PerformanceMode")
|
|
27
|
+
encrypted: PropertyRef = PropertyRef("Encrypted")
|
|
28
|
+
kms_key_id: PropertyRef = PropertyRef("KmsKeyId")
|
|
29
|
+
throughput_mode: PropertyRef = PropertyRef("ThroughputMode")
|
|
30
|
+
availability_zone_name: PropertyRef = PropertyRef("AvailabilityZoneName")
|
|
31
|
+
availability_zone_id: PropertyRef = PropertyRef("AvailabilityZoneId")
|
|
32
|
+
file_system_protection: PropertyRef = PropertyRef("FileSystemProtection")
|
|
33
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
@dataclass(frozen=True)
|
|
37
|
+
class EfsFileSystemToAwsAccountRelProperties(CartographyRelProperties):
|
|
38
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass(frozen=True)
|
|
42
|
+
class EfsFileSystemToAWSAccountRel(CartographyRelSchema):
|
|
43
|
+
target_node_label: str = "AWSAccount"
|
|
44
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
45
|
+
{"id": PropertyRef("AWS_ID", set_in_kwargs=True)},
|
|
46
|
+
)
|
|
47
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
48
|
+
rel_label: str = "RESOURCE"
|
|
49
|
+
properties: EfsFileSystemToAwsAccountRelProperties = (
|
|
50
|
+
EfsFileSystemToAwsAccountRelProperties()
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
@dataclass(frozen=True)
|
|
55
|
+
class EfsFileSystemSchema(CartographyNodeSchema):
|
|
56
|
+
label: str = "EfsFileSystem"
|
|
57
|
+
properties: EfsFileSystemNodeProperties = EfsFileSystemNodeProperties()
|
|
58
|
+
sub_resource_relationship: EfsFileSystemToAWSAccountRel = (
|
|
59
|
+
EfsFileSystemToAWSAccountRel()
|
|
60
|
+
)
|
|
@@ -7,6 +7,7 @@ from cartography.models.core.relationships import CartographyRelProperties
|
|
|
7
7
|
from cartography.models.core.relationships import CartographyRelSchema
|
|
8
8
|
from cartography.models.core.relationships import LinkDirection
|
|
9
9
|
from cartography.models.core.relationships import make_target_node_matcher
|
|
10
|
+
from cartography.models.core.relationships import OtherRelationships
|
|
10
11
|
from cartography.models.core.relationships import TargetNodeMatcher
|
|
11
12
|
|
|
12
13
|
|
|
@@ -14,6 +15,7 @@ from cartography.models.core.relationships import TargetNodeMatcher
|
|
|
14
15
|
class EfsMountTargetNodeProperties(CartographyNodeProperties):
|
|
15
16
|
id: PropertyRef = PropertyRef("MountTargetId")
|
|
16
17
|
arn: PropertyRef = PropertyRef("MountTargetId", extra_index=True)
|
|
18
|
+
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
17
19
|
fileSystem_id: PropertyRef = PropertyRef("FileSystemId")
|
|
18
20
|
lifecycle_state: PropertyRef = PropertyRef("LifeCycleState")
|
|
19
21
|
mount_target_id: PropertyRef = PropertyRef("MountTargetId")
|
|
@@ -33,7 +35,7 @@ class EfsMountTargetToAwsAccountRelProperties(CartographyRelProperties):
|
|
|
33
35
|
|
|
34
36
|
|
|
35
37
|
@dataclass(frozen=True)
|
|
36
|
-
class
|
|
38
|
+
class EfsMountTargetToAWSAccountRel(CartographyRelSchema):
|
|
37
39
|
target_node_label: str = "AWSAccount"
|
|
38
40
|
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
39
41
|
{"id": PropertyRef("AWS_ID", set_in_kwargs=True)},
|
|
@@ -45,8 +47,33 @@ class EfsToAWSAccountRel(CartographyRelSchema):
|
|
|
45
47
|
)
|
|
46
48
|
|
|
47
49
|
|
|
50
|
+
@dataclass(frozen=True)
|
|
51
|
+
class EfsMountTargetToEfsFileSystemRelProperties(CartographyRelProperties):
|
|
52
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(frozen=True)
|
|
56
|
+
class EfsMountTargetToEfsFileSystemRel(CartographyRelSchema):
|
|
57
|
+
target_node_label: str = "EfsFileSystem"
|
|
58
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
59
|
+
{"id": PropertyRef("FileSystemId")},
|
|
60
|
+
)
|
|
61
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
62
|
+
rel_label: str = "ATTACHED_TO"
|
|
63
|
+
properties: EfsMountTargetToEfsFileSystemRelProperties = (
|
|
64
|
+
EfsMountTargetToEfsFileSystemRelProperties()
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
|
|
48
68
|
@dataclass(frozen=True)
|
|
49
69
|
class EfsMountTargetSchema(CartographyNodeSchema):
|
|
50
70
|
label: str = "EfsMountTarget"
|
|
51
71
|
properties: EfsMountTargetNodeProperties = EfsMountTargetNodeProperties()
|
|
52
|
-
sub_resource_relationship:
|
|
72
|
+
sub_resource_relationship: EfsMountTargetToAWSAccountRel = (
|
|
73
|
+
EfsMountTargetToAWSAccountRel()
|
|
74
|
+
)
|
|
75
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
76
|
+
[
|
|
77
|
+
EfsMountTargetToEfsFileSystemRel(),
|
|
78
|
+
]
|
|
79
|
+
)
|
|
@@ -0,0 +1,24 @@
|
|
|
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_target_node_matcher
|
|
8
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True)
|
|
12
|
+
class S3BucketToSNSTopicRelProperties(CartographyRelProperties):
|
|
13
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@dataclass(frozen=True)
|
|
17
|
+
class S3BucketToSNSTopicRel(CartographyRelSchema):
|
|
18
|
+
target_node_label: str = "SNSTopic"
|
|
19
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
20
|
+
{"arn": PropertyRef("TopicArn")},
|
|
21
|
+
)
|
|
22
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
23
|
+
rel_label: str = "NOTIFIES"
|
|
24
|
+
properties: S3BucketToSNSTopicRelProperties = S3BucketToSNSTopicRelProperties()
|
|
@@ -91,8 +91,6 @@ class SecretsManagerSecretVersionToKMSKeyRel(CartographyRelSchema):
|
|
|
91
91
|
properties: SecretsManagerSecretVersionRelProperties = (
|
|
92
92
|
SecretsManagerSecretVersionRelProperties()
|
|
93
93
|
)
|
|
94
|
-
# Only create this relationship if KmsKeyId exists
|
|
95
|
-
conditional_match_property: str = "KmsKeyId"
|
|
96
94
|
|
|
97
95
|
|
|
98
96
|
@dataclass(frozen=True)
|
|
File without changes
|
|
@@ -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
|
+
)
|
|
@@ -63,6 +63,7 @@ class PropertyRef:
|
|
|
63
63
|
```
|
|
64
64
|
This means that as we create AWSInstanceProfile nodes, we will search for AWSRoles to attach to, and we do
|
|
65
65
|
this by checking if each role's `arn` field is in the `Roles` list of the data dict.
|
|
66
|
+
Note that one_to_many has no effect on matchlinks.
|
|
66
67
|
"""
|
|
67
68
|
self.name = name
|
|
68
69
|
self.set_in_kwargs = set_in_kwargs
|
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
|
|
@@ -42,6 +42,11 @@ class CartographyRelProperties(abc.ABC):
|
|
|
42
42
|
Abstract class that represents the properties on a CartographyRelSchema. This is intended to enforce that all
|
|
43
43
|
subclasses will have a lastupdated field defined on their resulting relationships. These fields are assigned to the
|
|
44
44
|
relationship in the `SET` clause.
|
|
45
|
+
|
|
46
|
+
If the CartographyRelSchema is used as a MatchLink, the following properties are required to be defined here:
|
|
47
|
+
- lastupdated: A PropertyRef to the update tag of the relationship.
|
|
48
|
+
- _sub_resource_label: A PropertyRef to the label of the sub-resource that the relationship is associated with.
|
|
49
|
+
- _sub_resource_id: A PropertyRef to the id of the sub-resource that the relationship is associated with.
|
|
45
50
|
"""
|
|
46
51
|
|
|
47
52
|
lastupdated: PropertyRef = field(init=False)
|
|
@@ -90,6 +95,29 @@ def make_target_node_matcher(key_ref_dict: Dict[str, PropertyRef]) -> TargetNode
|
|
|
90
95
|
return make_dataclass(TargetNodeMatcher.__name__, fields, frozen=True)()
|
|
91
96
|
|
|
92
97
|
|
|
98
|
+
@dataclass(frozen=True)
|
|
99
|
+
class SourceNodeMatcher:
|
|
100
|
+
"""
|
|
101
|
+
Same as TargetNodeMatcher, but for the source node; see `make_source_node_matcher()`.
|
|
102
|
+
This object is used only for load_matchlinks() where we match on and connect existing nodes.
|
|
103
|
+
This has no effect on CartographyRelSchema objects that are included in CartographyNodeSchema.
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
pass
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
def make_source_node_matcher(key_ref_dict: Dict[str, PropertyRef]) -> SourceNodeMatcher:
|
|
110
|
+
"""
|
|
111
|
+
:param key_ref_dict: A Dict mapping keys present on the node to PropertyRef objects.
|
|
112
|
+
:return: A SourceNodeMatcher used for CartographyRelSchema to match with other nodes.
|
|
113
|
+
"""
|
|
114
|
+
fields = [
|
|
115
|
+
(key, PropertyRef, field(default=prop_ref))
|
|
116
|
+
for key, prop_ref in key_ref_dict.items()
|
|
117
|
+
]
|
|
118
|
+
return make_dataclass(SourceNodeMatcher.__name__, fields, frozen=True)()
|
|
119
|
+
|
|
120
|
+
|
|
93
121
|
@dataclass(frozen=True)
|
|
94
122
|
class CartographyRelSchema(abc.ABC):
|
|
95
123
|
"""
|
|
@@ -139,6 +167,22 @@ class CartographyRelSchema(abc.ABC):
|
|
|
139
167
|
"""
|
|
140
168
|
pass
|
|
141
169
|
|
|
170
|
+
@property
|
|
171
|
+
def source_node_label(self) -> str | None:
|
|
172
|
+
"""
|
|
173
|
+
:return: Optional. Only used for load_matchlinks(). The source node label to use for the relationship.
|
|
174
|
+
This does not affect CartographyRelSchema that are included in CartographyNodeSchema objects.
|
|
175
|
+
"""
|
|
176
|
+
return None
|
|
177
|
+
|
|
178
|
+
@property
|
|
179
|
+
def source_node_matcher(self) -> SourceNodeMatcher | None:
|
|
180
|
+
"""
|
|
181
|
+
:return: Optional. Only used for load_matchlinks(). A SourceNodeMatcher object used to find what node(s) to attach the relationship to.
|
|
182
|
+
This does not affect CartographyRelSchema that are included in CartographyNodeSchema objects.
|
|
183
|
+
"""
|
|
184
|
+
return None
|
|
185
|
+
|
|
142
186
|
|
|
143
187
|
@dataclass(frozen=True)
|
|
144
188
|
class OtherRelationships:
|
|
@@ -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
|
+
)
|