cartography 0.117.0__py3-none-any.whl → 0.119.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.

Files changed (107) hide show
  1. cartography/_version.py +2 -2
  2. cartography/cli.py +31 -0
  3. cartography/client/core/tx.py +19 -3
  4. cartography/config.py +14 -0
  5. cartography/data/indexes.cypher +0 -6
  6. cartography/graph/job.py +13 -7
  7. cartography/graph/statement.py +4 -0
  8. cartography/intel/aws/__init__.py +22 -9
  9. cartography/intel/aws/apigateway.py +18 -5
  10. cartography/intel/aws/ec2/elastic_ip_addresses.py +3 -1
  11. cartography/intel/aws/ec2/internet_gateways.py +4 -2
  12. cartography/intel/aws/ec2/load_balancer_v2s.py +11 -5
  13. cartography/intel/aws/ec2/network_interfaces.py +4 -0
  14. cartography/intel/aws/ec2/reserved_instances.py +3 -1
  15. cartography/intel/aws/ec2/tgw.py +11 -5
  16. cartography/intel/aws/ec2/volumes.py +1 -1
  17. cartography/intel/aws/ecr.py +209 -26
  18. cartography/intel/aws/ecr_image_layers.py +143 -42
  19. cartography/intel/aws/elasticsearch.py +13 -4
  20. cartography/intel/aws/identitycenter.py +93 -54
  21. cartography/intel/aws/inspector.py +90 -46
  22. cartography/intel/aws/permission_relationships.py +3 -3
  23. cartography/intel/aws/resourcegroupstaggingapi.py +1 -1
  24. cartography/intel/aws/s3.py +26 -13
  25. cartography/intel/aws/ssm.py +3 -5
  26. cartography/intel/azure/compute.py +9 -4
  27. cartography/intel/azure/cosmosdb.py +31 -15
  28. cartography/intel/azure/sql.py +25 -12
  29. cartography/intel/azure/storage.py +19 -9
  30. cartography/intel/azure/subscription.py +3 -1
  31. cartography/intel/crowdstrike/spotlight.py +5 -2
  32. cartography/intel/entra/app_role_assignments.py +9 -2
  33. cartography/intel/gcp/__init__.py +26 -9
  34. cartography/intel/gcp/clients.py +8 -4
  35. cartography/intel/gcp/compute.py +42 -21
  36. cartography/intel/gcp/crm/folders.py +9 -3
  37. cartography/intel/gcp/crm/orgs.py +8 -3
  38. cartography/intel/gcp/crm/projects.py +14 -3
  39. cartography/intel/github/repos.py +23 -5
  40. cartography/intel/gsuite/__init__.py +12 -8
  41. cartography/intel/gsuite/groups.py +291 -0
  42. cartography/intel/gsuite/users.py +142 -0
  43. cartography/intel/jamf/computers.py +7 -1
  44. cartography/intel/oci/iam.py +23 -9
  45. cartography/intel/oci/organizations.py +3 -1
  46. cartography/intel/oci/utils.py +28 -5
  47. cartography/intel/okta/awssaml.py +9 -8
  48. cartography/intel/okta/users.py +1 -1
  49. cartography/intel/ontology/__init__.py +44 -0
  50. cartography/intel/ontology/devices.py +54 -0
  51. cartography/intel/ontology/users.py +54 -0
  52. cartography/intel/ontology/utils.py +121 -0
  53. cartography/intel/pagerduty/escalation_policies.py +13 -6
  54. cartography/intel/pagerduty/schedules.py +9 -4
  55. cartography/intel/pagerduty/services.py +7 -3
  56. cartography/intel/pagerduty/teams.py +5 -2
  57. cartography/intel/pagerduty/users.py +3 -1
  58. cartography/intel/pagerduty/vendors.py +3 -1
  59. cartography/intel/trivy/__init__.py +109 -58
  60. cartography/models/airbyte/user.py +4 -0
  61. cartography/models/anthropic/user.py +4 -0
  62. cartography/models/aws/ec2/networkinterfaces.py +2 -0
  63. cartography/models/aws/ecr/image.py +55 -0
  64. cartography/models/aws/ecr/repository_image.py +1 -1
  65. cartography/models/aws/iam/group_membership.py +3 -2
  66. cartography/models/aws/identitycenter/awsssouser.py +3 -1
  67. cartography/models/bigfix/bigfix_computer.py +1 -1
  68. cartography/models/cloudflare/member.py +4 -0
  69. cartography/models/crowdstrike/hosts.py +1 -1
  70. cartography/models/duo/endpoint.py +1 -1
  71. cartography/models/duo/phone.py +2 -2
  72. cartography/models/duo/user.py +4 -0
  73. cartography/models/entra/user.py +2 -1
  74. cartography/models/github/users.py +4 -0
  75. cartography/models/gsuite/__init__.py +0 -0
  76. cartography/models/gsuite/group.py +218 -0
  77. cartography/models/gsuite/tenant.py +29 -0
  78. cartography/models/gsuite/user.py +107 -0
  79. cartography/models/kandji/device.py +1 -2
  80. cartography/models/keycloak/user.py +4 -0
  81. cartography/models/lastpass/user.py +4 -0
  82. cartography/models/ontology/__init__.py +0 -0
  83. cartography/models/ontology/device.py +125 -0
  84. cartography/models/ontology/mapping/__init__.py +16 -0
  85. cartography/models/ontology/mapping/data/__init__.py +1 -0
  86. cartography/models/ontology/mapping/data/devices.py +160 -0
  87. cartography/models/ontology/mapping/data/users.py +239 -0
  88. cartography/models/ontology/mapping/specs.py +65 -0
  89. cartography/models/ontology/user.py +52 -0
  90. cartography/models/openai/user.py +4 -0
  91. cartography/models/scaleway/iam/user.py +4 -0
  92. cartography/models/snipeit/asset.py +1 -0
  93. cartography/models/snipeit/user.py +4 -0
  94. cartography/models/tailscale/device.py +1 -1
  95. cartography/models/tailscale/user.py +6 -1
  96. cartography/rules/data/frameworks/mitre_attack/requirements/t1098_account_manipulation/__init__.py +176 -89
  97. cartography/sync.py +4 -1
  98. cartography/util.py +49 -18
  99. {cartography-0.117.0.dist-info → cartography-0.119.0.dist-info}/METADATA +3 -3
  100. {cartography-0.117.0.dist-info → cartography-0.119.0.dist-info}/RECORD +104 -89
  101. cartography/data/jobs/cleanup/gsuite_ingest_groups_cleanup.json +0 -23
  102. cartography/data/jobs/cleanup/gsuite_ingest_users_cleanup.json +0 -11
  103. cartography/intel/gsuite/api.py +0 -355
  104. {cartography-0.117.0.dist-info → cartography-0.119.0.dist-info}/WHEEL +0 -0
  105. {cartography-0.117.0.dist-info → cartography-0.119.0.dist-info}/entry_points.txt +0 -0
  106. {cartography-0.117.0.dist-info → cartography-0.119.0.dist-info}/licenses/LICENSE +0 -0
  107. {cartography-0.117.0.dist-info → cartography-0.119.0.dist-info}/top_level.txt +0 -0
