@cdot65/prisma-airs-sdk 0.6.7 → 0.6.8
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 +13 -28
- package/dist/index.cjs +35 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.js +35 -1
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -24,7 +24,7 @@ Requires Node.js 18+. Zero external HTTP dependencies (native `fetch` + `crypto`
|
|
|
24
24
|
| Service | Client | Auth | Capabilities |
|
|
25
25
|
| ----------------------- | --------------------- | ------- | ---------------------------------------------------------- |
|
|
26
26
|
| **AI Runtime Security** | `Scanner` | API Key | Sync/async content scanning, prompt injection detection |
|
|
27
|
-
| **Management** | `ManagementClient` | OAuth2 |
|
|
27
|
+
| **Management** | `ManagementClient` | OAuth2 | Profiles, topics, API keys, apps, DLP, deployment, logs |
|
|
28
28
|
| **Model Security** | `ModelSecurityClient` | OAuth2 | ML model scanning, security groups, rule management |
|
|
29
29
|
| **AI Red Teaming** | `RedTeamClient` | OAuth2 | Automated red team scans, reports, targets, custom attacks |
|
|
30
30
|
|
|
@@ -53,28 +53,20 @@ console.log(result.action); // "allow" | "block"
|
|
|
53
53
|
|
|
54
54
|
### Management — Configuration CRUD (OAuth2)
|
|
55
55
|
|
|
56
|
-
CRUD operations for all three Prisma AIRS services use OAuth2:
|
|
57
|
-
|
|
58
56
|
```ts
|
|
59
57
|
import { ManagementClient } from '@cdot65/prisma-airs-sdk';
|
|
60
58
|
|
|
61
59
|
const client = new ManagementClient(); // reads PANW_MGMT_* env vars
|
|
62
60
|
|
|
63
|
-
//
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// Custom Topics
|
|
74
|
-
const topic = await client.topics.create({
|
|
75
|
-
topic_name: 'pii-detector',
|
|
76
|
-
examples: ['SSN: 123-45-6789'],
|
|
77
|
-
});
|
|
61
|
+
// 8 sub-clients available:
|
|
62
|
+
client.profiles; // AI security profile CRUD
|
|
63
|
+
client.topics; // Custom detection topic CRUD
|
|
64
|
+
client.apiKeys; // API key lifecycle (create, list, regenerate, delete)
|
|
65
|
+
client.customerApps; // Customer application management
|
|
66
|
+
client.dlpProfiles; // DLP data profile listing
|
|
67
|
+
client.deploymentProfiles; // Deployment profile listing
|
|
68
|
+
client.scanLogs; // Scan activity log queries
|
|
69
|
+
client.oauth; // OAuth token management (get/invalidate)
|
|
78
70
|
```
|
|
79
71
|
|
|
80
72
|
### Model Security — ML Model Scanning (OAuth2)
|
|
@@ -84,6 +76,7 @@ import { ModelSecurityClient } from '@cdot65/prisma-airs-sdk';
|
|
|
84
76
|
|
|
85
77
|
const client = new ModelSecurityClient(); // falls back to PANW_MGMT_* env vars
|
|
86
78
|
|
|
79
|
+
// 3 sub-clients: scans, securityGroups, securityRules
|
|
87
80
|
const scans = await client.scans.list({ limit: 10 });
|
|
88
81
|
const groups = await client.securityGroups.list();
|
|
89
82
|
const rules = await client.securityRules.list();
|
|
@@ -96,6 +89,7 @@ import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
|
96
89
|
|
|
97
90
|
const client = new RedTeamClient(); // falls back to PANW_MGMT_* env vars
|
|
98
91
|
|
|
92
|
+
// 5 sub-clients: scans, reports, customAttackReports, targets, customAttacks
|
|
99
93
|
const scans = await client.scans.list({ limit: 5 });
|
|
100
94
|
const targets = await client.targets.list();
|
|
101
95
|
const categories = await client.scans.getCategories();
|
|
@@ -118,15 +112,6 @@ export PANW_MGMT_CLIENT_SECRET=your-client-secret
|
|
|
118
112
|
export PANW_MGMT_TSG_ID=1234567890
|
|
119
113
|
```
|
|
120
114
|
|
|
121
|
-
## Scanner Methods
|
|
122
|
-
|
|
123
|
-
| Method | Description |
|
|
124
|
-
| ------------------------------------- | ------------------------------------------ |
|
|
125
|
-
| `syncScan(aiProfile, content, opts?)` | Synchronous inline scan |
|
|
126
|
-
| `asyncScan(scanObjects)` | Batch async scan (up to 5) |
|
|
127
|
-
| `queryByScanIds(scanIds)` | Get results by scan IDs (up to 5) |
|
|
128
|
-
| `queryByReportIds(reportIds)` | Get threat reports by report IDs (up to 5) |
|
|
129
|
-
|
|
130
115
|
## Error Handling
|
|
131
116
|
|
|
132
117
|
```ts
|
|
@@ -153,7 +138,7 @@ Full documentation at **[cdot65.github.io/prisma-airs-sdk](https://cdot65.github
|
|
|
153
138
|
```bash
|
|
154
139
|
npm install
|
|
155
140
|
npm run build # tsup (CJS + ESM + .d.ts)
|
|
156
|
-
npm run test # vitest (
|
|
141
|
+
npm run test # vitest (829 tests, 99%+ coverage)
|
|
157
142
|
npm run lint # eslint
|
|
158
143
|
npm run typecheck # tsc --noEmit
|
|
159
144
|
```
|
package/dist/index.cjs
CHANGED
|
@@ -430,7 +430,7 @@ var MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 5;
|
|
|
430
430
|
var MAX_CONNECTION_POOL_SIZE = 100;
|
|
431
431
|
var MAX_NUMBER_OF_RETRIES = 5;
|
|
432
432
|
var HTTP_FORCE_RETRY_STATUS_CODES = [500, 502, 503, 504];
|
|
433
|
-
var SDK_VERSION = "0.6.
|
|
433
|
+
var SDK_VERSION = "0.6.8";
|
|
434
434
|
var USER_AGENT = `PAN-AIRS/${SDK_VERSION}-typescript-sdk`;
|
|
435
435
|
var DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
|
|
436
436
|
var DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
|
|
@@ -3385,6 +3385,40 @@ var ProfilesClient = class {
|
|
|
3385
3385
|
});
|
|
3386
3386
|
return res.data;
|
|
3387
3387
|
}
|
|
3388
|
+
/**
|
|
3389
|
+
* Get a security profile by UUID.
|
|
3390
|
+
* Fetches all profiles and filters — no dedicated API endpoint exists.
|
|
3391
|
+
* @param profileId - UUID of the profile to retrieve.
|
|
3392
|
+
* @returns The matching security profile.
|
|
3393
|
+
*/
|
|
3394
|
+
async get(profileId) {
|
|
3395
|
+
const { ai_profiles } = await this.list();
|
|
3396
|
+
const profile = ai_profiles.find((p) => p.profile_id === profileId);
|
|
3397
|
+
if (!profile) {
|
|
3398
|
+
throw new AISecSDKException(
|
|
3399
|
+
`Profile not found: ${profileId}`,
|
|
3400
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
3401
|
+
);
|
|
3402
|
+
}
|
|
3403
|
+
return profile;
|
|
3404
|
+
}
|
|
3405
|
+
/**
|
|
3406
|
+
* Get a security profile by name.
|
|
3407
|
+
* Returns the highest-revision match (latest version).
|
|
3408
|
+
* @param profileName - Name of the profile to retrieve.
|
|
3409
|
+
* @returns The matching security profile with the highest revision.
|
|
3410
|
+
*/
|
|
3411
|
+
async getByName(profileName) {
|
|
3412
|
+
const { ai_profiles } = await this.list();
|
|
3413
|
+
const matches = ai_profiles.filter((p) => p.profile_name === profileName);
|
|
3414
|
+
if (matches.length === 0) {
|
|
3415
|
+
throw new AISecSDKException(
|
|
3416
|
+
`Profile not found: ${profileName}`,
|
|
3417
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
3418
|
+
);
|
|
3419
|
+
}
|
|
3420
|
+
return matches.reduce((best, p) => (p.revision ?? 0) > (best.revision ?? 0) ? p : best);
|
|
3421
|
+
}
|
|
3388
3422
|
/**
|
|
3389
3423
|
* Update an existing security profile.
|
|
3390
3424
|
* @param profileId - UUID of the profile to update.
|