@cdot65/prisma-airs-sdk 0.12.0 → 0.13.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 +16 -100
- package/dist/index.cjs +768 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1448 -44
- package/dist/index.d.ts +1448 -44
- package/dist/index.js +743 -56
- package/dist/index.js.map +1 -1
- package/package.json +4 -22
package/README.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="docs-site/static/img/logo-banner.svg" alt="prisma-airs-sdk" width="420" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
1
5
|
# prisma-airs-sdk
|
|
2
6
|
|
|
3
7
|
[](https://github.com/cdot65/prisma-airs-sdk/actions/workflows/ci.yml)
|
|
@@ -32,8 +36,6 @@ All OAuth2 services share credentials and handle token lifecycle automatically (
|
|
|
32
36
|
|
|
33
37
|
## Quick Start
|
|
34
38
|
|
|
35
|
-
### AI Runtime Security — Content Scanning (API Key)
|
|
36
|
-
|
|
37
39
|
```ts
|
|
38
40
|
import { init, Scanner, Content } from '@cdot65/prisma-airs-sdk';
|
|
39
41
|
|
|
@@ -51,114 +53,28 @@ console.log(result.category); // "benign" | "malicious"
|
|
|
51
53
|
console.log(result.action); // "allow" | "block"
|
|
52
54
|
```
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```ts
|
|
57
|
-
import { ManagementClient } from '@cdot65/prisma-airs-sdk';
|
|
58
|
-
|
|
59
|
-
const client = new ManagementClient(); // reads PANW_MGMT_* env vars
|
|
60
|
-
|
|
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)
|
|
70
|
-
|
|
71
|
-
// DLP namespace — separate base URL, same OAuth credentials:
|
|
72
|
-
client.dlp.dataFilteringProfiles; // list / get / replace
|
|
73
|
-
client.dlp.dataPatterns; // full CRUD + JSON Merge Patch
|
|
74
|
-
client.dlp.dataProfiles; // CRUD without DELETE + JSON Merge Patch
|
|
75
|
-
client.dlp.dictionaries; // multipart upload + CRUD + JSON Merge Patch
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Model Security — ML Model Scanning (OAuth2)
|
|
79
|
-
|
|
80
|
-
```ts
|
|
81
|
-
import { ModelSecurityClient } from '@cdot65/prisma-airs-sdk';
|
|
82
|
-
|
|
83
|
-
const client = new ModelSecurityClient(); // falls back to PANW_MGMT_* env vars
|
|
84
|
-
|
|
85
|
-
// 3 sub-clients: scans, securityGroups, securityRules
|
|
86
|
-
const scans = await client.scans.list({ limit: 10 });
|
|
87
|
-
const groups = await client.securityGroups.list();
|
|
88
|
-
const rules = await client.securityRules.list();
|
|
89
|
-
|
|
90
|
-
// PyPI integration auth
|
|
91
|
-
const pypiAuth = await client.getPyPIAuth();
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
### AI Red Teaming — Automated Testing (OAuth2)
|
|
95
|
-
|
|
96
|
-
```ts
|
|
97
|
-
import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
98
|
-
|
|
99
|
-
const client = new RedTeamClient(); // falls back to PANW_MGMT_* env vars
|
|
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.
|
|
100
57
|
|
|
101
|
-
|
|
102
|
-
const scans = await client.scans.list({ limit: 5 });
|
|
103
|
-
const targets = await client.targets.list();
|
|
104
|
-
const categories = await client.scans.getCategories();
|
|
105
|
-
|
|
106
|
-
// EULA + instance management
|
|
107
|
-
const eulaStatus = await client.eula.getStatus();
|
|
108
|
-
const templates = await client.targets.getTargetTemplates();
|
|
109
|
-
|
|
110
|
-
// 7 convenience methods on the top-level client
|
|
111
|
-
const stats = await client.getScanStatistics();
|
|
112
|
-
const trend = await client.getScoreTrend('target-uuid');
|
|
113
|
-
const quota = await client.getQuota();
|
|
114
|
-
const errors = await client.getErrorLogs('job-uuid');
|
|
115
|
-
const dashboard = await client.getDashboardOverview();
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
## Authentication
|
|
119
|
-
|
|
120
|
-
| Auth Method | Used By |
|
|
121
|
-
| ------------------------------- | ----------------------------------------------------------- |
|
|
122
|
-
| **API Key** (HMAC-SHA256) | AI Runtime Security scans only |
|
|
123
|
-
| **OAuth2** (client_credentials) | Everything else — Management CRUD, Red Team, Model Security |
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
# AI Runtime Security scans
|
|
127
|
-
export PANW_AI_SEC_API_KEY=your-api-key
|
|
128
|
-
|
|
129
|
-
# OAuth2 (shared by Management, Red Team, Model Security)
|
|
130
|
-
export PANW_MGMT_CLIENT_ID=your-client-id
|
|
131
|
-
export PANW_MGMT_CLIENT_SECRET=your-client-secret
|
|
132
|
-
export PANW_MGMT_TSG_ID=1234567890
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
## Error Handling
|
|
136
|
-
|
|
137
|
-
```ts
|
|
138
|
-
import { AISecSDKException, ErrorType } from '@cdot65/prisma-airs-sdk';
|
|
139
|
-
|
|
140
|
-
try {
|
|
141
|
-
await scanner.syncScan(profile, content);
|
|
142
|
-
} catch (err) {
|
|
143
|
-
if (err instanceof AISecSDKException) {
|
|
144
|
-
console.error(err.message);
|
|
145
|
-
console.error(err.errorType);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
```
|
|
58
|
+
## Documentation
|
|
149
59
|
|
|
150
|
-
|
|
60
|
+
Full docs at **[cdot65.github.io/prisma-airs-sdk](https://cdot65.github.io/prisma-airs-sdk/)**:
|
|
151
61
|
|
|
152
|
-
|
|
62
|
+
- [Getting Started](https://cdot65.github.io/prisma-airs-sdk/getting-started/quick-start) — installation, quick start, configuration, environment variables
|
|
63
|
+
- [Scan API](https://cdot65.github.io/prisma-airs-sdk/guides/scan-api) — sync/async content scanning
|
|
64
|
+
- [Management API](https://cdot65.github.io/prisma-airs-sdk/guides/management-api) — profiles, topics, API keys, apps, DLP, deployment, logs
|
|
65
|
+
- [Model Security API](https://cdot65.github.io/prisma-airs-sdk/guides/model-security-api) — model scans, security groups, rules
|
|
66
|
+
- [Red Team API](https://cdot65.github.io/prisma-airs-sdk/guides/red-team-api) — scans, reports, targets, custom attacks
|
|
67
|
+
- [OAuth Lifecycle](https://cdot65.github.io/prisma-airs-sdk/guides/oauth-lifecycle) & [Error Handling](https://cdot65.github.io/prisma-airs-sdk/developer/error-handling)
|
|
68
|
+
- [API Reference](https://cdot65.github.io/prisma-airs-sdk/reference/api) — generated from source
|
|
153
69
|
|
|
154
|
-
|
|
70
|
+
Runnable example scripts live in [`docs-site/examples/`](docs-site/examples).
|
|
155
71
|
|
|
156
72
|
## Development
|
|
157
73
|
|
|
158
74
|
```bash
|
|
159
75
|
npm install
|
|
160
76
|
npm run build # tsup (CJS + ESM + .d.ts)
|
|
161
|
-
npm run test # vitest
|
|
77
|
+
npm run test # vitest
|
|
162
78
|
npm run lint # eslint
|
|
163
79
|
npm run typecheck # tsc --noEmit
|
|
164
80
|
```
|