@@ -11,8 +11,7 @@ from cartography.config import Config
11
11
  from cartography.intel.trivy.scanner import cleanup
12
12
  from cartography.intel.trivy.scanner import get_json_files_in_dir
13
13
  from cartography.intel.trivy.scanner import get_json_files_in_s3
14
- from cartography.intel.trivy.scanner import sync_single_image_from_file
15
- from cartography.intel.trivy.scanner import sync_single_image_from_s3
14
+ from cartography.intel.trivy.scanner import sync_single_image
16
15
  from cartography.stats import get_stats_client
17
16
  from cartography.util import timeit
18
17
 
@@ -20,53 +19,93 @@ logger = logging.getLogger(__name__)
20
19
  stat_handler = get_stats_client("trivy.scanner")
21
20
 
22
21
 
23
- @timeit
24
- def get_scan_targets(
22
+ def _get_scan_targets_and_aliases(
25
23
  neo4j_session: Session,
26
24
  account_ids: list[str] | None = None,
27
- ) -> set[str]:
25
+ ) -> tuple[set[str], dict[str, str]]:
28
26
  """
29
- Return list of ECR images from all accounts in the graph.
27
+ Return tag URIs and a mapping of digest-qualified URIs to tag URIs.
30
28
  """
31
29
  if not account_ids:
