Skip to content

Commit

Permalink
Change from linking to Okta user to linking to any UserAccount object
Browse files Browse the repository at this point in the history
  • Loading branch information
= committed Nov 10, 2024
1 parent d5ee38f commit 7c7a0fa
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
3 changes: 1 addition & 2 deletions cartography/data/indexes.cypher
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,7 @@ CREATE INDEX IF NOT EXISTS FOR (n:SpotlightVulnerability) ON (n.host_info_local_
CREATE INDEX IF NOT EXISTS FOR (n:SpotlightVulnerability) ON (n.lastupdated);
CREATE INDEX IF NOT EXISTS FOR (n:SQSQueue) ON (n.id);
CREATE INDEX IF NOT EXISTS FOR (n:SQSQueue) ON (n.lastupdated);
CREATE INDEX IF NOT EXISTS FOR (n:User) ON (n.arn);
CREATE INDEX IF NOT EXISTS FOR (n:User) ON (n.lastupdated);
CREATE INDEX IF NOT EXISTS FOR (n:UserAccount) ON (n.id);
CREATE INDEX IF NOT EXISTS FOR (n:AzureTenant) ON (n.id);
CREATE INDEX IF NOT EXISTS FOR (n:AzureTenant) ON (n.lastupdated);
CREATE INDEX IF NOT EXISTS FOR (n:AzurePrincipal) ON (n.email);
Expand Down
3 changes: 2 additions & 1 deletion cartography/intel/okta/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ def _load_okta_users(
new_user.okta_last_updated = user_data.okta_last_updated,
new_user.password_changed = user_data.password_changed,
new_user.transition_to_status = user_data.transition_to_status,
new_user.lastupdated = $okta_update_tag
new_user.lastupdated = $okta_update_tag,
new_user :UserAccount
WITH new_user, org
MERGE (org)-[org_r:RESOURCE]->(new_user)
ON CREATE SET org_r.firstseen = timestamp()
Expand Down
7 changes: 3 additions & 4 deletions cartography/models/aws/identitycenter/ssouser.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from dataclasses import dataclass

from cartography.models.core.common import PropertyRef
from cartography.models.core.nodes import CartographyNodeProperties
from cartography.models.core.nodes import CartographyNodeSchema
from cartography.models.core.nodes import CartographyNodeProperties, CartographyNodeSchema, ExtraNodeLabels
from cartography.models.core.relationships import CartographyRelProperties
from cartography.models.core.relationships import CartographyRelSchema
from cartography.models.core.relationships import LinkDirection
Expand All @@ -28,7 +27,7 @@ class SSOUserToOktaUserRelProperties(CartographyRelProperties):

@dataclass(frozen=True)
class SSOUserToOktaUser(CartographyRelSchema):
target_node_label: str = 'OktaUser'
target_node_label: str = 'UserAccount'
target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
{'id': PropertyRef('ExternalId')},
)
Expand All @@ -41,7 +40,7 @@ class SSOUserToOktaUser(CartographyRelSchema):
class SSOUserSchema(CartographyNodeSchema):
label: str = 'AWSSSOUser'
properties: SSOUserProperties = SSOUserProperties()
# role_relationship: SSOUserToRole = SSOUserToRole()
extra_node_labels: ExtraNodeLabels = ExtraNodeLabels(["UserAccount"])
other_relationships: OtherRelationships = OtherRelationships(
[
SSOUserToOktaUser(),
Expand Down
4 changes: 2 additions & 2 deletions docs/root/modules/aws/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -3350,10 +3350,10 @@ Representation of an AWS SSO User.
```
(AWSSSOUser)<-[ALLOWED_BY]-(AWSRole)
```
- OktaUser can be assumed by AWSSSOUser.
- UserAccount can be assumed by AWSSSOUser.

```
(OktaUser)<-[CAN_ASSUME_IDENTITY]-(AWSSSOUser)
(UserAccount)-[CAN_ASSUME_IDENTITY]->(AWSSSOUser)
```

### AWSPermissionSet
Expand Down

0 comments on commit 7c7a0fa

Please sign in to comment.