cartography 0.110.0rc2__py3-none-any.whl → 0.111.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 (54) hide show
  1. cartography/_version.py +16 -3
  2. cartography/cli.py +46 -0
  3. cartography/config.py +16 -0
  4. cartography/data/indexes.cypher +0 -2
  5. cartography/data/jobs/analysis/keycloak_inheritance.json +30 -0
  6. cartography/graph/querybuilder.py +70 -0
  7. cartography/intel/aws/apigateway.py +113 -4
  8. cartography/intel/aws/ec2/vpc.py +140 -124
  9. cartography/intel/aws/eventbridge.py +73 -0
  10. cartography/intel/github/repos.py +28 -12
  11. cartography/intel/github/util.py +12 -0
  12. cartography/intel/keycloak/__init__.py +153 -0
  13. cartography/intel/keycloak/authenticationexecutions.py +322 -0
  14. cartography/intel/keycloak/authenticationflows.py +77 -0
  15. cartography/intel/keycloak/clients.py +187 -0
  16. cartography/intel/keycloak/groups.py +126 -0
  17. cartography/intel/keycloak/identityproviders.py +94 -0
  18. cartography/intel/keycloak/organizations.py +163 -0
  19. cartography/intel/keycloak/realms.py +61 -0
  20. cartography/intel/keycloak/roles.py +202 -0
  21. cartography/intel/keycloak/scopes.py +73 -0
  22. cartography/intel/keycloak/users.py +70 -0
  23. cartography/intel/keycloak/util.py +47 -0
  24. cartography/models/aws/apigateway/apigatewaydeployment.py +74 -0
  25. cartography/models/aws/ec2/vpc.py +46 -0
  26. cartography/models/aws/ec2/vpc_cidr.py +102 -0
  27. cartography/models/aws/eventbridge/target.py +71 -0
  28. cartography/models/keycloak/__init__.py +0 -0
  29. cartography/models/keycloak/authenticationexecution.py +160 -0
  30. cartography/models/keycloak/authenticationflow.py +54 -0
  31. cartography/models/keycloak/client.py +177 -0
  32. cartography/models/keycloak/group.py +101 -0
  33. cartography/models/keycloak/identityprovider.py +89 -0
  34. cartography/models/keycloak/organization.py +116 -0
  35. cartography/models/keycloak/organizationdomain.py +73 -0
  36. cartography/models/keycloak/realm.py +173 -0
  37. cartography/models/keycloak/role.py +126 -0
  38. cartography/models/keycloak/scope.py +73 -0
  39. cartography/models/keycloak/user.py +51 -0
  40. cartography/models/tailscale/device.py +1 -0
  41. cartography/sync.py +2 -0
  42. cartography/util.py +8 -0
  43. {cartography-0.110.0rc2.dist-info → cartography-0.111.0.dist-info}/METADATA +2 -1
  44. {cartography-0.110.0rc2.dist-info → cartography-0.111.0.dist-info}/RECORD +53 -25
  45. cartography/data/jobs/cleanup/aws_import_vpc_cleanup.json +0 -23
  46. /cartography/models/aws/{__init__.py → apigateway/__init__.py} +0 -0
  47. /cartography/models/aws/{apigateway.py → apigateway/apigateway.py} +0 -0
  48. /cartography/models/aws/{apigatewaycertificate.py → apigateway/apigatewaycertificate.py} +0 -0
  49. /cartography/models/aws/{apigatewayresource.py → apigateway/apigatewayresource.py} +0 -0
  50. /cartography/models/aws/{apigatewaystage.py → apigateway/apigatewaystage.py} +0 -0
  51. {cartography-0.110.0rc2.dist-info → cartography-0.111.0.dist-info}/WHEEL +0 -0
  52. {cartography-0.110.0rc2.dist-info → cartography-0.111.0.dist-info}/entry_points.txt +0 -0
  53. {cartography-0.110.0rc2.dist-info → cartography-0.111.0.dist-info}/licenses/LICENSE +0 -0
  54. {cartography-0.110.0rc2.dist-info → cartography-0.111.0.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,173 @@
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
+
7
+
8
+ @dataclass(frozen=True)
9
+ class KeycloakRealmNodeProperties(CartographyNodeProperties):
10
+ id: PropertyRef = PropertyRef("id")
11
+ # We need to index realm name as Keycloak use this slug instead of ID in all queries
12
+ name: PropertyRef = PropertyRef("realm", extra_index=True)
13
+ display_name: PropertyRef = PropertyRef("displayName")
14
+ enabled: PropertyRef = PropertyRef("enabled")
15
+ not_before: PropertyRef = PropertyRef("notBefore")
16
+ default_signature_algorithm: PropertyRef = PropertyRef("defaultSignatureAlgorithm")
17
+ revoke_refresh_token: PropertyRef = PropertyRef("revokeRefreshToken")
18
+ refresh_token_max_reuse: PropertyRef = PropertyRef("refreshTokenMaxReuse")
19
+ access_token_lifespan: PropertyRef = PropertyRef("accessTokenLifespan")
20
+ access_token_lifespan_for_implicit_flow: PropertyRef = PropertyRef(
21
+ "accessTokenLifespanForImplicitFlow"
22
+ )
23
+ sso_session_idle_timeout: PropertyRef = PropertyRef("ssoSessionIdleTimeout")
24
+ sso_session_max_lifespan: PropertyRef = PropertyRef("ssoSessionMaxLifespan")
25
+ sso_session_idle_timeout_remember_me: PropertyRef = PropertyRef(
26
+ "ssoSessionIdleTimeoutRememberMe"
27
+ )
28
+ sso_session_max_lifespan_remember_me: PropertyRef = PropertyRef(
29
+ "ssoSessionMaxLifespanRememberMe"
30
+ )
31
+ offline_session_idle_timeout: PropertyRef = PropertyRef("offlineSessionIdleTimeout")
32
+ offline_session_max_lifespan_enabled: PropertyRef = PropertyRef(
33
+ "offlineSessionMaxLifespanEnabled"
34
+ )
35
+ offline_session_max_lifespan: PropertyRef = PropertyRef("offlineSessionMaxLifespan")
36
+ client_session_idle_timeout: PropertyRef = PropertyRef("clientSessionIdleTimeout")
37
+ client_session_max_lifespan: PropertyRef = PropertyRef("clientSessionMaxLifespan")
38
+ client_offline_session_idle_timeout: PropertyRef = PropertyRef(
39
+ "clientOfflineSessionIdleTimeout"
40
+ )
41
+ client_offline_session_max_lifespan: PropertyRef = PropertyRef(
42
+ "clientOfflineSessionMaxLifespan"
43
+ )
44
+ access_code_lifespan: PropertyRef = PropertyRef("accessCodeLifespan")
45
+ access_code_lifespan_user_action: PropertyRef = PropertyRef(
46
+ "accessCodeLifespanUserAction"
47
+ )
48
+ access_code_lifespan_login: PropertyRef = PropertyRef("accessCodeLifespanLogin")
49
+ action_token_generated_by_admin_lifespan: PropertyRef = PropertyRef(
50
+ "actionTokenGeneratedByAdminLifespan"
51
+ )
52
+ action_token_generated_by_user_lifespan: PropertyRef = PropertyRef(
53
+ "actionTokenGeneratedByUserLifespan"
54
+ )
55
+ oauth2_device_code_lifespan: PropertyRef = PropertyRef("oauth2DeviceCodeLifespan")
56
+ oauth2_device_polling_interval: PropertyRef = PropertyRef(
57
+ "oauth2DevicePollingInterval"
58
+ )
59
+ ssl_required: PropertyRef = PropertyRef("sslRequired")
60
+ password_credential_grant_allowed: PropertyRef = PropertyRef(
61
+ "passwordCredentialGrantAllowed"
62
+ )
63
+ registration_allowed: PropertyRef = PropertyRef("registrationAllowed")
64
+ registration_email_as_username: PropertyRef = PropertyRef(
65
+ "registrationEmailAsUsername"
66
+ )
67
+ remember_me: PropertyRef = PropertyRef("rememberMe")
68
+ verify_email: PropertyRef = PropertyRef("verifyEmail")
69
+ login_with_email_allowed: PropertyRef = PropertyRef("loginWithEmailAllowed")
70
+ duplicate_emails_allowed: PropertyRef = PropertyRef("duplicateEmailsAllowed")
71
+ reset_password_allowed: PropertyRef = PropertyRef("resetPasswordAllowed")
72
+ edit_username_allowed: PropertyRef = PropertyRef("editUsernameAllowed")
73
+ user_cache_enabled: PropertyRef = PropertyRef("userCacheEnabled")
74
+ realm_cache_enabled: PropertyRef = PropertyRef("realmCacheEnabled")
75
+ brute_force_protected: PropertyRef = PropertyRef("bruteForceProtected")
76
+ permanent_lockout: PropertyRef = PropertyRef("permanentLockout")
77
+ max_temporary_lockouts: PropertyRef = PropertyRef("maxTemporaryLockouts")
78
+ max_failure_wait_seconds: PropertyRef = PropertyRef("maxFailureWaitSeconds")
79
+ minimum_quick_login_wait_seconds: PropertyRef = PropertyRef(
80
+ "minimumQuickLoginWaitSeconds"
81
+ )
82
+ wait_increment_seconds: PropertyRef = PropertyRef("waitIncrementSeconds")
83
+ quick_login_check_milli_seconds: PropertyRef = PropertyRef(
84
+ "quickLoginCheckMilliSeconds"
85
+ )
86
+ max_delta_time_seconds: PropertyRef = PropertyRef("maxDeltaTimeSeconds")
87
+ failure_factor: PropertyRef = PropertyRef("failureFactor")
88
+ events_enabled: PropertyRef = PropertyRef("eventsEnabled")
89
+ events_expiration: PropertyRef = PropertyRef("eventsExpiration")
90
+ admin_events_enabled: PropertyRef = PropertyRef("adminEventsEnabled")
91
+ admin_events_details_enabled: PropertyRef = PropertyRef("adminEventsDetailsEnabled")
92
+ internationalization_enabled: PropertyRef = PropertyRef(
93
+ "internationalizationEnabled"
94
+ )
95
+ default_locale: PropertyRef = PropertyRef("defaultLocale")
96
+ password_policy: PropertyRef = PropertyRef("passwordPolicy")
97
+ otp_policy_type: PropertyRef = PropertyRef("otpPolicyType")
98
+ otp_policy_algorithm: PropertyRef = PropertyRef("otpPolicyAlgorithm")
99
+ otp_policy_initial_counter: PropertyRef = PropertyRef("otpPolicyInitialCounter")
100
+ otp_policy_digits: PropertyRef = PropertyRef("otpPolicyDigits")
101
+ otp_policy_look_ahead_window: PropertyRef = PropertyRef("otpPolicyLookAheadWindow")
102
+ otp_policy_period: PropertyRef = PropertyRef("otpPolicyPeriod")
103
+ otp_policy_code_reusable: PropertyRef = PropertyRef("otpPolicyCodeReusable")
104
+ web_authn_policy_rp_entity_name: PropertyRef = PropertyRef(
105
+ "webAuthnPolicyRpEntityName"
106
+ )
107
+ web_authn_policy_rp_id: PropertyRef = PropertyRef("webAuthnPolicyRpId")
108
+ web_authn_policy_attestation_conveyance_preference: PropertyRef = PropertyRef(
109
+ "webAuthnPolicyAttestationConveyancePreference"
110
+ )
111
+ web_authn_policy_authenticator_attachment: PropertyRef = PropertyRef(
112
+ "webAuthnPolicyAuthenticatorAttachment"
113
+ )
114
+ web_authn_policy_require_resident_key: PropertyRef = PropertyRef(
115
+ "webAuthnPolicyRequireResidentKey"
116
+ )
117
+ web_authn_policy_user_verification_requirement: PropertyRef = PropertyRef(
118
+ "webAuthnPolicyUserVerificationRequirement"
119
+ )
120
+ web_authn_policy_create_timeout: PropertyRef = PropertyRef(
121
+ "webAuthnPolicyCreateTimeout"
122
+ )
123
+ web_authn_policy_avoid_same_authenticator_register: PropertyRef = PropertyRef(
124
+ "webAuthnPolicyAvoidSameAuthenticatorRegister"
125
+ )
126
+ web_authn_policy_passwordless_rp_entity_name: PropertyRef = PropertyRef(
127
+ "webAuthnPolicyPasswordlessRpEntityName"
128
+ )
129
+ web_authn_policy_passwordless_rp_id: PropertyRef = PropertyRef(
130
+ "webAuthnPolicyPasswordlessRpId"
131
+ )
132
+ web_authn_policy_passwordless_attestation_conveyance_preference: PropertyRef = (
133
+ PropertyRef("webAuthnPolicyPasswordlessAttestationConveyancePreference")
134
+ )
135
+ web_authn_policy_passwordless_authenticator_attachment: PropertyRef = PropertyRef(
136
+ "webAuthnPolicyPasswordlessAuthenticatorAttachment"
137
+ )
138
+ web_authn_policy_passwordless_require_resident_key: PropertyRef = PropertyRef(
139
+ "webAuthnPolicyPasswordlessRequireResidentKey"
140
+ )
141
+ web_authn_policy_passwordless_user_verification_requirement: PropertyRef = (
142
+ PropertyRef("webAuthnPolicyPasswordlessUserVerificationRequirement")
143
+ )
144
+ web_authn_policy_passwordless_create_timeout: PropertyRef = PropertyRef(
145
+ "webAuthnPolicyPasswordlessCreateTimeout"
146
+ )
147
+ web_authn_policy_passwordless_avoid_same_authenticator_register: PropertyRef = (
148
+ PropertyRef("webAuthnPolicyPasswordlessAvoidSameAuthenticatorRegister")
149
+ )
150
+ keycloak_version: PropertyRef = PropertyRef("keycloakVersion")
151
+ user_managed_access_allowed: PropertyRef = PropertyRef("userManagedAccessAllowed")
152
+ organizations_enabled: PropertyRef = PropertyRef("organizationsEnabled")
153
+ verifiable_credentials_enabled: PropertyRef = PropertyRef(
154
+ "verifiableCredentialsEnabled"
155
+ )
156
+ admin_permissions_enabled: PropertyRef = PropertyRef("adminPermissionsEnabled")
157
+ social: PropertyRef = PropertyRef("social")
158
+ update_profile_on_initial_social_login: PropertyRef = PropertyRef(
159
+ "updateProfileOnInitialSocialLogin"
160
+ )
161
+ o_auth2_device_code_lifespan: PropertyRef = PropertyRef("oAuth2DeviceCodeLifespan")
162
+ o_auth2_device_polling_interval: PropertyRef = PropertyRef(
163
+ "oAuth2DevicePollingInterval"
164
+ )
165
+ bruteForceStrategy: PropertyRef = PropertyRef("bruteForceStrategy")
166
+ default_role_id: PropertyRef = PropertyRef("defaultRole.id")
167
+ lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
168
+
169
+
170
+ @dataclass(frozen=True)
171
+ class KeycloakRealmSchema(CartographyNodeSchema):
172
+ label: str = "KeycloakRealm"
173
+ properties: KeycloakRealmNodeProperties = KeycloakRealmNodeProperties()
@@ -0,0 +1,126 @@
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 KeycloakRoleNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("id")
17
+ name: PropertyRef = PropertyRef("name", extra_index=True)
18
+ description: PropertyRef = PropertyRef("description")
19
+ scope_param_required: PropertyRef = PropertyRef("scopeParamRequired")
20
+ composite: PropertyRef = PropertyRef("composite")
21
+ client_role: PropertyRef = PropertyRef("clientRole")
22
+ container_id: PropertyRef = PropertyRef("containerId")
23
+ # We need to store the realm name because role are often referenced by name
24
+ # and not by id, so we need to be able to find the role by name (that is not unique across realms)
25
+ realm: PropertyRef = PropertyRef("REALM", set_in_kwargs=True, extra_index=True)
26
+ lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
27
+
28
+
29
+ @dataclass(frozen=True)
30
+ class KeycloakRoleToRealmRelProperties(CartographyRelProperties):
31
+ lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
32
+
33
+
34
+ @dataclass(frozen=True)
35
+ # (:KeycloakRole)<-[:RESOURCE]-(:KeycloakRealm)
36
+ class KeycloakRoleToRealmRel(CartographyRelSchema):
37
+ target_node_label: str = "KeycloakRealm"
38
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
39
+ {"name": PropertyRef("REALM", set_in_kwargs=True)},
40
+ )
41
+ direction: LinkDirection = LinkDirection.INWARD
42
+ rel_label: str = "RESOURCE"
43
+ properties: KeycloakRoleToRealmRelProperties = KeycloakRoleToRealmRelProperties()
44
+
45
+
46
+ @dataclass(frozen=True)
47
+ class KeycloakRoleToClientRelProperties(CartographyRelProperties):
48
+ lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
49
+
50
+
51
+ @dataclass(frozen=True)
52
+ # (:KeycloakRole)<-[:DEFINES]->(:KeycloakClient)
53
+ class KeycloakRoleToClientRel(CartographyRelSchema):
54
+ target_node_label: str = "KeycloakClient"
55
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
56
+ {"id": PropertyRef("containerId")},
57
+ )
58
+ direction: LinkDirection = LinkDirection.INWARD
59
+ rel_label: str = "DEFINES"
60
+ properties: KeycloakRoleToClientRelProperties = KeycloakRoleToClientRelProperties()
61
+
62
+
63
+ @dataclass(frozen=True)
64
+ class KeycloakRoleToRoleRelProperties(CartographyRelProperties):
65
+ lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
66
+
67
+
68
+ @dataclass(frozen=True)
69
+ # (:KeycloakRole)-[:INCLUDES]->(:KeycloakRole)
70
+ class KeycloakRoleToRoleRel(CartographyRelSchema):
71
+ target_node_label: str = "KeycloakRole"
72
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
73
+ {"id": PropertyRef("_composite_roles", one_to_many=True)},
74
+ )
75
+ direction: LinkDirection = LinkDirection.OUTWARD
76
+ rel_label: str = "INCLUDES"
77
+ properties: KeycloakRoleToRoleRelProperties = KeycloakRoleToRoleRelProperties()
78
+
79
+
80
+ @dataclass(frozen=True)
81
+ class KeycloakRoleToScopeRelProperties(CartographyRelProperties):
82
+ lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
83
+
84
+
85
+ @dataclass(frozen=True)
86
+ # (:KeycloakRole)-[:GRANTS]->(:KeycloakScope)
87
+ class KeycloakRoleToScopeRel(CartographyRelSchema):
88
+ target_node_label: str = "KeycloakScope"
89
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
90
+ {"id": PropertyRef("_scope_ids", one_to_many=True)},
91
+ )
92
+ direction: LinkDirection = LinkDirection.OUTWARD
93
+ rel_label: str = "GRANTS"
94
+ properties: KeycloakRoleToScopeRelProperties = KeycloakRoleToScopeRelProperties()
95
+
96
+
97
+ @dataclass(frozen=True)
98
+ class KeycloakRoleToUserRelProperties(CartographyRelProperties):
99
+ lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
100
+
101
+
102
+ @dataclass(frozen=True)
103
+ # (:KeycloakRole)<-[:ASSUME_ROLE]-(:KeycloakUser)
104
+ class KeycloakRoleToUserRel(CartographyRelSchema):
105
+ target_node_label: str = "KeycloakUser"
106
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
107
+ {"id": PropertyRef("_direct_members", one_to_many=True)},
108
+ )
109
+ direction: LinkDirection = LinkDirection.INWARD
110
+ rel_label: str = "ASSUME_ROLE"
111
+ properties: KeycloakRoleToUserRelProperties = KeycloakRoleToUserRelProperties()
112
+
113
+
114
+ @dataclass(frozen=True)
115
+ class KeycloakRoleSchema(CartographyNodeSchema):
116
+ label: str = "KeycloakRole"
117
+ properties: KeycloakRoleNodeProperties = KeycloakRoleNodeProperties()
118
+ sub_resource_relationship: KeycloakRoleToRealmRel = KeycloakRoleToRealmRel()
119
+ other_relationships: OtherRelationships = OtherRelationships(
120
+ [
121
+ KeycloakRoleToClientRel(),
122
+ KeycloakRoleToRoleRel(),
123
+ KeycloakRoleToScopeRel(),
124
+ KeycloakRoleToUserRel(),
125
+ ],
126
+ )
@@ -0,0 +1,73 @@
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 KeycloakScopeNodeProperties(CartographyNodeProperties):
16
+ id: PropertyRef = PropertyRef("id")
17
+ name: PropertyRef = PropertyRef("name", extra_index=True)
18
+ description: PropertyRef = PropertyRef("description")
19
+ protocol: PropertyRef = PropertyRef("protocol")
20
+ include_in_token_scope: PropertyRef = PropertyRef(
21
+ "attributes.include.in.token.scope",
22
+ )
23
+ display_on_consent_screen: PropertyRef = PropertyRef(
24
+ "attributes.display.on.consent.screen",
25
+ )
26
+ # We need to store the realm name because scope are often referenced by name
27
+ # and not by id, so we need to be able to find the scope by name (that is not unique across realms)
28
+ realm: PropertyRef = PropertyRef("REALM", set_in_kwargs=True, extra_index=True)
29
+ lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
30
+
31
+
32
+ @dataclass(frozen=True)
33
+ class KeycloakScopeToRealmRelProperties(CartographyRelProperties):
34
+ lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
35
+
36
+
37
+ @dataclass(frozen=True)
38
+ # (:KeycloakScope)<-[:RESOURCE]-(:KeycloakRealm)
39
+ class KeycloakScopeToRealmRel(CartographyRelSchema):
40
+ target_node_label: str = "KeycloakRealm"
41
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
42
+ {"name": PropertyRef("REALM", set_in_kwargs=True)},
43
+ )
44
+ direction: LinkDirection = LinkDirection.INWARD
45
+ rel_label: str = "RESOURCE"
46
+ properties: KeycloakScopeToRealmRelProperties = KeycloakScopeToRealmRelProperties()
47
+
48
+
49
+ @dataclass(frozen=True)
50
+ class KeycloakScopeToRoleRelProperties(CartographyRelProperties):
51
+ lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
52
+
53
+
54
+ @dataclass(frozen=True)
55
+ # (:KeycloakScope)<-[:GRANTS]-(:KeycloakRole)
56
+ class KeycloakScopeToRoleRel(CartographyRelSchema):
57
+ target_node_label: str = "KeycloakRole"
58
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
59
+ {"id": PropertyRef("_role_ids", one_to_many=True)},
60
+ )
61
+ direction: LinkDirection = LinkDirection.INWARD
62
+ rel_label: str = "GRANTS"
63
+ properties: KeycloakScopeToRoleRelProperties = KeycloakScopeToRoleRelProperties()
64
+
65
+
66
+ @dataclass(frozen=True)
67
+ class KeycloakScopeSchema(CartographyNodeSchema):
68
+ label: str = "KeycloakScope"
69
+ properties: KeycloakScopeNodeProperties = KeycloakScopeNodeProperties()
70
+ sub_resource_relationship: KeycloakScopeToRealmRel = KeycloakScopeToRealmRel()
71
+ other_relationships: OtherRelationships = OtherRelationships(
72
+ [KeycloakScopeToRoleRel()],
73
+ )
@@ -0,0 +1,51 @@
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 KeycloakUserNodeProperties(CartographyNodeProperties):
15
+ id: PropertyRef = PropertyRef("id")
16
+ username: PropertyRef = PropertyRef("username")
17
+ first_name: PropertyRef = PropertyRef("firstName")
18
+ last_name: PropertyRef = PropertyRef("lastName")
19
+ email: PropertyRef = PropertyRef("email")
20
+ email_verified: PropertyRef = PropertyRef("emailVerified")
21
+ origin: PropertyRef = PropertyRef("origin")
22
+ created_timestamp: PropertyRef = PropertyRef("createdTimestamp")
23
+ enabled: PropertyRef = PropertyRef("enabled")
24
+ totp: PropertyRef = PropertyRef("totp")
25
+ service_account_client_id: PropertyRef = PropertyRef("serviceAccountClientId")
26
+ not_before: PropertyRef = PropertyRef("notBefore")
27
+ lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
28
+
29
+
30
+ @dataclass(frozen=True)
31
+ class KeycloakUserToRealmRelProperties(CartographyRelProperties):
32
+ lastupdated: PropertyRef = PropertyRef("LASTUPDATED", set_in_kwargs=True)
33
+
34
+
35
+ @dataclass(frozen=True)
36
+ # (:KeycloakUser)<-[:RESOURCE]-(:KeycloakRealm)
37
+ class KeycloakUserToRealmRel(CartographyRelSchema):
38
+ target_node_label: str = "KeycloakRealm"
39
+ target_node_matcher: TargetNodeMatcher = make_target_node_matcher(
40
+ {"name": PropertyRef("REALM", set_in_kwargs=True)},
41
+ )
42
+ direction: LinkDirection = LinkDirection.INWARD
43
+ rel_label: str = "RESOURCE"
44
+ properties: KeycloakUserToRealmRelProperties = KeycloakUserToRealmRelProperties()
45
+
46
+
47
+ @dataclass(frozen=True)
48
+ class KeycloakUserSchema(CartographyNodeSchema):
49
+ label: str = "KeycloakUser"
50
+ properties: KeycloakUserNodeProperties = KeycloakUserNodeProperties()
51
+ sub_resource_relationship: KeycloakUserToRealmRel = KeycloakUserToRealmRel()
@@ -28,6 +28,7 @@ class TailscaleDeviceNodeProperties(CartographyNodeProperties):
28
28
  authorized: PropertyRef = PropertyRef("authorized")