32
30
  aws_accounts = list_accounts(neo4j_session)
33
31
  else:
34
32
  aws_accounts = account_ids
35
33
 
36
- ecr_images: set[str] = set()
34
+ image_uris: set[str] = set()
35
+ digest_aliases: dict[str, str] = {}
36
+
37
37
  for account_id in aws_accounts:
38
- for _, _, image_uri, _, _ in get_ecr_images(neo4j_session, account_id):
39
- ecr_images.add(image_uri)
38
+ for _, _, image_uri, _, digest in get_ecr_images(neo4j_session, account_id):
39
+ if not image_uri:
40
+ continue
41
+ image_uris.add(image_uri)
42
+ if digest:
43
+ # repo URI is everything before the trailing ":" (if present)
44
+ repo_uri = image_uri.rsplit(":", 1)[0]
45
+ digest_uri = f"{repo_uri}@{digest}"
46
+ digest_aliases[digest_uri] = image_uri
40
47
 
41
- return ecr_images
48
+ return image_uris, digest_aliases
42
49
 
43
50
 
44
- def _get_intersection(
45
- image_uris: set[str], json_files: set[str], trivy_s3_prefix: str
46
- ) -> list[tuple[str, str]]:
51
+ @timeit
52
+ def get_scan_targets(
53
+ neo4j_session: Session,
54
+ account_ids: list[str] | None = None,
55
+ ) -> set[str]:
56
+ """
57
+ Return list of ECR images from all accounts in the graph.
47
58
  """
48
- Get the intersection of ECR images in the graph and S3 scan results.
59
+ image_uris, _ = _get_scan_targets_and_aliases(neo4j_session, account_ids)
60
+ return image_uris
49
61
 
50
- Args:
51
- image_uris: Set of ECR images in the graph
52
- json_files: Set of S3 object keys for JSON files
53
- trivy_s3_prefix: S3 prefix path containing scan results
54
62
 
55
- Returns:
56
- List of tuples (image_uri, s3_object_key)
63
+ def _prepare_trivy_data(
64
+ trivy_data: dict[str, Any],
65
+ image_uris: set[str],
66
+ digest_aliases: dict[str, str],
67
+ source: str,
68
+ ) -> tuple[dict[str, Any], str] | None:
57
69
  """
58
- intersection = []
59
- prefix_len = len(trivy_s3_prefix)
60
- for s3_object_key in json_files:
61
- # Sample key "123456789012.dkr.ecr.us-west-2.amazonaws.com/other-repo:v1.0.json"
62
- # Sample key "folder/derp/123456789012.dkr.ecr.us-west-2.amazonaws.com/other-repo:v1.0.json"
63
- # Remove the prefix and the .json suffix
64
- image_uri = s3_object_key[prefix_len:-5]
70
+ Determine the tag URI that corresponds to this Trivy payload.
71
+
72
+ Returns (trivy_data, display_uri) if the payload can be linked to an image present
73
+ in the graph; otherwise returns None so the caller can skip ingestion.
74
+ """
75
+
76
+ artifact_name = (trivy_data.get("ArtifactName") or "").strip()
77
+ metadata = trivy_data.get("Metadata") or {}
78
+ candidates: list[str] = []
79
+
80
+ if artifact_name:
81
+ candidates.append(artifact_name)
65
82
 
66
- if image_uri in image_uris:
67
- intersection.append((image_uri, s3_object_key))
83
+ repo_tags = metadata.get("RepoTags", [])
84
+ repo_digests = metadata.get("RepoDigests", [])
85
+ stripped_tags_digests = [item.strip() for item in repo_tags + repo_digests]
86
+ candidates.extend(stripped_tags_digests)
68
87
 
