diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e7d8bf3..9f4e96d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,15 @@ ## Unreleased +### Adapters — Palo Alto SaaS Security (`prisma_saas`) + +- `cloud-adapter` and `external-adapter` help now document the `prisma_saas` + adapter type (Palo Alto SaaS Security, formerly Prisma SaaS), including a + `cloud-adapter set` example using a `hive://secret/` client secret. The type + itself is discovered from the live adapter hive schema + (`cloud-adapter list-types` / `schema --type prisma_saas`); no SDK change is + needed to use it. + ### Auth — OAuth login over SSH by pasting the redirect URL - `auth login --oauth --no-browser` and `auth signup --no-browser` now finish diff --git a/limacharlie/commands/adapter.py b/limacharlie/commands/adapter.py index 36f42aec..b23d077c 100644 --- a/limacharlie/commands/adapter.py +++ b/limacharlie/commands/adapter.py @@ -21,7 +21,7 @@ Each record contains the adapter type and its connection settings. Common adapter types: syslog, file, s3, gcs, pubsub, webhook, stdin, office365, 1password, crowdstrike, carbon_black, duo, sophos, -threatlocker, and more. Run 'limacharlie external-adapter list-types' +threatlocker, prisma_saas, and more. Run 'limacharlie external-adapter list-types' for the full, up-to-date list. Use --output json for the full config including connection details. @@ -58,7 +58,7 @@ hostname - Display name for this adapter sensor sensor_seed_key - Stable unique ID for this adapter instance platform - Data format: text, json, xml, cef, carbon_black, - crowdstrike, wel, gcp, aws, office365, etc. + crowdstrike, wel, gcp, aws, office365, prisma_saas, etc. identity.installation_key - Enrollment key for the adapter identity.oid - Target organization ID mapping - Parsing and field mapping configuration diff --git a/limacharlie/commands/cloud_sensor.py b/limacharlie/commands/cloud_sensor.py index 2419fe27..76f7bf13 100644 --- a/limacharlie/commands/cloud_sensor.py +++ b/limacharlie/commands/cloud_sensor.py @@ -58,13 +58,28 @@ secret_key: hive://secret/s3-creds prefix: logs/ +Palo Alto SaaS Security (Prisma SaaS) adapter example: + + sensor_type: prisma_saas + prisma_saas: + client_options: + hostname: prisma-saas + identity: + installation_key: + oid: + platform: prisma_saas + sensor_seed_key: prisma-saas + client_id: + client_secret: hive://secret/prisma-saas-client-secret + region: us + The structure is the same as external adapters. The top-level sensor_type selects the adapter kind, and client_options are shared across all types. Supported cloud adapter types include: webhook, s3, gcs, pubsub, -office365, 1password, crowdstrike, duo, sophos, threatlocker, okta, -google_workspace, sentinelone, mimecast, and more. Run +office365, 1password, crowdstrike, duo, sophos, threatlocker, prisma_saas, +okta, google_workspace, sentinelone, mimecast, and more. Run 'limacharlie cloud-adapter list-types' for the full, up-to-date list. Secrets can be referenced with hive://secret/name syntax to avoid diff --git a/tests/unit/test_cli_ergonomics.py b/tests/unit/test_cli_ergonomics.py index 206ab851..98c2578b 100644 --- a/tests/unit/test_cli_ergonomics.py +++ b/tests/unit/test_cli_ergonomics.py @@ -599,6 +599,61 @@ def test_cli_unknown_type_errors_with_valid_list(self, mock_hive_cls): assert "threatlocker" in result.output # lists the valid types +# --------------------------------------------------------------------------- +# prisma_saas adapter type (Palo Alto SaaS Security) +# --------------------------------------------------------------------------- + +class TestPrismaSaasAdapterType: + _SCHEMA = {"schema": { + "$ref": "#/$defs/CloudSensorRecord", + "$defs": { + "CloudSensorRecord": {"properties": { + "sensor_type": {"type": "string"}, + "prisma_saas": {"$ref": "#/$defs/PrismaSaaSConfig"}, + }}, + "PrismaSaaSConfig": {"properties": { + "client_id": {"type": "string"}, + "client_secret": {"type": "string"}, + "region": {"type": "string"}, + "base_url": {"type": "string"}, + "max_concurrent_polls": {"type": "integer"}, + }, "required": ["client_id", "client_secret"]}, + }, + }} + + @patch("limacharlie.commands._adapter_types.Hive") + def test_listed_and_schema_resolved_from_live_schema(self, mock_hive_cls): + from limacharlie.commands import _adapter_types as at + mock_hive = MagicMock(); mock_hive.get_schema.return_value = self._SCHEMA + mock_hive_cls.return_value = mock_hive + assert {r["type"] for r in at.adapter_types(None)} == {"prisma_saas"} + root, node = at.adapter_type_schema(None, "cloud_sensor", "prisma_saas") + assert node.get("$ref", "").endswith("PrismaSaaSConfig") + assert "PrismaSaaSConfig" in root["$defs"] + + @patch("limacharlie.commands._adapter_types.Hive") + def test_cli_schema_renders_config_keys(self, mock_hive_cls): + mock_hive = MagicMock(); mock_hive.get_schema.return_value = self._SCHEMA + mock_hive_cls.return_value = mock_hive + runner = CliRunner() + with patch("limacharlie.client.Client"): + result = runner.invoke(cli, [ + "--output", "table", "cloud-adapter", "schema", "--type", "prisma_saas"]) + assert result.exit_code == 0, result.output + for key in ("client_id", "client_secret", "region", "base_url", "max_concurrent_polls"): + assert key in result.output + + def test_help_text_documents_prisma_saas(self): + import limacharlie.commands.adapter # noqa: F401 (registers explains) + import limacharlie.commands.cloud_sensor # noqa: F401 + from limacharlie.discovery import get_explain + cloud = get_explain("cloud-adapter.set") + assert "sensor_type: prisma_saas" in cloud + assert "client_secret: hive://secret/" in cloud + assert "prisma_saas" in get_explain("external-adapter.set") + assert "prisma_saas" in get_explain("external-adapter.list") + + # --------------------------------------------------------------------------- # adapter sensors --key (find an adapter's sensor(s) by iid) # ---------------------------------------------------------------------------