cartography 0.104.0rc3__py3-none-any.whl → 0.105.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 +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 -3
- 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/iam.py +1 -1
- cartography/intel/aws/lambda_function.py +1 -1
- cartography/intel/aws/resources.py +2 -2
- cartography/intel/aws/s3.py +195 -4
- cartography/intel/aws/sqs.py +36 -90
- cartography/intel/entra/__init__.py +11 -0
- cartography/intel/entra/groups.py +151 -0
- cartography/intel/entra/ou.py +21 -5
- cartography/intel/trivy/__init__.py +161 -0
- cartography/intel/trivy/scanner.py +363 -0
- cartography/models/aws/acm/certificate.py +75 -0
- cartography/models/aws/cloudtrail/trail.py +24 -0
- 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/group.py +91 -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-0.104.0rc3.dist-info → cartography-0.105.0.dist-info}/METADATA +3 -2
- {cartography-0.104.0rc3.dist-info → cartography-0.105.0.dist-info}/RECORD +41 -29
- cartography/intel/aws/efs.py +0 -93
- cartography/models/aws/efs/mount_target.py +0 -52
- /cartography/models/aws/{efs → acm}/__init__.py +0 -0
- {cartography-0.104.0rc3.dist-info → cartography-0.105.0.dist-info}/WHEEL +0 -0
- {cartography-0.104.0rc3.dist-info → cartography-0.105.0.dist-info}/entry_points.txt +0 -0
- {cartography-0.104.0rc3.dist-info → cartography-0.105.0.dist-info}/licenses/LICENSE +0 -0
- {cartography-0.104.0rc3.dist-info → cartography-0.105.0.dist-info}/top_level.txt +0 -0
|
@@ -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
|
+
)
|
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,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,66 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.nodes import ExtraNodeLabels
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
8
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
9
|
+
from cartography.models.core.relationships import LinkDirection
|
|
10
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
11
|
+
from cartography.models.core.relationships import OtherRelationships
|
|
12
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(frozen=True)
|
|
16
|
+
class TrivyImageFindingNodeProperties(CartographyNodeProperties):
|
|
17
|
+
id: PropertyRef = PropertyRef("id")
|
|
18
|
+
name: PropertyRef = PropertyRef("VulnerabilityID")
|
|
19
|
+
cve_id: PropertyRef = PropertyRef("cve_id")
|
|
20
|
+
description: PropertyRef = PropertyRef("Description")
|
|
21
|
+
last_modified_date: PropertyRef = PropertyRef("LastModifiedDate")
|
|
22
|
+
primary_url: PropertyRef = PropertyRef("PrimaryURL")
|
|
23
|
+
published_date: PropertyRef = PropertyRef("PublishedDate")
|
|
24
|
+
severity: PropertyRef = PropertyRef("Severity")
|
|
25
|
+
severity_source: PropertyRef = PropertyRef("SeveritySource")
|
|
26
|
+
title: PropertyRef = PropertyRef("Title")
|
|
27
|
+
cvss_nvd_v2_score: PropertyRef = PropertyRef("nvd_v2_score")
|
|
28
|
+
cvss_nvd_v2_vector: PropertyRef = PropertyRef("nvd_v2_vector")
|
|
29
|
+
cvss_nvd_v3_score: PropertyRef = PropertyRef("nvd_v3_score")
|
|
30
|
+
cvss_nvd_v3_vector: PropertyRef = PropertyRef("nvd_v3_vector")
|
|
31
|
+
cvss_redhat_v3_score: PropertyRef = PropertyRef("redhat_v3_score")
|
|
32
|
+
cvss_redhat_v3_vector: PropertyRef = PropertyRef("redhat_v3_vector")
|
|
33
|
+
cvss_ubuntu_v3_score: PropertyRef = PropertyRef("ubuntu_v3_score")
|
|
34
|
+
cvss_ubuntu_v3_vector: PropertyRef = PropertyRef("ubuntu_v3_vector")
|
|
35
|
+
class_name: PropertyRef = PropertyRef("Class")
|
|
36
|
+
type: PropertyRef = PropertyRef("Type")
|
|
37
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
@dataclass(frozen=True)
|
|
41
|
+
class TrivyFindingToImageRelProperties(CartographyRelProperties):
|
|
42
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass(frozen=True)
|
|
46
|
+
class TrivyFindingToImage(CartographyRelSchema):
|
|
47
|
+
target_node_label: str = "ECRImage"
|
|
48
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
49
|
+
{"id": PropertyRef("ImageDigest")},
|
|
50
|
+
)
|
|
51
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
52
|
+
rel_label: str = "AFFECTS"
|
|
53
|
+
properties: TrivyFindingToImageRelProperties = TrivyFindingToImageRelProperties()
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@dataclass(frozen=True)
|
|
57
|
+
class TrivyImageFindingSchema(CartographyNodeSchema):
|
|
58
|
+
label: str = "TrivyImageFinding"
|
|
59
|
+
scoped_cleanup: bool = False
|
|
60
|
+
extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["Risk", "CVE"])
|
|
61
|
+
properties: TrivyImageFindingNodeProperties = TrivyImageFindingNodeProperties()
|
|
62
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
63
|
+
[
|
|
64
|
+
TrivyFindingToImage(),
|
|
65
|
+
],
|
|
66
|
+
)
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.nodes import ExtraNodeLabels
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
8
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
9
|
+
from cartography.models.core.relationships import LinkDirection
|
|
10
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
11
|
+
from cartography.models.core.relationships import OtherRelationships
|
|
12
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(frozen=True)
|
|
16
|
+
class TrivyFixNodeProperties(CartographyNodeProperties):
|
|
17
|
+
id: PropertyRef = PropertyRef("id")
|
|
18
|
+
version: PropertyRef = PropertyRef("FixedVersion")
|
|
19
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(frozen=True)
|
|
23
|
+
class TrivyFixToPackageRelProperties(CartographyRelProperties):
|
|
24
|
+
version: PropertyRef = PropertyRef("FixedVersion")
|
|
25
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@dataclass(frozen=True)
|
|
29
|
+
class TrivyFixToPackage(CartographyRelSchema):
|
|
30
|
+
target_node_label: str = "Package"
|
|
31
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
32
|
+
{"id": PropertyRef("PackageId")},
|
|
33
|
+
)
|
|
34
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
35
|
+
rel_label: str = "SHOULD_UPDATE_TO"
|
|
36
|
+
properties: TrivyFixToPackageRelProperties = TrivyFixToPackageRelProperties()
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
@dataclass(frozen=True)
|
|
40
|
+
class TrivyFixToFindingRelProperties(CartographyRelProperties):
|
|
41
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass(frozen=True)
|
|
45
|
+
class TrivyFixToFinding(CartographyRelSchema):
|
|
46
|
+
target_node_label: str = "TrivyImageFinding"
|
|
47
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
48
|
+
{"id": PropertyRef("FindingId")},
|
|
49
|
+
)
|
|
50
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
51
|
+
rel_label: str = "APPLIES_TO"
|
|
52
|
+
properties: TrivyFixToFindingRelProperties = TrivyFixToFindingRelProperties()
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@dataclass(frozen=True)
|
|
56
|
+
class TrivyFixSchema(CartographyNodeSchema):
|
|
57
|
+
label: str = "TrivyFix"
|
|
58
|
+
scoped_cleanup: bool = False
|
|
59
|
+
extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["Fix"])
|
|
60
|
+
properties: TrivyFixNodeProperties = TrivyFixNodeProperties()
|
|
61
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
62
|
+
[
|
|
63
|
+
TrivyFixToPackage(),
|
|
64
|
+
TrivyFixToFinding(),
|
|
65
|
+
],
|
|
66
|
+
)
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
|
|
3
|
+
from cartography.models.core.common import PropertyRef
|
|
4
|
+
from cartography.models.core.nodes import CartographyNodeProperties
|
|
5
|
+
from cartography.models.core.nodes import CartographyNodeSchema
|
|
6
|
+
from cartography.models.core.nodes import ExtraNodeLabels
|
|
7
|
+
from cartography.models.core.relationships import CartographyRelProperties
|
|
8
|
+
from cartography.models.core.relationships import CartographyRelSchema
|
|
9
|
+
from cartography.models.core.relationships import LinkDirection
|
|
10
|
+
from cartography.models.core.relationships import make_target_node_matcher
|
|
11
|
+
from cartography.models.core.relationships import OtherRelationships
|
|
12
|
+
from cartography.models.core.relationships import TargetNodeMatcher
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
@dataclass(frozen=True)
|
|
16
|
+
class TrivyPackageNodeProperties(CartographyNodeProperties):
|
|
17
|
+
id: PropertyRef = PropertyRef("id")
|
|
18
|
+
installed_version: PropertyRef = PropertyRef("InstalledVersion")
|
|
19
|
+
name: PropertyRef = PropertyRef("PkgName")
|
|
20
|
+
version: PropertyRef = PropertyRef("InstalledVersion")
|
|
21
|
+
class_name: PropertyRef = PropertyRef("Class")
|
|
22
|
+
type: PropertyRef = PropertyRef("Type")
|
|
23
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@dataclass(frozen=True)
|
|
27
|
+
class TrivyPackageToImageRelProperties(CartographyRelProperties):
|
|
28
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass(frozen=True)
|
|
32
|
+
class TrivyPackageToImage(CartographyRelSchema):
|
|
33
|
+
target_node_label: str = "ECRImage"
|
|
34
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
35
|
+
{"id": PropertyRef("ImageDigest")},
|
|
36
|
+
)
|
|
37
|
+
direction: LinkDirection = LinkDirection.OUTWARD
|
|
38
|
+
rel_label: str = "DEPLOYED"
|
|
39
|
+
properties: TrivyPackageToImageRelProperties = TrivyPackageToImageRelProperties()
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
@dataclass(frozen=True)
|
|
43
|
+
class TrivyPackageToFindingRelProperties(CartographyRelProperties):
|
|
44
|
+
lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@dataclass(frozen=True)
|
|
48
|
+
class TrivyPackageToFinding(CartographyRelSchema):
|
|
49
|
+
target_node_label: str = "TrivyImageFinding"
|
|
50
|
+
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
|
|
51
|
+
{"id": PropertyRef("FindingId")},
|
|
52
|
+
)
|
|
53
|
+
direction: LinkDirection = LinkDirection.INWARD
|
|
54
|
+
rel_label: str = "AFFECTS"
|
|
55
|
+
properties: TrivyPackageToFindingRelProperties = (
|
|
56
|
+
TrivyPackageToFindingRelProperties()
|
|
57
|
+
)
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
@dataclass(frozen=True)
|
|
61
|
+
class TrivyPackageSchema(CartographyNodeSchema):
|
|
62
|
+
label: str = "Package"
|
|
63
|
+
scoped_cleanup: bool = False
|
|
64
|
+
extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["TrivyPackage"])
|
|
65
|
+
properties: TrivyPackageNodeProperties = TrivyPackageNodeProperties()
|
|
66
|
+
other_relationships: OtherRelationships = OtherRelationships(
|
|
67
|
+
[
|
|
68
|
+
TrivyPackageToImage(),
|
|
69
|
+
TrivyPackageToFinding(),
|
|
70
|
+
],
|
|
71
|
+
)
|
cartography/sync.py
CHANGED
|
@@ -37,6 +37,7 @@ import cartography.intel.openai
|
|
|
37
37
|
import cartography.intel.semgrep
|
|
38
38
|
import cartography.intel.snipeit
|
|
39
39
|
import cartography.intel.tailscale
|
|
40
|
+
import cartography.intel.trivy
|
|
40
41
|
from cartography.config import Config
|
|
41
42
|
from cartography.stats import set_stats_client
|
|
42
43
|
from cartography.util import STATUS_FAILURE
|
|
@@ -70,6 +71,7 @@ TOP_LEVEL_MODULES = OrderedDict(
|
|
|
70
71
|
"semgrep": cartography.intel.semgrep.start_semgrep_ingestion,
|
|
71
72
|
"snipeit": cartography.intel.snipeit.start_snipeit_ingestion,
|
|
72
73
|
"tailscale": cartography.intel.tailscale.start_tailscale_ingestion,
|
|
74
|
+
"trivy": cartography.intel.trivy.start_trivy_ingestion,
|
|
73
75
|
"analysis": cartography.intel.analysis.run,
|
|
74
76
|
}
|
|
75
77
|
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cartography
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.105.0
|
|
4
4
|
Summary: Explore assets and their relationships across your technical infrastructure.
|
|
5
5
|
Maintainer: Cartography Contributors
|
|
6
6
|
License: apache2
|
|
@@ -80,7 +80,7 @@ You can learn more about the story behind Cartography in our [presentation at BS
|
|
|
80
80
|
|
|
81
81
|
|
|
82
82
|
## Supported platforms
|
|
83
|
-
- [Amazon Web Services](https://cartography-cncf.github.io/cartography/modules/aws/index.html) - API Gateway, CloudWatch, Config, EC2, ECS, ECR, Elasticsearch, Elastic Kubernetes Service (EKS), DynamoDB, IAM, Inspector, KMS, Lambda, RDS, Redshift, Route53, S3, Secrets Manager(Secret Versions), Security Hub, SQS, SSM, STS, Tags
|
|
83
|
+
- [Amazon Web Services](https://cartography-cncf.github.io/cartography/modules/aws/index.html) - ACM, API Gateway, CloudWatch, Config, EC2, ECS, ECR, Elasticsearch, Elastic Kubernetes Service (EKS), DynamoDB, IAM, Inspector, KMS, Lambda, RDS, Redshift, Route53, S3, Secrets Manager(Secret Versions), Security Hub, SQS, SSM, STS, Tags
|
|
84
84
|
- [Google Cloud Platform](https://cartography-cncf.github.io/cartography/modules/gcp/index.html) - Cloud Resource Manager, Compute, DNS, Storage, Google Kubernetes Engine
|
|
85
85
|
- [Google GSuite](https://cartography-cncf.github.io/cartography/modules/gsuite/index.html) - users, groups
|
|
86
86
|
- [Oracle Cloud Infrastructure](https://cartography-cncf.github.io/cartography/modules/oci/index.html) - IAM
|
|
@@ -102,6 +102,7 @@ You can learn more about the story behind Cartography in our [presentation at BS
|
|
|
102
102
|
- [Cloudflare](https://cartography-cncf.github.io/cartography/modules/cloudflare/index.html) - Account, Role, Member, Zone, DNSRecord
|
|
103
103
|
- [OpenAI](https://cartography-cncf.github.io/cartography/modules/openai/index.html) - Organization, AdminApiKey, User, Project, ServiceAccount, ApiKey
|
|
104
104
|
- [Anthropic](https://cartography-cncf.github.io/cartography/modules/anthropic/index.html) - Organization, ApiKey, User, Workspace
|
|
105
|
+
- [Trivy Scanner](https://cartography-cncf.github.io/cartography/modules/trivy/index.html) - AWS ECR Images
|
|
105
106
|
|
|
106
107
|
|
|
107
108
|
## Philosophy
|