cartography 0.106.0rc2__py3-none-any.whl → 0.107.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 +131 -2
- cartography/config.py +42 -0
- cartography/driftdetect/cli.py +3 -2
- 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/__init__.py +1 -0
- cartography/intel/aws/cloudtrail_management_events.py +364 -0
- cartography/intel/aws/cloudwatch.py +77 -0
- cartography/intel/aws/codebuild.py +132 -0
- cartography/intel/aws/ec2/subnets.py +1 -1
- cartography/intel/aws/ecs.py +17 -0
- cartography/intel/aws/inspector.py +77 -48
- cartography/intel/aws/resources.py +4 -0
- cartography/intel/aws/sns.py +62 -2
- cartography/intel/entra/users.py +84 -42
- 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/sentinelone/__init__.py +69 -0
- cartography/intel/sentinelone/account.py +140 -0
- cartography/intel/sentinelone/agent.py +139 -0
- cartography/intel/sentinelone/api.py +113 -0
- cartography/intel/sentinelone/application.py +248 -0
- cartography/intel/sentinelone/utils.py +28 -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/cloudtrail/management_events.py +64 -0
- cartography/models/aws/cloudwatch/log_metric_filter.py +79 -0
- cartography/models/aws/codebuild/__init__.py +0 -0
- cartography/models/aws/codebuild/project.py +49 -0
- cartography/models/aws/ec2/networkinterfaces.py +2 -0
- cartography/models/aws/ec2/subnet_instance.py +2 -0
- cartography/models/aws/ec2/subnet_networkinterface.py +2 -0
- cartography/models/aws/ecs/containers.py +19 -0
- cartography/models/aws/ecs/task_definitions.py +38 -0
- cartography/models/aws/ecs/tasks.py +24 -1
- cartography/models/aws/inspector/findings.py +37 -0
- cartography/models/aws/inspector/packages.py +1 -31
- cartography/models/aws/sns/topic_subscription.py +74 -0
- cartography/models/entra/user.py +17 -51
- 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/sentinelone/__init__.py +1 -0
- cartography/models/sentinelone/account.py +40 -0
- cartography/models/sentinelone/agent.py +50 -0
- cartography/models/sentinelone/application.py +44 -0
- cartography/models/sentinelone/application_version.py +96 -0
- cartography/sync.py +11 -4
- {cartography-0.106.0rc2.dist-info → cartography-0.107.0.dist-info}/METADATA +20 -16
- {cartography-0.106.0rc2.dist-info → cartography-0.107.0.dist-info}/RECORD +92 -28
- {cartography-0.106.0rc2.dist-info → cartography-0.107.0.dist-info}/WHEEL +0 -0
- {cartography-0.106.0rc2.dist-info → cartography-0.107.0.dist-info}/entry_points.txt +0 -0
- {cartography-0.106.0rc2.dist-info → cartography-0.107.0.dist-info}/licenses/LICENSE +0 -0
- {cartography-0.106.0rc2.dist-info → cartography-0.107.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,69 @@
|
|
|
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 AirbyteTagNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("tagId")
|
|
17
|
+
name: PropertyRef = PropertyRef("name")
|
|
18
|
+
color: PropertyRef = PropertyRef("color")
|
|
19
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(frozen=True)
|
|
23
|
+
class AirbyteTagToOrganizationRelProperties(CartographyRelProperties):
|
|
24
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass(frozen=True)
|
|
28
|
+
# (:AirbyteOrganization)-[:RESOURCE]->(:AirbyteTag)
|
|
29
|
+
class AirbyteTagToOrganizationRel(CartographyRelSchema):
|
|
30
|
+
target_node_label: str = "AirbyteOrganization"
|
|
31
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
32
|
+
{"id": PropertyRef("ORG_ID", set_in_kwargs=True)},
|
|
33
|
+
)
|
|
34
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
35
|
+
rel_label: str = "RESOURCE"
|
|
36
|
+
properties: AirbyteTagToOrganizationRelProperties = (
|
|
37
|
+
AirbyteTagToOrganizationRelProperties()
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass(frozen=True)
|
|
42
|
+
class AirbyteTagToWorkspaceRelProperties(CartographyRelProperties):
|
|
43
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True)
|
|
47
|
+
# (:AirbyteWorkspace)-[:CONTAINS]->(:AirbyteTag)
|
|
48
|
+
class AirbyteTagToWorkspaceRel(CartographyRelSchema):
|
|
49
|
+
target_node_label: str = "AirbyteWorkspace"
|
|
50
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
51
|
+
{"id": PropertyRef("workspaceId")},
|
|
52
|
+
)
|
|
53
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
54
|
+
rel_label: str = "CONTAINS"
|
|
55
|
+
properties: AirbyteTagToWorkspaceRelProperties = (
|
|
56
|
+
AirbyteTagToWorkspaceRelProperties()
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass(frozen=True)
|
|
61
|
+
class AirbyteTagSchema(CartographyNodeSchema):
|
|
62
|
+
label: str = "AirbyteTag"
|
|
63
|
+
properties: AirbyteTagNodeProperties = AirbyteTagNodeProperties()
|
|
64
|
+
sub_resource_relationship: AirbyteTagToOrganizationRel = (
|
|
65
|
+
AirbyteTagToOrganizationRel()
|
|
66
|
+
)
|
|
67
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
68
|
+
[AirbyteTagToWorkspaceRel()]
|
|
69
|
+
)
|
|
@@ -0,0 +1,111 @@
|
|
|
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 AirbyteUserNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("id")
|
|
17
|
+
name: PropertyRef = PropertyRef("name")
|
|
18
|
+
email: PropertyRef = PropertyRef("email", extra_index=True)
|
|
19
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(frozen=True)
|
|
23
|
+
class AirbyteUserToOrganizationRelProperties(CartographyRelProperties):
|
|
24
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
@dataclass(frozen=True)
|
|
28
|
+
# (:AirbyteOrganization)-[:RESOURCE]->(:AirbyteUser)
|
|
29
|
+
class AirbyteUserToOrganizationRel(CartographyRelSchema):
|
|
30
|
+
target_node_label: str = "AirbyteOrganization"
|
|
31
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
32
|
+
{"id": PropertyRef("ORG_ID", set_in_kwargs=True)},
|
|
33
|
+
)
|
|
34
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
35
|
+
rel_label: str = "RESOURCE"
|
|
36
|
+
properties: AirbyteUserToOrganizationRelProperties = (
|
|
37
|
+
AirbyteUserToOrganizationRelProperties()
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@dataclass(frozen=True)
|
|
42
|
+
class AirbyteUserToOrganizationAdminRelProperties(CartographyRelProperties):
|
|
43
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True)
|
|
47
|
+
# (:AirbyteOrganization)<-[:ADMIN_OF]-(:AirbyteUser)
|
|
48
|
+
class AirbyteUserToOrganizationAdminRel(CartographyRelSchema):
|
|
49
|
+
target_node_label: str = "AirbyteOrganization"
|
|
50
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
51
|
+
{"id": PropertyRef("adminOfOrganization", one_to_many=True)},
|
|
52
|
+
)
|
|
53
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
54
|
+
rel_label: str = "ADMIN_OF"
|
|
55
|
+
properties: AirbyteUserToOrganizationAdminRelProperties = (
|
|
56
|
+
AirbyteUserToOrganizationAdminRelProperties()
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass(frozen=True)
|
|
61
|
+
class AirbyteUserToWorkspaceAdminRelProperties(CartographyRelProperties):
|
|
62
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@dataclass(frozen=True)
|
|
66
|
+
# (:AirbyteWorkspace)<-[:ADMIN_OF]-(:AirbyteUser)
|
|
67
|
+
class AirbyteUserToWorkspaceAdminRel(CartographyRelSchema):
|
|
68
|
+
target_node_label: str = "AirbyteWorkspace"
|
|
69
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
70
|
+
{"id": PropertyRef("adminOfWorkspace", one_to_many=True)},
|
|
71
|
+
)
|
|
72
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
73
|
+
rel_label: str = "ADMIN_OF"
|
|
74
|
+
properties: AirbyteUserToWorkspaceAdminRelProperties = (
|
|
75
|
+
AirbyteUserToWorkspaceAdminRelProperties()
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
@dataclass(frozen=True)
|
|
80
|
+
class AirbyteUserToWorkspaceMemberRelProperties(CartographyRelProperties):
|
|
81
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@dataclass(frozen=True)
|
|
85
|
+
# (:AirbyteWorkspace)<-[:MEMBER_OF]-(:AirbyteUser)
|
|
86
|
+
class AirbyteUserToWorkspaceMemberRel(CartographyRelSchema):
|
|
87
|
+
target_node_label: str = "AirbyteWorkspace"
|
|
88
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
89
|
+
{"id": PropertyRef("memberOfWorkspace", one_to_many=True)},
|
|
90
|
+
)
|
|
91
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
92
|
+
rel_label: str = "MEMBER_OF"
|
|
93
|
+
properties: AirbyteUserToWorkspaceMemberRelProperties = (
|
|
94
|
+
AirbyteUserToWorkspaceMemberRelProperties()
|
|
95
|
+
)
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
@dataclass(frozen=True)
|
|
99
|
+
class AirbyteUserSchema(CartographyNodeSchema):
|
|
100
|
+
label: str = "AirbyteUser"
|
|
101
|
+
properties: AirbyteUserNodeProperties = AirbyteUserNodeProperties()
|
|
102
|
+
sub_resource_relationship: AirbyteUserToOrganizationRel = (
|
|
103
|
+
AirbyteUserToOrganizationRel()
|
|
104
|
+
)
|
|
105
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
106
|
+
[
|
|
107
|
+
AirbyteUserToOrganizationAdminRel(),
|
|
108
|
+
AirbyteUserToWorkspaceAdminRel(),
|
|
109
|
+
AirbyteUserToWorkspaceMemberRel(),
|
|
110
|
+
]
|
|
111
|
+
)
|
|
@@ -0,0 +1,46 @@
|
|
|
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 AirbyteWorkspaceNodeProperties(CartographyNodeProperties):
|
|
15
|
+
id: PropertyRef = PropertyRef("workspaceId")
|
|
16
|
+
name: PropertyRef = PropertyRef("name")
|
|
17
|
+
data_residency: PropertyRef = PropertyRef("dataResidency")
|
|
18
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
@dataclass(frozen=True)
|
|
22
|
+
class AirbyteWorkspaceToOrganizationRelProperties(CartographyRelProperties):
|
|
23
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass(frozen=True)
|
|
27
|
+
# (:AirbyteOrganization)-[:RESOURCE]->(:AirbyteWorkspace)
|
|
28
|
+
class AirbyteWorkspaceToOrganizationRel(CartographyRelSchema):
|
|
29
|
+
target_node_label: str = "AirbyteOrganization"
|
|
30
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
31
|
+
{"id": PropertyRef("ORG_ID", set_in_kwargs=True)},
|
|
32
|
+
)
|
|
33
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
34
|
+
rel_label: str = "RESOURCE"
|
|
35
|
+
properties: AirbyteWorkspaceToOrganizationRelProperties = (
|
|
36
|
+
AirbyteWorkspaceToOrganizationRelProperties()
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass(frozen=True)
|
|
41
|
+
class AirbyteWorkspaceSchema(CartographyNodeSchema):
|
|
42
|
+
label: str = "AirbyteWorkspace"
|
|
43
|
+
properties: AirbyteWorkspaceNodeProperties = AirbyteWorkspaceNodeProperties()
|
|
44
|
+
sub_resource_relationship: AirbyteWorkspaceToOrganizationRel = (
|
|
45
|
+
AirbyteWorkspaceToOrganizationRel()
|
|
46
|
+
)
|
|
@@ -0,0 +1,64 @@
|
|
|
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 AssumedRoleRelProperties(CartographyRelProperties):
|
|
15
|
+
"""
|
|
16
|
+
Properties for the ASSUMED_ROLE relationship representing role assumption events.
|
|
17
|
+
Matches the cloudtrail_management_events spec and adds enhanced temporal precision.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
# Mandatory fields for MatchLinks
|
|
21
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
22
|
+
_sub_resource_label: PropertyRef = PropertyRef(
|
|
23
|
+
"_sub_resource_label", set_in_kwargs=True
|
|
24
|
+
)
|
|
25
|
+
_sub_resource_id: PropertyRef = PropertyRef("_sub_resource_id", set_in_kwargs=True)
|
|
26
|
+
|
|
27
|
+
# CloudTrail-specific relationship properties
|
|
28
|
+
last_used: PropertyRef = PropertyRef("last_used")
|
|
29
|
+
times_used: PropertyRef = PropertyRef("times_used")
|
|
30
|
+
first_seen_in_time_window: PropertyRef = PropertyRef("first_seen_in_time_window")
|
|
31
|
+
|
|
32
|
+
# Event type tracking properties
|
|
33
|
+
event_types: PropertyRef = PropertyRef("event_types")
|
|
34
|
+
assume_role_count: PropertyRef = PropertyRef("assume_role_count")
|
|
35
|
+
saml_count: PropertyRef = PropertyRef("saml_count")
|
|
36
|
+
web_identity_count: PropertyRef = PropertyRef("web_identity_count")
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@dataclass(frozen=True)
|
|
40
|
+
class AssumedRoleMatchLink(CartographyRelSchema):
|
|
41
|
+
"""
|
|
42
|
+
MatchLink schema for ASSUMED_ROLE relationships from CloudTrail events.
|
|
43
|
+
Creates relationships like: (AWSUser|AWSRole|AWSPrincipal)-[:ASSUMED_ROLE]->(AWSRole)
|
|
44
|
+
|
|
45
|
+
This MatchLink handles role assumption relationships discovered via CloudTrail management events.
|
|
46
|
+
It supports multiple source node types and aggregated relationship properties.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
# MatchLink-specific fields
|
|
50
|
+
source_node_label: str = (
|
|
51
|
+
"AWSPrincipal" # Base type that covers AWSUser, AWSRole, AWSPrincipal
|
|
52
|
+
)
|
|
53
|
+
source_node_matcher: SourceNodeMatcher = make_source_node_matcher(
|
|
54
|
+
{"arn": PropertyRef("source_principal_arn")},
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
# Standard CartographyRelSchema fields
|
|
58
|
+
target_node_label: str = "AWSRole"
|
|
59
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
60
|
+
{"arn": PropertyRef("destination_principal_arn")},
|
|
61
|
+
)
|
|
62
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
63
|
+
rel_label: str = "ASSUMED_ROLE"
|
|
64
|
+
properties: AssumedRoleRelProperties = AssumedRoleRelProperties()
|
|
@@ -0,0 +1,79 @@
|
|
|
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 CloudWatchLogMetricFilterNodeProperties(CartographyNodeProperties):
|
|
16
|
+
id: PropertyRef = PropertyRef("id")
|
|
17
|
+
arn: PropertyRef = PropertyRef("filterName", extra_index=True)
|
|
18
|
+
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
19
|
+
filter_name: PropertyRef = PropertyRef("filterName")
|
|
20
|
+
filter_pattern: PropertyRef = PropertyRef("filterPattern")
|
|
21
|
+
log_group_name: PropertyRef = PropertyRef("logGroupName")
|
|
22
|
+
metric_name: PropertyRef = PropertyRef("metricName")
|
|
23
|
+
metric_namespace: PropertyRef = PropertyRef("metricNamespace")
|
|
24
|
+
metric_value: PropertyRef = PropertyRef("metricValue")
|
|
25
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass(frozen=True)
|
|
29
|
+
class CloudWatchLogMetricFilterToAwsAccountRelProperties(CartographyRelProperties):
|
|
30
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
@dataclass(frozen=True)
|
|
34
|
+
class CloudWatchLogMetricFilterToAWSAccountRel(CartographyRelSchema):
|
|
35
|
+
target_node_label: str = "AWSAccount"
|
|
36
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
37
|
+
{"id": PropertyRef("AWS_ID", set_in_kwargs=True)},
|
|
38
|
+
)
|
|
39
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
40
|
+
rel_label: str = "RESOURCE"
|
|
41
|
+
properties: CloudWatchLogMetricFilterToAwsAccountRelProperties = (
|
|
42
|
+
CloudWatchLogMetricFilterToAwsAccountRelProperties()
|
|
43
|
+
)
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True)
|
|
47
|
+
class CloudWatchLogMetricFilterToCloudWatchLogGroupRelProperties(
|
|
48
|
+
CartographyRelProperties
|
|
49
|
+
):
|
|
50
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@dataclass(frozen=True)
|
|
54
|
+
class CloudWatchLogMetricFilterToCloudWatchLogGroupRel(CartographyRelSchema):
|
|
55
|
+
target_node_label: str = "CloudWatchLogGroup"
|
|
56
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
57
|
+
{"log_group_name": PropertyRef("logGroupName")},
|
|
58
|
+
)
|
|
59
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
60
|
+
rel_label: str = "METRIC_FILTER_OF"
|
|
61
|
+
properties: CloudWatchLogMetricFilterToCloudWatchLogGroupRelProperties = (
|
|
62
|
+
CloudWatchLogMetricFilterToCloudWatchLogGroupRelProperties()
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
@dataclass(frozen=True)
|
|
67
|
+
class CloudWatchLogMetricFilterSchema(CartographyNodeSchema):
|
|
68
|
+
label: str = "CloudWatchLogMetricFilter"
|
|
69
|
+
properties: CloudWatchLogMetricFilterNodeProperties = (
|
|
70
|
+
CloudWatchLogMetricFilterNodeProperties()
|
|
71
|
+
)
|
|
72
|
+
sub_resource_relationship: CloudWatchLogMetricFilterToAWSAccountRel = (
|
|
73
|
+
CloudWatchLogMetricFilterToAWSAccountRel()
|
|
74
|
+
)
|
|
75
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
76
|
+
[
|
|
77
|
+
CloudWatchLogMetricFilterToCloudWatchLogGroupRel(),
|
|
78
|
+
]
|
|
79
|
+
)
|
|
File without changes
|
|
@@ -0,0 +1,49 @@
|
|
|
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 CodeBuildProjectNodeProperties(CartographyNodeProperties):
|
|
15
|
+
id: PropertyRef = PropertyRef("arn")
|
|
16
|
+
arn: PropertyRef = PropertyRef("arn", extra_index=True)
|
|
17
|
+
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
18
|
+
created: PropertyRef = PropertyRef("created")
|
|
19
|
+
environment_variables: PropertyRef = PropertyRef("environmentVariables")
|
|
20
|
+
source_type: PropertyRef = PropertyRef("sourceType")
|
|
21
|
+
source_location: PropertyRef = PropertyRef("sourceLocation")
|
|
22
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
@dataclass(frozen=True)
|
|
26
|
+
class CodeBuildProjectToAwsAccountRelProperties(CartographyRelProperties):
|
|
27
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@dataclass(frozen=True)
|
|
31
|
+
class CodeBuildProjectToAWSAccountRel(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: CodeBuildProjectToAwsAccountRelProperties = (
|
|
39
|
+
CodeBuildProjectToAwsAccountRelProperties()
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
@dataclass(frozen=True)
|
|
44
|
+
class CodeBuildProjectSchema(CartographyNodeSchema):
|
|
45
|
+
label: str = "CodeBuildProject"
|
|
46
|
+
properties: CodeBuildProjectNodeProperties = CodeBuildProjectNodeProperties()
|
|
47
|
+
sub_resource_relationship: CodeBuildProjectToAWSAccountRel = (
|
|
48
|
+
CodeBuildProjectToAWSAccountRel()
|
|
49
|
+
)
|
|
@@ -44,7 +44,9 @@ class EC2NetworkInterfaceNodeProperties(CartographyNodeProperties):
|
|
|
44
44
|
requester_id: PropertyRef = PropertyRef("RequesterId", extra_index=True)
|
|
45
45
|
requester_managed: PropertyRef = PropertyRef("RequesterManaged")
|
|
46
46
|
source_dest_check: PropertyRef = PropertyRef("SourceDestCheck")
|
|
47
|
+
# TODO: remove subnetid once we have migrated to subnet_id
|
|
47
48
|
subnetid: PropertyRef = PropertyRef("SubnetId", extra_index=True)
|
|
49
|
+
subnet_id: PropertyRef = PropertyRef("SubnetId", extra_index=True)
|
|
48
50
|
|
|
49
51
|
|
|
50
52
|
@dataclass(frozen=True)
|
|
@@ -15,7 +15,9 @@ from cartography.models.core.relationships import TargetNodeMatcher
|
|
|
15
15
|
class EC2SubnetInstanceNodeProperties(CartographyNodeProperties):
|
|
16
16
|
# arn: PropertyRef = PropertyRef('Arn', extra_index=True) TODO use arn; issue #1024
|
|
17
17
|
id: PropertyRef = PropertyRef("SubnetId")
|
|
18
|
+
# TODO: remove subnetid once we have migrated to subnet_id
|
|
18
19
|
subnetid: PropertyRef = PropertyRef("SubnetId", extra_index=True)
|
|
20
|
+
subnet_id: PropertyRef = PropertyRef("SubnetId", extra_index=True)
|
|
19
21
|
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
20
22
|
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
21
23
|
|
|
@@ -16,6 +16,8 @@ from cartography.models.core.relationships import TargetNodeMatcher
|
|
|
16
16
|
@dataclass(frozen=True)
|
|
17
17
|
class EC2SubnetNetworkInterfaceNodeProperties(CartographyNodeProperties):
|
|
18
18
|
id: PropertyRef = PropertyRef("SubnetId")
|
|
19
|
+
# TODO: remove subnetid once we have migrated to subnet_id
|
|
20
|
+
subnetid: PropertyRef = PropertyRef("SubnetId", extra_index=True)
|
|
19
21
|
subnet_id: PropertyRef = PropertyRef("SubnetId", extra_index=True)
|
|
20
22
|
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
21
23
|
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
@@ -66,6 +66,24 @@ class ECSContainerToTaskRel(CartographyRelSchema):
|
|
|
66
66
|
properties: ECSContainerToTaskRelProperties = ECSContainerToTaskRelProperties()
|
|
67
67
|
|
|
68
68
|
|
|
69
|
+
@dataclass(frozen=True)
|
|
70
|
+
class ECSContainerToECRImageRelProperties(CartographyRelProperties):
|
|
71
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
@dataclass(frozen=True)
|
|
75
|
+
class ECSContainerToECRImageRel(CartographyRelSchema):
|
|
76
|
+
target_node_label: str = "ECRImage"
|
|
77
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
78
|
+
{"digest": PropertyRef("imageDigest")}
|
|
79
|
+
)
|
|
80
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
81
|
+
rel_label: str = "HAS_IMAGE"
|
|
82
|
+
properties: ECSContainerToECRImageRelProperties = (
|
|
83
|
+
ECSContainerToECRImageRelProperties()
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
|
|
69
87
|
@dataclass(frozen=True)
|
|
70
88
|
class ECSContainerSchema(CartographyNodeSchema):
|
|
71
89
|
label: str = "ECSContainer"
|
|
@@ -76,5 +94,6 @@ class ECSContainerSchema(CartographyNodeSchema):
|
|
|
76
94
|
other_relationships: OtherRelationships = OtherRelationships(
|
|
77
95
|
[
|
|
78
96
|
ECSContainerToTaskRel(),
|
|
97
|
+
ECSContainerToECRImageRel(),
|
|
79
98
|
]
|
|
80
99
|
)
|
|
@@ -83,6 +83,42 @@ class ECSTaskDefinitionToECSTaskRel(CartographyRelSchema):
|
|
|
83
83
|
)
|
|
84
84
|
|
|
85
85
|
|
|
86
|
+
@dataclass(frozen=True)
|
|
87
|
+
class ECSTaskDefinitionToTaskRoleRelProperties(CartographyRelProperties):
|
|
88
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
@dataclass(frozen=True)
|
|
92
|
+
class ECSTaskDefinitionToTaskRoleRel(CartographyRelSchema):
|
|
93
|
+
target_node_label: str = "AWSRole"
|
|
94
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
95
|
+
{"arn": PropertyRef("taskRoleArn")}
|
|
96
|
+
)
|
|
97
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
98
|
+
rel_label: str = "HAS_TASK_ROLE"
|
|
99
|
+
properties: ECSTaskDefinitionToTaskRoleRelProperties = (
|
|
100
|
+
ECSTaskDefinitionToTaskRoleRelProperties()
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
@dataclass(frozen=True)
|
|
105
|
+
class ECSTaskDefinitionToExecutionRoleRelProperties(CartographyRelProperties):
|
|
106
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@dataclass(frozen=True)
|
|
110
|
+
class ECSTaskDefinitionToExecutionRoleRel(CartographyRelSchema):
|
|
111
|
+
target_node_label: str = "AWSRole"
|
|
112
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
113
|
+
{"arn": PropertyRef("executionRoleArn")}
|
|
114
|
+
)
|
|
115
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
116
|
+
rel_label: str = "HAS_EXECUTION_ROLE"
|
|
117
|
+
properties: ECSTaskDefinitionToExecutionRoleRelProperties = (
|
|
118
|
+
ECSTaskDefinitionToExecutionRoleRelProperties()
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
86
122
|
@dataclass(frozen=True)
|
|
87
123
|
class ECSTaskDefinitionSchema(CartographyNodeSchema):
|
|
88
124
|
label: str = "ECSTaskDefinition"
|
|
@@ -93,5 +129,7 @@ class ECSTaskDefinitionSchema(CartographyNodeSchema):
|
|
|
93
129
|
other_relationships: OtherRelationships = OtherRelationships(
|
|
94
130
|
[
|
|
95
131
|
ECSTaskDefinitionToECSTaskRel(),
|
|
132
|
+
ECSTaskDefinitionToTaskRoleRel(),
|
|
133
|
+
ECSTaskDefinitionToExecutionRoleRel(),
|
|
96
134
|
]
|
|
97
135
|
)
|
|
@@ -46,6 +46,7 @@ class ECSTaskNodeProperties(CartographyNodeProperties):
|
|
|
46
46
|
ephemeral_storage_size_in_gib: PropertyRef = PropertyRef(
|
|
47
47
|
"ephemeralStorage.sizeInGiB"
|
|
48
48
|
)
|
|
49
|
+
network_interface_id: PropertyRef = PropertyRef("networkInterfaceId")
|
|
49
50
|
region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
|
|
50
51
|
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
51
52
|
|
|
@@ -100,11 +101,33 @@ class ECSTaskToAWSAccountRel(CartographyRelSchema):
|
|
|
100
101
|
properties: ECSTaskToAWSAccountRelProperties = ECSTaskToAWSAccountRelProperties()
|
|
101
102
|
|
|
102
103
|
|
|
104
|
+
@dataclass(frozen=True)
|
|
105
|
+
class ECSTaskToNetworkInterfaceRelProperties(CartographyRelProperties):
|
|
106
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@dataclass(frozen=True)
|
|
110
|
+
class ECSTaskToNetworkInterfaceRel(CartographyRelSchema):
|
|
111
|
+
target_node_label: str = "NetworkInterface"
|
|
112
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
113
|
+
{"id": PropertyRef("networkInterfaceId")}
|
|
114
|
+
)
|
|
115
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
116
|
+
rel_label: str = "NETWORK_INTERFACE"
|
|
117
|
+
properties: ECSTaskToNetworkInterfaceRelProperties = (
|
|
118
|
+
ECSTaskToNetworkInterfaceRelProperties()
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
|
|
103
122
|
@dataclass(frozen=True)
|
|
104
123
|
class ECSTaskSchema(CartographyNodeSchema):
|
|
105
124
|
label: str = "ECSTask"
|
|
106
125
|
properties: ECSTaskNodeProperties = ECSTaskNodeProperties()
|
|
107
126
|
sub_resource_relationship: ECSTaskToAWSAccountRel = ECSTaskToAWSAccountRel()
|
|
108
127
|
other_relationships: OtherRelationships = OtherRelationships(
|
|
109
|
-
[
|
|
128
|
+
[
|
|
129
|
+
ECSTaskToContainerInstanceRel(),
|
|
130
|
+
ECSTaskToECSClusterRel(),
|
|
131
|
+
ECSTaskToNetworkInterfaceRel(),
|
|
132
|
+
]
|
|
110
133
|
)
|
|
@@ -7,8 +7,10 @@ from cartography.models.core.nodes import ExtraNodeLabels
|
|
|
7
7
|
from cartography.models.core.relationships import CartographyRelProperties
|
|
8
8
|
from cartography.models.core.relationships import CartographyRelSchema
|
|
9
9
|
from cartography.models.core.relationships import LinkDirection
|
|
10
|
+
from cartography.models.core.relationships import make_source_node_matcher
|
|
10
11
|
from cartography.models.core.relationships import make_target_node_matcher
|
|
11
12
|
from cartography.models.core.relationships import OtherRelationships
|
|
13
|
+
from cartography.models.core.relationships import SourceNodeMatcher
|
|
12
14
|
from cartography.models.core.relationships import TargetNodeMatcher
|
|
13
15
|
|
|
14
16
|
|
|
@@ -135,6 +137,40 @@ class InspectorFindingToECRImageRel(CartographyRelSchema):
|
|
|
135
137
|
)
|
|
136
138
|
|
|
137
139
|
|
|
140
|
+
@dataclass(frozen=True)
|
|
141
|
+
class InspectorFindingToPackageRelRelProperties(CartographyRelProperties):
|
|
142
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
143
|
+
_sub_resource_label: PropertyRef = PropertyRef(
|
|
144
|
+
"_sub_resource_label", set_in_kwargs=True
|
|
145
|
+
)
|
|
146
|
+
_sub_resource_id: PropertyRef = PropertyRef("_sub_resource_id", set_in_kwargs=True)
|
|
147
|
+
# The following properties live in vulnerablePackages from AWS API
|
|
148
|
+
# Adding them here to avoid multiple repetion of packages
|
|
149
|
+
filepath: PropertyRef = PropertyRef("filePath")
|
|
150
|
+
fixedinversion: PropertyRef = PropertyRef("fixedInVersion")
|
|
151
|
+
remediation: PropertyRef = PropertyRef("remediation")
|
|
152
|
+
sourcelayerhash: PropertyRef = PropertyRef("sourceLayerHash")
|
|
153
|
+
sourcelambdalayerarn: PropertyRef = PropertyRef("sourceLambdaLayerArn")
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
@dataclass(frozen=True)
|
|
157
|
+
# (:AWSInspectorFinding)-[:HAS]->(:AWSInspectorPackage)
|
|
158
|
+
class InspectorFindingToPackageMatchLink(CartographyRelSchema):
|
|
159
|
+
target_node_label: str = "AWSInspectorPackage"
|
|
160
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
161
|
+
{"id": PropertyRef("packageid")},
|
|
162
|
+
)
|
|
163
|
+
source_node_label: str = "AWSInspectorFinding"
|
|
164
|
+
source_node_matcher: SourceNodeMatcher = make_source_node_matcher(
|
|
165
|
+
{"id": PropertyRef("findingarn")},
|
|
166
|
+
)
|
|
167
|
+
properties: InspectorFindingToPackageRelRelProperties = (
|
|
168
|
+
InspectorFindingToPackageRelRelProperties()
|
|
169
|
+
)
|
|
170
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
171
|
+
rel_label: str = "HAS"
|
|
172
|
+
|
|
173
|
+
|
|
138
174
|
@dataclass(frozen=True)
|
|
139
175
|
class AWSInspectorFindingSchema(CartographyNodeSchema):
|
|
140
176
|
label: str = "AWSInspectorFinding"
|
|
@@ -146,6 +182,7 @@ class AWSInspectorFindingSchema(CartographyNodeSchema):
|
|
|
146
182
|
other_relationships: OtherRelationships = OtherRelationships(
|
|
147
183
|
[
|
|
148
184
|
InspectorFindingToEC2InstanceRel(),
|
|
185
|
+
# TODO: Fix ECRRepository and ECRImage relationships
|
|
149
186
|
InspectorFindingToECRRepositoryRel(),
|
|
150
187
|
InspectorFindingToECRImageRel(),
|
|
151
188
|
InspectorFindingToAWSAccountRelDelegateRel(),
|