69
- return intersection
88
+ display_uri: str | None = None
89
+
90
+ for candidate in candidates:
91
+ if not candidate:
92
+ continue
93
+ if candidate in image_uris:
94
+ display_uri = candidate
95
+ break
96
+ alias = digest_aliases.get(candidate)
97
+ if alias:
98
+ display_uri = alias
99
+ break
100
+
101
+ if not display_uri:
102
+ logger.debug(
103
+ "Skipping Trivy results for %s because no matching image URI was found in the graph",
104
+ source,
105
+ )
106
+ return None
107
+
108
+ return trivy_data, display_uri
70
109
 
71
110
 
72
111
  @timeit
@@ -93,15 +132,12 @@ def sync_trivy_aws_ecr_from_s3(
93
132
  f"Using Trivy scan results from s3://{trivy_s3_bucket}/{trivy_s3_prefix}"
94
133
  )
95
134
 
96
- image_uris: set[str] = get_scan_targets(neo4j_session)
135
+ image_uris, digest_aliases = _get_scan_targets_and_aliases(neo4j_session)
97
136
  json_files: set[str] = get_json_files_in_s3(
98
137
  trivy_s3_bucket, trivy_s3_prefix, boto3_session
99
138
  )
100
- intersection: list[tuple[str, str]] = _get_intersection(
101
- image_uris, json_files, trivy_s3_prefix
102
- )
103
139
 