29
29
  is_external: PropertyRef = PropertyRef("isExternal")
30
30
  node_key: PropertyRef = PropertyRef("nodeKey")
31
+ addresses: PropertyRef = PropertyRef("addresses")
31
32
  blocks_incoming_connections: PropertyRef = PropertyRef("blocksIncomingConnections")
32
33
  client_connectivity_endpoints: PropertyRef = PropertyRef(
33
34
  "clientConnectivity.endpoints"
cartography/sync.py CHANGED
@@ -31,6 +31,7 @@ import cartography.intel.github
31
31
  import cartography.intel.gsuite
32
32
  import cartography.intel.jamf
33
33
  import cartography.intel.kandji
34
+ import cartography.intel.keycloak
34
35
  import cartography.intel.kubernetes
35
36
  import cartography.intel.lastpass
36
37
  import cartography.intel.oci
@@ -70,6 +71,7 @@ TOP_LEVEL_MODULES = OrderedDict(
70
71
  "github": cartography.intel.github.start_github_ingestion,
71
72
  "digitalocean": cartography.intel.digitalocean.start_digitalocean_ingestion,
72
73
  "kandji": cartography.intel.kandji.start_kandji_ingestion,
74
+ "keycloak": cartography.intel.keycloak.start_keycloak_ingestion,
73
75
  "kubernetes": cartography.intel.kubernetes.start_k8s_ingestion,
74
76
  "lastpass": cartography.intel.lastpass.start_lastpass_ingestion,
75
77
  "bigfix": cartography.intel.bigfix.start_bigfix_ingestion,
cartography/util.py CHANGED
@@ -25,6 +25,7 @@ import backoff
25
25
  import boto3
26
26
  import botocore
27
27
  import neo4j
28
+ from botocore.exceptions import EndpointConnectionError
28
29
 
29
30
  from cartography.graph.job import GraphJob
30
31
  from cartography.graph.statement import get_job_shortname
@@ -309,6 +310,13 @@ def aws_handle_regions(func: AWSGetFunc) -> AWSGetFunc:
309
310
  return []
310
311
  else:
311
312
  raise
313
+ except EndpointConnectionError:
314
+ logger.warning(
315
+ "Encountered an EndpointConnectionError. This means that the AWS "
316
+ "resource is not available in this region. Skipping.",
317
+ exc_info=True,
318
+ )
319
+ return []
312
320
 
313
321
  return cast(AWSGetFunc, inner_function)
314
322
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cartography
3
- Version: 0.110.0rc2
3
+ Version: 0.111.0
4
4
  Summary: Explore assets and their relationships across your technical infrastructure.
5
5
  Maintainer: Cartography Contributors
6
6
  License: apache2
@@ -93,6 +93,7 @@ You can learn more about the story behind Cartography in our [presentation at BS
93
93
  - [Google Cloud Platform](https://cartography-cncf.github.io/cartography/modules/gcp/index.html) - Cloud Resource Manager, Compute, DNS, Storage, Google Kubernetes Engine
94
94
  - [Google GSuite](https://cartography-cncf.github.io/cartography/modules/gsuite/index.html) - users, groups
95
95
  - [Kandji](https://cartography-cncf.github.io/cartography/modules/kandji/index.html) - Devices
96
+ - [Keycloak](https://cartography-cncf.github.io/cartography/modules/keycloak/index.html) - Realms, Users, Groups, Roles, Scopes, Clients, IdentityProviders, Authentication Flows, Authentication Executions, Organizations, Organization Domains
96
97
  - [Kubernetes](https://cartography-cncf.github.io/cartography/modules/kubernetes/index.html) - Cluster, Namespace, Service, Pod, Container, ServiceAccount, Role, RoleBinding, ClusterRole, ClusterRoleBinding
97
98
  - [Lastpass](https://cartography-cncf.github.io/cartography/modules/lastpass/index.html) - users
98
99
  - [Microsoft Azure](https://cartography-cncf.github.io/cartography/modules/azure/index.html) - CosmosDB, SQL, Storage, Virtual Machine