@cdot65/prisma-airs-sdk 0.13.2 → 0.14.1
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.
- package/README.md +46 -2
- package/dist/index.cjs +2537 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11281 -2687
- package/dist/index.d.ts +11281 -2687
- package/dist/index.js +2448 -21
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
[](https://nodejs.org/)
|
|
14
14
|
[](https://opensource.org/licenses/MIT)
|
|
15
15
|
|
|
16
|
-
TypeScript SDK for Palo Alto Networks **Prisma AIRS** — covering the full lifecycle from configuration management to operational scanning across all
|
|
16
|
+
TypeScript SDK for Palo Alto Networks **Prisma AIRS** — covering the full lifecycle from configuration management to operational scanning across all four service domains: **AI Runtime Security**, **AI Red Teaming**, **Model Security**, and **AI Gateway**.
|
|
17
17
|
|
|
18
18
|
## Installation
|
|
19
19
|
|
|
@@ -30,6 +30,7 @@ Requires Node.js 18+. Zero external HTTP dependencies (native `fetch` + `crypto`
|
|
|
30
30
|
| **AI Runtime Security** | `Scanner` | API Key | Sync/async content scanning, prompt injection detection |
|
|
31
31
|
| **Management** | `ManagementClient` | OAuth2 | Profiles, topics, API keys, apps, DLP, deployment, logs |
|
|
32
32
|
| **Model Security** | `ModelSecurityClient` | OAuth2 | ML model scanning, security groups, rule management |
|
|
33
|
+
| **AI Gateway** | `AIGatewayClient` | OAuth2 | SCM-managed gateway telemetry and configuration |
|
|
33
34
|
| **AI Red Teaming** | `RedTeamClient` | OAuth2 | Automated red team scans, reports, targets, custom attacks |
|
|
34
35
|
|
|
35
36
|
All OAuth2 services share credentials and handle token lifecycle automatically (caching, proactive refresh, 401/403 auto-retry).
|
|
@@ -53,7 +54,50 @@ console.log(result.category); // "benign" | "malicious"
|
|
|
53
54
|
console.log(result.action); // "allow" | "block"
|
|
54
55
|
```
|
|
55
56
|
|
|
56
|
-
That's the API-key scanning path. The OAuth2 clients (`ManagementClient`, `ModelSecurityClient`, `RedTeamClient`), authentication setup, error handling, and runnable examples are all covered in the documentation.
|
|
57
|
+
That's the API-key scanning path. The OAuth2 clients (`ManagementClient`, `ModelSecurityClient`, `RedTeamClient`, `AIGatewayClient`), authentication setup, error handling, and runnable examples are all covered in the documentation.
|
|
58
|
+
|
|
59
|
+
## AI Gateway
|
|
60
|
+
|
|
61
|
+
`AIGatewayClient` covers the SCM-managed Prisma AIRS **AI Gateway** — runtime telemetry and configuration across two planes behind one credential set: a data plane (`/ai_gw/v2`, telemetry + workspace-scoped config) and an admin plane (`/ai_gw/admin/v2`, organisation-level config). Twelve sub-clients: `telemetry`, `workspaces`, `configs`, `guardrails`, `providers`, `apiKeys` (data plane) and `integrations`, `mcpIntegrations`, `deployments`, `plugins`, `organisations`, `auditLogs` (admin plane).
|
|
62
|
+
|
|
63
|
+
### SCM role grants
|
|
64
|
+
|
|
65
|
+
The two planes authorize against **different SCM role scopes** — a service account needs both, or half the API returns 403:
|
|
66
|
+
|
|
67
|
+
| Grant | Scope | Unlocks |
|
|
68
|
+
| --------------------------- | -------------------------------- | ------------------- |
|
|
69
|
+
| Admin role | tenant root (empty last segment) | `/ai_gw/admin/v2/*` |
|
|
70
|
+
| `view_only_admin` or higher | `main_airs_workspace_<TSG>` | `/ai_gw/v2/*` |
|
|
71
|
+
|
|
72
|
+
Decode the service account's JWT `access` claim to check both are present:
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"prn:<TSG>::::": ["superuser", "base"],
|
|
77
|
+
"prn:<TSG>::::main_airs_workspace_<TSG>": ["superuser"]
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
SCM's Access Management UI **edits an existing role row by default** — use _Add Role_ to add the second grant, or you'll move the first one instead of adding to it. The two failure modes look alike but mean different things: a `403` with body `errorCode: "AB03"` means the workspace-scope grant is missing; a `403` with header `x-opa-decision: false` means the tenant-root grant is.
|
|
82
|
+
|
|
83
|
+
### Setup
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
export PANW_AI_GW_CLIENT_ID=your-client-id
|
|
87
|
+
export PANW_AI_GW_CLIENT_SECRET=your-client-secret
|
|
88
|
+
export PANW_AI_GW_TSG_ID=1234567890
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`PANW_AI_GW_*` vars fall back to `PANW_MGMT_*` when unset, so existing management credentials work as-is.
|
|
92
|
+
|
|
93
|
+
```ts
|
|
94
|
+
import { AIGatewayClient } from '@cdot65/prisma-airs-sdk';
|
|
95
|
+
|
|
96
|
+
const gw = new AIGatewayClient();
|
|
97
|
+
|
|
98
|
+
const cost = await gw.telemetry.cost({ workspaceSlug: 'ws-main-a-349e0e', days: 7 });
|
|
99
|
+
console.log(`$${(cost.data.total / 100).toFixed(2)}`); // cost is returned in cents
|
|
100
|
+
```
|
|
57
101
|
|
|
58
102
|
## Documentation
|
|
59
103
|
|