104
- if len(intersection) == 0:
140
+ if len(json_files) == 0:
105
141
  logger.error(
106
142
  f"Trivy sync was configured, but there are no ECR images with S3 json scan results in bucket "
107
143
  f"'{trivy_s3_bucket}' with prefix '{trivy_s3_prefix}'. "
@@ -110,18 +146,33 @@ def sync_trivy_aws_ecr_from_s3(
110
146
  f"`<image_uri>.json` and to be in the same bucket and prefix as the scan results. If the prefix is "
111
147
  "a folder, it MUST end with a trailing slash '/'. "
112
148
  )
113
- logger.error(f"JSON files in S3: {json_files}")
114
149
  raise ValueError("No ECR images with S3 json scan results found.")
115
150
 
116
- logger.info(f"Processing {len(intersection)} ECR images with S3 scan results")
117
- for image_uri, s3_object_key in intersection:
118
- sync_single_image_from_s3(
151
+ logger.info(f"Processing {len(json_files)} Trivy result files from S3")
152
+ s3_client = boto3_session.client("s3")
153
+ for s3_object_key in json_files:
154
+ logger.debug(
155
+ f"Reading scan results from S3: s3://{trivy_s3_bucket}/{s3_object_key}"
156
+ )
157
+ response = s3_client.get_object(Bucket=trivy_s3_bucket, Key=s3_object_key)
158
+ scan_data_json = response["Body"].read().decode("utf-8")
159
+ trivy_data = json.loads(scan_data_json)
160
+
161
+ prepared = _prepare_trivy_data(
162
+ trivy_data,
163
+ image_uris=image_uris,
164
+ digest_aliases=digest_aliases,
165
+ source=f"s3://{trivy_s3_bucket}/{s3_object_key}",
166
+ )
167
+ if prepared is None:
168
+ continue
169
+
170
+ prepared_data, display_uri = prepared
171
+ sync_single_image(
119
172
  neo4j_session,
120
- image_uri,
173
+ prepared_data,
174
+ display_uri,
121
175
  update_tag,
122
- trivy_s3_bucket,
123
- s3_object_key,
124
- boto3_session,
125
176
  )
126
177
 
127
178
  cleanup(neo4j_session, common_job_parameters)
@@ -137,7 +188,7 @@ def sync_trivy_aws_ecr_from_dir(
137
188
  """Sync Trivy scan results from local files for AWS ECR images."""
138
189
  logger.info(f"Using Trivy scan results from {results_dir}")
139
190
 
140
- image_uris: set[str] = get_scan_targets(neo4j_session)
191
+ image_uris, digest_aliases = _get_scan_targets_and_aliases(neo4j_session)
141
192
  json_files: set[str] = get_json_files_in_dir(results_dir)
142
193
 
143
194
  if not json_files:
@@ -149,27 +200,27 @@ def sync_trivy_aws_ecr_from_dir(
149
200
  logger.info(f"Processing {len(json_files)} local Trivy result files")
150
201
 
151
202
  for file_path in json_files:
152
- # First, check if the image exists in the graph before syncing
153
203
  try:
154
- # Peek at the artifact name without processing the file
155
204
  with open(file_path, encoding="utf-8") as f:
156
205
  trivy_data = json.load(f)
157
- artifact_name = trivy_data.get("ArtifactName")
158
-
159
- if artifact_name and artifact_name not in image_uris:
160
- logger.debug(
161
- f"Skipping results for {artifact_name} since the image is not present in the graph"
162
- )
163
- continue
206
+ except json.JSONDecodeError as e:
207
+ logger.error(f"Failed to read Trivy data from {file_path}: {e}")
208
+ continue
164
209
 
165
- except (json.JSONDecodeError, KeyError) as e:
166
- logger.error(f"Failed to read artifact name from {file_path}: {e}")
210
+ prepared = _prepare_trivy_data(
211
+ trivy_data,
212
+ image_uris=image_uris,
213
+ digest_aliases=digest_aliases,
214
+ source=file_path,
215
+ )
216
+ if prepared is None:
167
217
  continue
168
218
 
169
- # Now sync the file since we know the image exists in the graph
170
- sync_single_image_from_file(
219
+ prepared_data, display_uri = prepared
220
+ sync_single_image(
171
221
  neo4j_session,
172
- file_path,
222
+ prepared_data,
223
+ display_uri,
173
224
  update_tag,
174
225
  )
175
226
 
@@ -3,6 +3,7 @@ from dataclasses import dataclass
3
3
  from cartography.models.core.common import PropertyRef
4
4
  from cartography.models.core.nodes import CartographyNodeProperties
5
5
  from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.nodes import ExtraNodeLabels
6
7
  from cartography.models.core.relationships import CartographyRelProperties
7
8
  from cartography.models.core.relationships import CartographyRelSchema
8
9
  from cartography.models.core.relationships import LinkDirection
@@ -98,6 +99,9 @@ class AirbyteUserToWorkspaceMemberRel(CartographyRelSchema):
98
99
  @dataclass(frozen=True)
99
100
  class AirbyteUserSchema(CartographyNodeSchema):
100
101
  label: str = "AirbyteUser"
102
+ extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(
103
+ ["UserAccount"]
104
+ ) # UserAccount label is used for ontology mapping
101
105
  properties: AirbyteUserNodeProperties = AirbyteUserNodeProperties()
102
106
  sub_resource_relationship: AirbyteUserToOrganizationRel = (
103
107
  AirbyteUserToOrganizationRel()
@@ -3,6 +3,7 @@ from dataclasses import dataclass
3
3
  from cartography.models.core.common import PropertyRef
4
4
  from cartography.models.core.nodes import CartographyNodeProperties
5
5
  from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.nodes import ExtraNodeLabels
6
7
  from cartography.models.core.relationships import CartographyRelProperties
7
8
  from cartography.models.core.relationships import CartographyRelSchema
8
9
  from cartography.models.core.relationships import LinkDirection
@@ -42,6 +43,9 @@ class AnthropicUserToOrganizationRel(CartographyRelSchema):
42
43
  @dataclass(frozen=True)
43
44
  class AnthropicUserSchema(CartographyNodeSchema):
44
45
  label: str = "AnthropicUser"
46
+ extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(
47
+ ["UserAccount"]
48
+ ) # UserAccount label is used for ontology mapping
45
49
  properties: AnthropicUserNodeProperties = AnthropicUserNodeProperties()
46
50
  sub_resource_relationship: AnthropicUserToOrganizationRel = (
47
51
  AnthropicUserToOrganizationRel()
@@ -47,6 +47,8 @@ class EC2NetworkInterfaceNodeProperties(CartographyNodeProperties):
47
47
  # TODO: remove subnetid once we have migrated to subnet_id
48
48
  subnetid: PropertyRef = PropertyRef("SubnetId", extra_index=True)
49
49
  subnet_id: PropertyRef = PropertyRef("SubnetId", extra_index=True)
50
+ attach_time: PropertyRef = PropertyRef("AttachTime")
51
+ device_index: PropertyRef = PropertyRef("DeviceIndex")
50
52
 
51
53
 
52
54
  @dataclass(frozen=True)
@@ -18,6 +18,15 @@ class ECRImageNodeProperties(CartographyNodeProperties):
18
18
  region: PropertyRef = PropertyRef("Region", set_in_kwargs=True)
19
19
  lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
20
20
  layer_diff_ids: PropertyRef = PropertyRef("layer_diff_ids")
21
+ type: PropertyRef = PropertyRef("type")
22
+ architecture: PropertyRef = PropertyRef("architecture")
23
+ os: PropertyRef = PropertyRef("os")
24
+ variant: PropertyRef = PropertyRef("variant")
25
+ attestation_type: PropertyRef = PropertyRef("attestation_type")
26
+ attests_digest: PropertyRef = PropertyRef("attests_digest")
27
+ media_type: PropertyRef = PropertyRef("media_type")
28
+ artifact_media_type: PropertyRef = PropertyRef("artifact_media_type")
29
+ child_image_digests: PropertyRef = PropertyRef("child_image_digests")
21
30
 
22
31
 
23
32
  @dataclass(frozen=True)
@@ -78,6 +87,50 @@ class ECRImageToParentImageRel(CartographyRelSchema):
78
87
  )
79
88
 
80
89
 
90
+ @dataclass(frozen=True)
91
+ class ECRImageContainsImageRelProperties(CartographyRelProperties):
92
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
93
+
94
+
95
+ @dataclass(frozen=True)
96
+ class ECRImageContainsImageRel(CartographyRelSchema):
97
+ """
98
+ Relationship from a manifest list ECRImage to platform-specific ECRImages it contains.
99
+ Only applies to ECRImage nodes with type="manifest_list".
100
+ """
101
+
102
+ target_node_label: str = "ECRImage"
103
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
104
+ {"digest": PropertyRef("child_image_digests", one_to_many=True)},
105
+ )
106
+ direction: LinkDirection = LinkDirection.OUTWARD
107
+ rel_label: str = "CONTAINS_IMAGE"
108
+ properties: ECRImageContainsImageRelProperties = (
109
+ ECRImageContainsImageRelProperties()
110
+ )
111
+
112
+
113
+ @dataclass(frozen=True)
114
+ class ECRImageAttestsRelProperties(CartographyRelProperties):
115
+ lastupdated: PropertyRef = PropertyRef("lastupdated", set_in_kwargs=True)
116
+
117
+
118
+ @dataclass(frozen=True)
119
+ class ECRImageAttestsRel(CartographyRelSchema):
120
+ """
121
+ Relationship from an attestation ECRImage to the ECRImage it attests/validates.
122
+ Only applies to ECRImage nodes with type="attestation".
123
+ """
124
+
125
+ target_node_label: str = "ECRImage"
126
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
127
+ {"digest": PropertyRef("attests_digest")},
128
+ )
129
+ direction: LinkDirection = LinkDirection.OUTWARD
130
+ rel_label: str = "ATTESTS"
131
+ properties: ECRImageAttestsRelProperties = ECRImageAttestsRelProperties()
132
+
133
+
81
134
  @dataclass(frozen=True)
82
135
  class ECRImageSchema(CartographyNodeSchema):
83
136
  label: str = "ECRImage"
@@ -87,5 +140,7 @@ class ECRImageSchema(CartographyNodeSchema):
87
140
  [
88
141
  ECRImageHasLayerRel(),
89
142
  ECRImageToParentImageRel(),
143
+ ECRImageContainsImageRel(),
144
+ ECRImageAttestsRel(),
90
145
  ],
91
146
  )
@@ -71,7 +71,7 @@ class ECRRepositoryImageToECRImageRelProperties(CartographyRelProperties):
71
71
  class ECRRepositoryImageToECRImageRel(CartographyRelSchema):
72
72
  target_node_label: str = "ECRImage"
73
73
  target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
74
- {"id": PropertyRef("imageDigest")}
74
+ {"id": PropertyRef("imageDigests", one_to_many=True)}
75
75
  )
76
76
  direction: LinkDirection = LinkDirection.OUTWARD
77
77
  rel_label: str = "IMAGE"
@@ -15,12 +15,13 @@ class AWSGroupToAWSUserRelProperties(CartographyRelProperties):
15
15
 
16
16
  @dataclass(frozen=True)
17
17
  class AWSGroupToAWSUserRel(CartographyRelSchema):
18
+ # AWSUser -MEMBER_AWS_GROUP-> AWSGroup
18
19
  target_node_label: str = "AWSUser"
19
20
  target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
20
21
  {
21
- "arn": PropertyRef("user_arn"),
22
+ "arn": PropertyRef("user_arns", one_to_many=True),
22
23
  }
23
24
  )
24
- direction: LinkDirection = LinkDirection.OUTWARD
25
+ direction: LinkDirection = LinkDirection.INWARD
25
26
  rel_label: str = "MEMBER_AWS_GROUP"
26
27
  properties: AWSGroupToAWSUserRelProperties = AWSGroupToAWSUserRelProperties()
@@ -95,7 +95,9 @@ class AWSSSOUserToPermissionSetRel(CartographyRelSchema):
95
95
  class AWSSSOUserSchema(CartographyNodeSchema):
96
96
  label: str = "AWSSSOUser"
97
97
  properties: SSOUserProperties = SSOUserProperties()
98
- extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["UserAccount"])
98
+ extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(
99
+ ["UserAccount"]
100
+ ) # UserAccount label is used for ontology mapping
99
101
  sub_resource_relationship: AWSSSOUserToAWSAccountRel = AWSSSOUserToAWSAccountRel()
