:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(warehouse-sources): add jumpcloud policy, alert and device tables (#113313)
Tom Owers8c16a327e027
diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.mdindex 5278541b7103..cbb08acfffee 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/COVERAGE_GAPS_APPENDIX.md@@ -4637,7 +4637,7 @@ Note: The OpenAPI 3.0 spec (served to ReDoc from https://judge.me/api/docs.yaml)## Jumpcloud — **thin**-Today (11): `application_user_groups`, `application_users`, `applications`, `events`, `system_group_members`, `system_groups`, `system_users`, `systems`, `user_group_members`, `user_groups`, `users`+Today (41): `alert_occurrences`, `alerts`, `application_user_groups`, `application_users`, `applications`, `events`, `identity_risk_events`, `policies`, `policy_results`, `policy_statuses`, `system_group_members`, `system_groups`, `system_insights_*` (24 tables), `system_users`, `systems`, `user_group_members`, `user_groups`, `users`Diffed against: <https://docs.jumpcloud.com/api/2.0/index.yaml>@@ -4645,13 +4645,13 @@ Diffed against: <https://docs.jumpcloud.com/api/2.0/index.yaml>- [x] `/api/v2/systemgroups/{group_id}/members (and /membership)` — the system-to-group edges completing the already-synced system_groups table (high)- [x] `/api/v2/systems/{system_id}/users (or /api/v2/users/{user_id}/systems)` — which users can log into which devices - the central access-review fact table (high)- [x] `/api/v2/applications/{application_id}/users and /usergroups` — SSO application entitlements per user and group, resolving the synced applications table (high)-- [ ] `/api/v2/systeminsights/* (apps, programs, os_version, patches, disk_encryption, browser_plugins, chrome_extensions, ...)` — ~60 device inventory and compliance fact tables keyed by system_id - the richest analytical surface in the API (high)-- [ ] `/api/v2/policies, /api/v2/policyresults, /api/v2/systems/{id}/policystatuses` — policy catalog plus per-device application results - device compliance state over time (high)+- [x] `/api/v2/systeminsights/* (apps, programs, os_version, patches, disk_encryption, browser_plugins, chrome_extensions, ...)` — ~60 device inventory and compliance fact tables keyed by system_id - the richest analytical surface in the API (high) - a curated 24 inventory and security-posture tables; credential-adjacent ones (shadow, authorized_keys, user_ssh_keys) are left out+- [x] `/api/v2/policies, /api/v2/policyresults, /api/v2/systems/{id}/policystatuses` — policy catalog plus per-device application results - device compliance state over time (high) - statuses fan out over `/policies/{id}/policystatuses`, which returns the same rows with far fewer requests- [ ] `/api/commands and /api/commandresults` — remote command execution history with exit codes and output (medium)- [ ] `/api/v2/softwareapps and /api/v2/softwareapps/{id}/statuses` — managed software catalog and per-device install/update state (medium)- [ ] `/api/v2/saas-management/applications, /applications/{id}/usage, /application-licenses, /applications/{id}/accounts` — SaaS app usage, license counts and per-account seats for spend and shadow-IT analysis (medium)-- [ ] `/api/v2/alerts and /api/v2/alerts/{id}/occurrences` — alert definitions plus firing history for device and identity health (medium)-- [ ] `/api/v2/identityrisk/events, /identityrisk/identities` — risk-scored identity events, a distinct signal from the Directory Insights event stream already synced (medium)+- [x] `/api/v2/alerts and /api/v2/alerts/{id}/occurrences` — alert definitions plus firing history for device and identity health (medium)+- [x] `/api/v2/identityrisk/events, /identityrisk/identities` — risk-scored identity events, a distinct signal from the Directory Insights event stream already synced (medium) - events only; `/identityrisk/identities` is a top-N aggregate over a time window with no pagination, not a table- [ ] `/api/v2/directories` — lookup of connected identity sources (AD, Google Workspace, Office 365) that users are bound to (low)Note: Two separate specs: v1 at https://docs.jumpcloud.com/api/1.0/index.yaml (21 GET paths) and v2 at https://docs.jumpcloud.com/api/2.0/index.yaml (444 GET paths). The connector's 6 tables are all top-level object lists; every association/membership sub-resource is absent, which is the specific thing that makes a directory dataset joinable. The systeminsights family alone is ~60 device-fact endpoints. Nothing is discovered dynamically at sync time.diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/canonical_descriptions.py b/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/canonical_descriptions.pyindex d541b31e6cd0..b6dcbefd4bbb 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/canonical_descriptions.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/canonical_descriptions.py@@ -135,6 +135,290 @@ CANONICAL_DESCRIPTIONS: CanonicalDescriptions = {"paths": "Each path through the JumpCloud graph that connects the member, as a list of edges.",},},+ "policies": {+ "description": "Device policies configured in JumpCloud, each built from a policy template.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/Policies/operation/policies_list",+ "columns": {+ "id": "Unique identifier of the policy.",+ "name": "Name of the policy.",+ "template": "The policy template the policy is built from, including its OS family and activation type.",+ },+ },+ "policy_results": {+ "description": "Every recorded application of a policy to a device, with its outcome. Use it to follow compliance over time.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/Policies/operation/policyresults_org_list",+ "columns": {+ "id": "Unique identifier of the policy result.",+ "policyID": "Identifier of the applied policy (joins to policies.id).",+ "systemID": "Identifier of the device the policy was applied to (joins to systems._id).",+ "startedAt": "Time the policy application started.",+ "endedAt": "Time the policy application ended.",+ "success": "Whether the policy applied successfully.",+ "state": "State of the policy application.",+ "exitStatus": "Exit status of the policy application on the device.",+ "detail": "Details about the result.",+ },+ },+ "policy_statuses": {+ "description": "The latest result of each policy on each device it applies to: the current compliance state.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/Policies/operation/policystatuses_policiesList",+ "columns": {+ "policy_id": "Identifier of the policy (joins to policies.id).",+ "id": "Unique identifier of the latest policy result.",+ "systemID": "Identifier of the device (joins to systems._id).",+ "success": "Whether the latest application of the policy succeeded.",+ "startedAt": "Time the latest policy application started.",+ "endedAt": "Time the latest policy application ended.",+ },+ },+ "alerts": {+ "description": "Alerts raised by JumpCloud for device and identity health, with their status and severity.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/Alerts",+ "columns": {+ "objectId": "Unique identifier of the alert.",+ "title": "Title of the alert.",+ "description": "Description of the alert.",+ "category": "Category of the alert.",+ "severity": "Severity of the alert.",+ "status": "Status of the alert (e.g. open, acknowledged, resolved).",+ "sourceType": "Type of object the alert is about.",+ "sourceId": "Identifier of the object the alert is about.",+ "sourceName": "Name of the object the alert is about.",+ "occurrencesCount": "Number of times the alert has fired.",+ "firstOccurredAt": "Time the alert first fired.",+ "lastOccurredAt": "Time the alert last fired.",+ "acknowledgedAt": "Time the alert was acknowledged.",+ "resolvedAt": "Time the alert was resolved.",+ "createdAt": "Time the alert was created.",+ "updatedAt": "Time the alert was last updated.",+ },+ },+ "alert_occurrences": {+ "description": "Each time an alert fired, with the context of that occurrence.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/Alerts",+ "columns": {+ "alert_id": "Identifier of the alert (joins to alerts.objectId).",+ "alertObjectId": "Identifier of the alert the occurrence belongs to.",+ "occurredAt": "Time the occurrence happened.",+ "context": "Details of the occurrence.",+ "createdAt": "Time the occurrence was recorded.",+ "updatedAt": "Time the occurrence was last updated.",+ },+ },+ "identity_risk_events": {+ "description": "Risk-scored identity events detected by JumpCloud, such as risky logins, with their risk factors and resolution.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/Identity-Risk",+ "columns": {+ "objectId": "Unique identifier of the risk event.",+ "identityObjectId": "Identifier of the identity the risk event is about.",+ "identityIdentifier": "Identifier (e.g. email or username) of the identity.",+ "identityType": "Type of the identity.",+ "level": "Risk level of the event.",+ "score": "Risk score of the event.",+ "riskFactors": "Risk factors that contributed to the score.",+ "occurrenceCount": "Number of times the risk event occurred.",+ "firstOccurrenceAt": "Time the risk event first occurred.",+ "lastOccurrenceAt": "Time the risk event last occurred.",+ "resolutionStatus": "Whether the risk event is open or resolved.",+ "resolvedAt": "Time the risk event was resolved.",+ "clientIp": "IP address of the client involved in the event.",+ "countryCode": "Country of the client IP address.",+ "loginStatus": "Whether the login attempt succeeded.",+ "mfaStatus": "Whether multi-factor authentication succeeded.",+ "createdAt": "Time the risk event was created.",+ },+ },+ "system_insights_alf": {+ "description": "macOS application layer firewall settings per device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_apps": {+ "description": "Applications installed on macOS devices.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_battery": {+ "description": "Battery health and charge state of each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_bitlocker_info": {+ "description": "BitLocker drive encryption status of Windows devices.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_browser_plugins": {+ "description": "Browser plugins installed on each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_chrome_extensions": {+ "description": "Google Chrome extensions installed on each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_disk_encryption": {+ "description": "Disk encryption status of each volume on each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_disk_info": {+ "description": "Physical disks attached to each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_firefox_addons": {+ "description": "Firefox add-ons installed on each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_kernel_info": {+ "description": "Kernel version and boot details of each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_linux_packages": {+ "description": "Packages installed on Linux devices.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ },+ },+ "system_insights_logged_in_users": {+ "description": "Users logged in to each device when System Insights collected the data.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_os_version": {+ "description": "Operating system name and version of each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_patches": {+ "description": "Windows updates (hotfixes) installed on each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_programs": {+ "description": "Programs installed on Windows devices.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_safari_extensions": {+ "description": "Safari extensions installed on each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_secureboot": {+ "description": "Secure Boot status of each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_sip_config": {+ "description": "macOS System Integrity Protection configuration of each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_system_info": {+ "description": "Hardware details of each device, such as CPU, memory, and serial number.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_uptime": {+ "description": "Time since each device last booted.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_usb_devices": {+ "description": "USB devices attached to each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_users": {+ "description": "Local operating system accounts on each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_windows_security_center": {+ "description": "Windows Security Center status (firewall, antivirus, updates) of each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },+ "system_insights_windows_security_products": {+ "description": "Security products (such as antivirus) registered with Windows on each device.",+ "docs_url": "https://docs.jumpcloud.com/api/2.0/index.html#tag/System-Insights",+ "columns": {+ "system_id": "Identifier of the device (joins to systems._id).",+ "collection_time": "Time System Insights collected the row.",+ },+ },"events": {"description": "Directory Insights activity events across JumpCloud services: admin console actions, directory changes, SSO, RADIUS, LDAP, MDM, and agent-reported system events.","docs_url": "https://docs.jumpcloud.com/api/insights/directory/1.0/index.html",diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/docs/jumpcloud.mdx b/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/docs/jumpcloud.mdxindex 885aa47aa642..f1073e68de7d 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/docs/jumpcloud.mdx+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/docs/jumpcloud.mdx@@ -21,8 +21,9 @@ import AlphaRelease from '../_snippets/alpha-release.mdx'<AlphaRelease />[JumpCloud](https://jumpcloud.com) is a cloud directory platform for identity, access, and device management.-Linking it as a source syncs your users, devices, groups, SSO applications, and Directory Insights activity events-into the PostHog Data warehouse, so you can join identity and security data with your product data — for example,+Linking it as a source syncs your users, devices, groups, SSO applications, device policies and their results,+alerts, identity risk events, System Insights device data, and Directory Insights activity events into the PostHog+Data warehouse, so you can join identity and security data with your product data — for example,access analytics, login and authentication monitoring, or compliance reporting.## Prerequisites@@ -34,6 +35,7 @@ To connect JumpCloud, you need:top-right corner, then **My API Key**).- A Directory Insights subscription if you want to sync the `events` table. How far back events are availabledepends on your Directory Insights retention (up to 90 days).+- System Insights enabled for your devices if you want to sync the `system_insights_*` tables.## Adding a data source@@ -63,6 +65,12 @@ The association tables (`user_group_members`, `system_group_members`, `applicatiparent group, application, or system, so a large directory takes longer to sync. Join them to the directory tableson the parent ID column (`group_id`, `application_id`, or `system_id`) and on `id`.+The `policies`, `policy_results`, `policy_statuses`, `alerts`, `alert_occurrences`, `identity_risk_events`, and+`system_insights_*` tables also sync as a full refresh. `policy_statuses` holds the latest result of each policy on+each device, and `alert_occurrences` holds each time an alert fired. Both request JumpCloud once per policy or alert.+The `system_insights_*` tables hold device inventory and security posture (installed apps and programs, patches,+disk encryption, browser extensions, OS versions, and more). Join them to `systems` on `system_id`.+## Configuration<SourceParameters />diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/jumpcloud.py b/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/jumpcloud.pyindex d5308d724bd8..c0a48f80f6b0 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/jumpcloud.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/jumpcloud.py@@ -27,7 +27,7 @@ INSIGHTS_BASE_URLS: dict[str, str] = {"eu": "https://api.eu.jumpcloud.com",}-# Both the v1 and v2 console list endpoints cap `limit` at 100.+# The v1 and v2 console list endpoints cap `limit` at 100, unless an endpoint sets its own page_size.REST_PAGE_SIZE = 100# Directory Insights allows up to 10,000 events per page; keep pages smaller since each# event is a sizeable JSON document and pages are yielded whole.@@ -192,6 +192,10 @@ def _parse_search_after(raw: str | None, logger: FilteringBoundLogger) -> list[Areturn parsed+def _page_size(config: JumpcloudEndpointConfig) -> int:+ return config.page_size or REST_PAGE_SIZE++def _fetch_rest_page(session: requests.Session,base_url: str,@@ -200,7 +204,7 @@ def _fetch_rest_page(skip: int,logger: FilteringBoundLogger,) -> list[dict[str, Any]]:- params: dict[str, Any] = {"limit": REST_PAGE_SIZE, "skip": skip}+ params: dict[str, Any] = {"limit": _page_size(config), "skip": skip}if config.sort:params["sort"] = config.sorturl = f"{base_url}{path}?{urlencode(params)}"@@ -208,10 +212,11 @@ def _fetch_rest_page(response = _request(session, "GET", url, logger)data = response.json()- # v1 wraps rows as {"totalCount": n, "results": [...]}; v2 returns a bare array. Any- # other 200 payload is a permanent API-contract violation, not a transient failure.- if config.api == "v1":- rows = data.get("results") if isinstance(data, dict) else None+ # v1 wraps rows as {"totalCount": n, "results": [...]}; v2 returns a bare array, except the+ # services that wrap it under `data_key`. Any other 200 payload is a permanent API-contract+ # violation, not a transient failure.+ if config.api == "v1" or config.data_key:+ rows = data.get(config.data_key or "results") if isinstance(data, dict) else Noneelse:rows = data if isinstance(data, list) else Noneif not isinstance(rows, list):@@ -241,7 +246,7 @@ def _get_rest_rows(yield rows# A short page means we've reached the end of the resource.- if len(rows) < REST_PAGE_SIZE:+ if len(rows) < _page_size(config):breakskip += len(rows)@@ -274,7 +279,7 @@ def _get_child_rows(yield rows- if len(rows) < REST_PAGE_SIZE:+ if len(rows) < _page_size(config):returnskip += len(rows)@@ -320,6 +325,9 @@ def _get_fanout_rows(raise ValueError(f"JumpCloud endpoint {config.name} is not a fan-out endpoint")parent_config = JUMPCLOUD_ENDPOINTS[config.parent]parent_id_column = config.parent_id_column+ parent_key = parent_config.primary_key+ if parent_key is None:+ raise ValueError(f"JumpCloud endpoint {config.parent} has no primary key to fan out on")resume = resumable_source_manager.load_state() if resumable_source_manager.can_resume() else Noneparent_skip = resume.skip if resume else 0@@ -333,7 +341,7 @@ def _get_fanout_rows(def page_rows(parent_page: list[dict[str, Any]] = parents) -> Iterator[list[dict[str, Any]]]:for parent in parent_page:- parent_id = parent.get(parent_config.primary_key)+ parent_id = parent.get(parent_key)if not parent_id:continuehas_children = False@@ -343,7 +351,7 @@ def _get_fanout_rows(if not has_children:resumable_source_manager.safe_point()- has_more = len(parents) >= REST_PAGE_SIZE+ has_more = len(parents) >= _page_size(parent_config)next_state = JumpcloudResumeConfig(skip=parent_skip + len(parents)) if has_more else Noneyield from _yield_with_checkpoint(page_rows(), next_state, resumable_source_manager)diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/settings.py b/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/settings.pyindex 3560531a4544..153816318d11 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/settings.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/settings.py@@ -13,8 +13,9 @@ class JumpcloudEndpointConfig:# "v2" -> console API v2, GET, response is a bare JSON array# "insights" -> Directory Insights API, POST with a JSON query body, bare JSON array responseapi: Literal["v1", "v2", "insights"]- # v1 resources use Mongo-style `_id`; v2 and Directory Insights use `id`.- primary_key: str = "_id"+ # v1 resources use Mongo-style `_id`; v2 and Directory Insights use `id`. System Insights rows+ # carry no unique identifier, so they sync without a primary key.+ primary_key: str | None = "_id"incremental_fields: list[IncrementalField] = field(default_factory=list)# Stable, immutable field to partition by (creation/event time — never a mutating field).partition_key: str | None = None@@ -32,9 +33,17 @@ class JumpcloudEndpointConfig:# and joins the primary key.parent: str | None = Noneparent_id_column: str | None = None+ # Newer v2 services (alerts, identity risk) wrap the rows of a page in an object under this+ # key, e.g. {"alerts": [...], "count": n}, instead of returning a bare array.+ data_key: str | None = None+ # Page size to request; None uses the console's default cap of 100. System Insights allows+ # up to 10,000 rows per page and returns many small rows per device.+ page_size: int | None = None@property- def primary_keys(self) -> list[str]:+ def primary_keys(self) -> list[str] | None:+ if self.primary_key is None:+ return Noneif self.parent_id_column:return [self.parent_id_column, self.primary_key]return [self.primary_key]@@ -45,7 +54,9 @@ class JumpcloudEndpointConfig:# filter, so they sync as full refresh. Directory Insights events accept a server-side# start_time/end_time window, so that stream syncs incrementally on `timestamp`. The graph# association tables (memberships and bindings) fan out per parent and have no timestamps,-# so they also sync as full refresh.+# so they also sync as full refresh. Policies, alerts, identity risk events, and System Insights+# device facts are mutable (statuses, resolutions, re-collected snapshots) and their list+# endpoints have no "updated since" filter, so they sync as full refresh too.JUMPCLOUD_ENDPOINTS: dict[str, JumpcloudEndpointConfig] = {"users": JumpcloudEndpointConfig(name="users",@@ -124,6 +135,58 @@ JUMPCLOUD_ENDPOINTS: dict[str, JumpcloudEndpointConfig] = {parent="systems",parent_id_column="system_id",),+ "policies": JumpcloudEndpointConfig(+ name="policies",+ path="/api/v2/policies",+ api="v2",+ primary_key="id",+ ),+ "policy_results": JumpcloudEndpointConfig(+ name="policy_results",+ path="/api/v2/policyresults",+ api="v2",+ primary_key="id",+ partition_key="startedAt",+ # Policy output is whatever the policy's script printed, which can include credentials.+ redact_keys=["stdOut", "stdErr"],+ ),+ # Fans out per policy rather than per system (`/systems/{id}/policystatuses`): both return+ # the latest result per policy and system, and an organization has far fewer policies.+ "policy_statuses": JumpcloudEndpointConfig(+ name="policy_statuses",+ path="/api/v2/policies/{parent_id}/policystatuses",+ api="v2",+ primary_key="id",+ parent="policies",+ parent_id_column="policy_id",+ redact_keys=["stdOut", "stdErr"],+ ),+ "alerts": JumpcloudEndpointConfig(+ name="alerts",+ path="/api/v2/alerts",+ api="v2",+ primary_key="objectId",+ partition_key="createdAt",+ data_key="alerts",+ ),+ # Occurrences have no identifier of their own, so they're keyed on the alert and occurrence time.+ "alert_occurrences": JumpcloudEndpointConfig(+ name="alert_occurrences",+ path="/api/v2/alerts/{parent_id}/occurrences",+ api="v2",+ primary_key="occurredAt",+ parent="alerts",+ parent_id_column="alert_id",+ data_key="alertOccurrences",+ ),+ "identity_risk_events": JumpcloudEndpointConfig(+ name="identity_risk_events",+ path="/api/v2/identityrisk/events",+ api="v2",+ primary_key="objectId",+ partition_key="createdAt",+ data_key="riskEvents",+ ),"events": JumpcloudEndpointConfig(name="events",path="/insights/directory/v1/events",@@ -142,6 +205,48 @@ JUMPCLOUD_ENDPOINTS: dict[str, JumpcloudEndpointConfig] = {),}+# A curated subset of the System Insights (osquery) tables: software inventory, patching, and+# security posture. Credential-adjacent tables (shadow, authorized_keys, user_ssh_keys) are left out.+SYSTEM_INSIGHTS_TABLES = (+ "alf",+ "apps",+ "battery",+ "bitlocker_info",+ "browser_plugins",+ "chrome_extensions",+ "disk_encryption",+ "disk_info",+ "firefox_addons",+ "kernel_info",+ "linux_packages",+ "logged_in_users",+ "os_version",+ "patches",+ "programs",+ "safari_extensions",+ "secureboot",+ "sip_config",+ "system_info",+ "uptime",+ "usb_devices",+ "users",+ "windows_security_center",+ "windows_security_products",+)++JUMPCLOUD_ENDPOINTS.update(+ {+ f"system_insights_{table}": JumpcloudEndpointConfig(+ name=f"system_insights_{table}",+ path=f"/api/v2/systeminsights/{table}",+ api="v2",+ primary_key=None,+ page_size=1000,+ )+ for table in SYSTEM_INSIGHTS_TABLES+ }+)+ENDPOINTS = tuple(JUMPCLOUD_ENDPOINTS.keys())INCREMENTAL_FIELDS: dict[str, list[IncrementalField]] = {diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/source.py b/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/source.pyindex 4d121646fe94..2b6f2993fdd8 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/source.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/source.py@@ -33,6 +33,17 @@ from products.warehouse_sources.backend.temporal.data_imports.sources.jumpcloud.from products.warehouse_sources.backend.types import ExternalDataSourceType+def _schema_description(endpoint: str) -> str | None:+ if endpoint == "events":+ return (+ "Directory Insights activity events (console, SSO, RADIUS, LDAP, systems, and directory changes). "+ "Only syncs the last 90 days on initial sync, bounded by your Directory Insights retention"+ )+ if endpoint.startswith("system_insights_"):+ return "Device data reported by System Insights, one row per item per device. Requires System Insights to be enabled"+ return None++@SourceRegistry.registerclass JumpcloudSource(ResumableSource[JumpcloudSourceConfig, JumpcloudResumeConfig]):lists_tables_without_credentials = True # static endpoint catalog — safe for public docs@@ -132,12 +143,7 @@ The `events` table requires a Directory Insights subscription. If you're an MSP/supports_append=False,incremental_fields=INCREMENTAL_FIELDS.get(endpoint, []),detected_primary_keys=JUMPCLOUD_ENDPOINTS[endpoint].primary_keys,- description=(- "Directory Insights activity events (console, SSO, RADIUS, LDAP, systems, and directory changes). "- "Only syncs the last 90 days on initial sync, bounded by your Directory Insights retention"- if endpoint == "events"- else None- ),+ description=_schema_description(endpoint),)for endpoint in ENDPOINTS]diff --git a/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/tests/test_jumpcloud.py b/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/tests/test_jumpcloud.pyindex e5373ed16d30..60affb0ba48b 100644--- a/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/tests/test_jumpcloud.py+++ b/products/warehouse_sources/backend/temporal/data_imports/sources/jumpcloud/tests/test_jumpcloud.py@@ -118,12 +118,15 @@ class TestRestRows:def fake_request(session: Any, method: str, url: str, logger: Any, json_body: Any = None) -> Any:assert method == "GET"fetched_urls.append(url)+ config = JUMPCLOUD_ENDPOINTS[endpoint]skip = int(url.split("skip=")[1].split("&")[0])- index = skip // REST_PAGE_SIZE+ index = skip // (config.page_size or REST_PAGE_SIZE)page = pages[index] if index < len(pages) else []response = MagicMock()- if JUMPCLOUD_ENDPOINTS[endpoint].api == "v1":+ if config.api == "v1":response.json.return_value = {"totalCount": sum(len(p) for p in pages), "results": page}+ elif config.data_key:+ response.json.return_value = {config.data_key: page, "count": sum(len(p) for p in pages)}else:response.json.return_value = pagereturn response@@ -168,11 +171,34 @@ class TestRestRows:assert len(urls) == 1assert f"skip={REST_PAGE_SIZE}" in urls[0]- def test_v2_bare_array_endpoint(self, monkeypatch: Any) -> None:+ @parameterized.expand(+ [+ ("bare_array", "user_groups", "https://console.jumpcloud.com/api/v2/usergroups?"),+ ("wrapped_alerts", "alerts", "https://console.jumpcloud.com/api/v2/alerts?"),+ (+ "wrapped_risk_events",+ "identity_risk_events",+ "https://console.jumpcloud.com/api/v2/identityrisk/events?",+ ),+ ]+ )+ def test_v2_endpoint_rows(self, _name: str, endpoint: str, url_prefix: str) -> None:manager = _FakeResumableManager()- rows, urls = self._collect("user_groups", [[{"id": "g1"}]], manager, monkeypatch)+ with pytest.MonkeyPatch.context() as monkeypatch:+ rows, urls = self._collect(endpoint, [[{"id": "g1"}]], manager, monkeypatch)assert rows == [{"id": "g1"}]- assert urls[0].startswith("https://console.jumpcloud.com/api/v2/usergroups?")+ assert urls[0].startswith(url_prefix)++ def test_system_insights_pages_with_its_larger_page_size(self, monkeypatch: Any) -> None:+ page_size = JUMPCLOUD_ENDPOINTS["system_insights_apps"].page_size+ assert page_size is not None and page_size > REST_PAGE_SIZE+ full_page = [{"system_id": "s1", "name": f"app{i}"} for i in range(page_size)]+ manager = _FakeResumableManager()+ rows, urls = self._collect("system_insights_apps", [full_page, [{"system_id": "s2"}]], manager, monkeypatch)+ assert len(rows) == page_size + 1+ assert [u.split("?")[0] for u in urls] == ["https://console.jumpcloud.com/api/v2/systeminsights/apps"] * 2+ assert f"limit={page_size}" in urls[0]+ assert manager.saved == [JumpcloudResumeConfig(skip=page_size)]def test_eu_region_targets_eu_console(self, monkeypatch: Any) -> None:manager = _FakeResumableManager()@@ -201,7 +227,14 @@ class TestRestRows:]@parameterized.expand(- [("applications", False), ("users", True), ("application_users", False), ("system_users", True)]+ [+ ("applications", False),+ ("users", True),+ ("application_users", False),+ ("system_users", True),+ ("policy_results", False),+ ("policy_statuses", False),+ ])def test_secret_bearing_endpoint_disables_http_sample_capture(self, endpoint: str, expected_capture: bool) -> None:# HTTP sample capture writes the raw response body before row-level `redact_keys` runs, so@@ -233,19 +266,22 @@ class TestRestRows:)assert capture_kwargs == [expected_capture]- def test_v1_non_wrapped_payload_raises_value_error(self, monkeypatch: Any) -> None:+ @parameterized.expand([("v1", "users"), ("v2_wrapped", "alerts")])+ def test_non_wrapped_payload_raises_value_error(self, _name: str, endpoint: str) -> None:def fake_request(session: Any, method: str, url: str, logger: Any, json_body: Any = None) -> Any:response = MagicMock()- response.json.return_value = [{"_id": "a"}] # bare list where v1 wraps in "results"+ response.json.return_value = [{"_id": "a"}] # bare list where the endpoint wraps its rowsreturn response- monkeypatch.setattr(jumpcloud, "_request", fake_request)- monkeypatch.setattr(jumpcloud, "make_tracked_session", lambda **kwargs: MagicMock())- with pytest.raises(ValueError):+ with (+ patch.object(jumpcloud, "_request", fake_request),+ patch.object(jumpcloud, "make_tracked_session", lambda **kwargs: MagicMock()),+ pytest.raises(ValueError),+ ):list(get_rows(api_key="key",- endpoint="users",+ endpoint=endpoint,logger=MagicMock(),resumable_source_manager=_FakeResumableManager(), # type: ignore[arg-type])@@ -273,13 +309,19 @@ class TestFanoutRows:if path == parent_config.path:index = skip // REST_PAGE_SIZEpage = parent_pages[index] if index < len(parent_pages) else []- response.json.return_value = {"results": page} if parent_config.api == "v1" else page+ if parent_config.api == "v1":+ response.json.return_value = {"results": page}+ elif parent_config.data_key:+ response.json.return_value = {parent_config.data_key: page}+ else:+ response.json.return_value = pagereturn responseparent_id = path.split("/")[4]child = children.get(parent_id, [])if isinstance(child, int):raise requests.HTTPError(response=_response_with_status(child))- response.json.return_value = child[skip : skip + REST_PAGE_SIZE]+ child_page = child[skip : skip + REST_PAGE_SIZE]+ response.json.return_value = {config.data_key: child_page} if config.data_key else child_pagereturn responsemonkeypatch.setattr(jumpcloud, "_request", fake_request)@@ -319,6 +361,18 @@ class TestFanoutRows:assert {row["system_id"] for row in rows} == {"s1"}assert [u.split("?")[0] for u in urls[1:]] == ["https://console.jumpcloud.com/api/v2/systems/s1/users"] * 2+ def test_alert_occurrences_read_wrapped_alerts_and_occurrences(self, monkeypatch: Any) -> None:+ occurrence = {"alertObjectId": "a1", "occurredAt": "2026-01-01T00:00:00Z", "context": {}}+ manager = _FakeResumableManager()+ rows, urls = self._collect(+ "alert_occurrences", [[{"objectId": "a1"}, {"objectId": "a2"}]], {"a1": [occurrence]}, manager, monkeypatch+ )+ assert rows == [{**occurrence, "alert_id": "a1"}]+ assert [u.split("?")[0] for u in urls[1:]] == [+ "https://console.jumpcloud.com/api/v2/alerts/a1/occurrences",+ "https://console.jumpcloud.com/api/v2/alerts/a2/occurrences",+ ]+def test_checkpoints_parent_offset_after_each_full_parent_page(self, monkeypatch: Any) -> None:full_page = [{"_id": f"a{i}"} for i in range(REST_PAGE_SIZE)]manager = _FakeResumableManager()@@ -548,4 +602,7 @@ class TestJumpcloudSourceResponse:def test_partition_keys_are_stable_fields(self) -> None:# Guards against accidentally partitioning on a churning field like lastContact.- assert all(cfg.partition_key in (None, "created", "timestamp") for cfg in JUMPCLOUD_ENDPOINTS.values())+ assert all(+ cfg.partition_key in (None, "created", "createdAt", "startedAt", "timestamp")+ for cfg in JUMPCLOUD_ENDPOINTS.values()+ )