100
102
  other_relationships: OtherRelationships = OtherRelationships(
101
103
  [
@@ -22,7 +22,7 @@ class BigfixComputerNodeProperties(CartographyNodeProperties):
22
22
  besrootserver: PropertyRef = PropertyRef("BESRootServer")
23
23
  bios: PropertyRef = PropertyRef("BIOS")
24
24
  computertype: PropertyRef = PropertyRef("ComputerType")
25
- computername: PropertyRef = PropertyRef("ComputerName")
25
+ computername: PropertyRef = PropertyRef("ComputerName", extra_index=True)
26
26
  cpu: PropertyRef = PropertyRef("CPU")
27
27
  devicetype: PropertyRef = PropertyRef("DeviceType")
28
28
  distancetobesrelay: PropertyRef = PropertyRef("DistanceToBESRelay")
@@ -3,6 +3,7 @@ from dataclasses import dataclass
3
3
  from cartography.models.core.common import PropertyRef
4
4
  from cartography.models.core.nodes import CartographyNodeProperties
5
5
  from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.nodes import ExtraNodeLabels
6
7
  from cartography.models.core.relationships import CartographyRelProperties
7
8
  from cartography.models.core.relationships import CartographyRelSchema
8
9
  from cartography.models.core.relationships import LinkDirection
@@ -71,6 +72,9 @@ class CloudflareMemberToCloudflareRoleRel(CartographyRelSchema):
71
72
  @dataclass(frozen=True)
72
73
  class CloudflareMemberSchema(CartographyNodeSchema):
73
74
  label: str = "CloudflareMember"
75
+ extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(
76
+ ["UserAccount"]
77
+ ) # UserAccount label is used for ontology mapping
74
78
  properties: CloudflareMemberNodeProperties = CloudflareMemberNodeProperties()
75
79
  sub_resource_relationship: CloudflareMemberToAccountRel = (
76
80
  CloudflareMemberToAccountRel()
@@ -12,7 +12,7 @@ class CrowdstrikeHostNodeProperties(CartographyNodeProperties):
12
12
  instance_id: PropertyRef = PropertyRef("instance_id", extra_index=True)
13
13
  serial_number: PropertyRef = PropertyRef("serial_number", extra_index=True)
14
14
  status: PropertyRef = PropertyRef("status")
15
- hostname: PropertyRef = PropertyRef("hostname")
15
+ hostname: PropertyRef = PropertyRef("hostname", extra_index=True)
16
16
  machine_domain: PropertyRef = PropertyRef("machine_domain")
17
17
  crowdstrike_first_seen: PropertyRef = PropertyRef("first_seen")
18
18
  crowdstrike_last_seen: PropertyRef = PropertyRef("last_seen")
@@ -21,7 +21,7 @@ class DuoEndpointNodeProperties(CartographyNodeProperties):
21
21
  device_id: PropertyRef = PropertyRef("device_id")
22
22
  device_identifier: PropertyRef = PropertyRef("device_identifier")
23
23
  device_identifier_type: PropertyRef = PropertyRef("device_identifier_type")
24
- device_name: PropertyRef = PropertyRef("device_name")
24
+ device_name: PropertyRef = PropertyRef("device_name", extra_index=True)
25
25
  device_udid: PropertyRef = PropertyRef("device_udid")
26
26
  device_username: PropertyRef = PropertyRef("device_username")
27
27
  device_username_type: PropertyRef = PropertyRef("device_username_type")
@@ -22,8 +22,8 @@ class DuoPhoneNodeProperties(CartographyNodeProperties):
22
22
  fingerprint: PropertyRef = PropertyRef("fingerprint")
23
23
  last_seen: PropertyRef = PropertyRef("last_seen")
24
24
  model: PropertyRef = PropertyRef("model")
25
- name: PropertyRef = PropertyRef("name")
26
- phone_id: PropertyRef = PropertyRef("phone_id", extra_index=True)
25
+ name: PropertyRef = PropertyRef("name", extra_index=True)
26
+ phone_id: PropertyRef = PropertyRef("phone_id")
27
27
  platform: PropertyRef = PropertyRef("platform")
28
28
  postdelay: PropertyRef = PropertyRef("postdelay")
29
29
  predelay: PropertyRef = PropertyRef("predelay")
@@ -3,6 +3,7 @@ from dataclasses import dataclass
3
3
  from cartography.models.core.common import PropertyRef
4
4
  from cartography.models.core.nodes import CartographyNodeProperties
5
5
  from cartography.models.core.nodes import CartographyNodeSchema
6
+ from cartography.models.core.nodes import ExtraNodeLabels
6
7
  from cartography.models.core.relationships import CartographyRelProperties
7
8
  from cartography.models.core.relationships import CartographyRelSchema
8
9
  from cartography.models.core.relationships import LinkDirection
@@ -149,6 +150,9 @@ class DuoUserToHumanRel(CartographyRelSchema):
149
150
  @dataclass(frozen=True)
150
151
  class DuoUserSchema(CartographyNodeSchema):
151
152
  label: str = "DuoUser"
153
+ extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(
154
+ ["UserAccount"]
155
+ ) # UserAccount label is used for ontology mapping
152
156
  properties: DuoUserNodeProperties = DuoUserNodeProperties()
153
157
  sub_resource_relationship: DuoUserToDuoApiHostRel = DuoUserToDuoApiHostRel()
154
158
  other_relationships: OtherRelationships = OtherRelationships(
@@ -85,5 +85,6 @@ class EntraUserSchema(CartographyNodeSchema):
85
85
  extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(
86
86
  [
87
87
  "EntraIdentity",
88
- ]
88
+ "UserAccount",
89
+ ] # UserAccount label is used for ontology mapping
89
90
  )
@@ -33,6 +33,7 @@ from dataclasses import dataclass
33
33
  from cartography.models.core.common import PropertyRef
34
34
  from cartography.models.core.nodes import CartographyNodeProperties
35
35
  from cartography.models.core.nodes import CartographyNodeSchema
36
+ from cartography.models.core.nodes import ExtraNodeLabels
36
37
  from cartography.models.core.relationships import CartographyRelProperties
37
38
  from cartography.models.core.relationships import CartographyRelSchema
38
39
  from cartography.models.core.relationships import LinkDirection
@@ -128,6 +129,9 @@ class GitHubOrganizationUserSchema(CartographyNodeSchema):
128
129
  @dataclass(frozen=True)
129
130
  class GitHubUnaffiliatedUserSchema(CartographyNodeSchema):
130
131
  label: str = "GitHubUser"
132
+ extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(
133
+ ["UserAccount"]
134
+ ) # UserAccount label is used for ontology mapping
131
135
  properties: GitHubUnaffiliatedUserNodeProperties = (
132
136
  GitHubUnaffiliatedUserNodeProperties()
133
137
  )
File without changes