@cdot65/prisma-airs-sdk 0.12.0 → 0.13.0
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 +629 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1438 -91
- package/dist/index.d.ts +1438 -91
- package/dist/index.js +604 -24
- package/dist/index.js.map +1 -1
- package/package.json +4 -22
package/dist/index.js
CHANGED
|
@@ -29,7 +29,7 @@ var MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 5;
|
|
|
29
29
|
var MAX_CONNECTION_POOL_SIZE = 100;
|
|
30
30
|
var MAX_NUMBER_OF_RETRIES = 5;
|
|
31
31
|
var HTTP_FORCE_RETRY_STATUS_CODES = [500, 502, 503, 504];
|
|
32
|
-
var SDK_VERSION = "0.
|
|
32
|
+
var SDK_VERSION = "0.13.0";
|
|
33
33
|
var USER_AGENT = `PAN-AIRS/${SDK_VERSION}-typescript-sdk`;
|
|
34
34
|
var DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
|
|
35
35
|
var DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
|
|
@@ -75,17 +75,21 @@ var MODEL_SEC_TOKEN_ENDPOINT = "PANW_MODEL_SEC_TOKEN_ENDPOINT";
|
|
|
75
75
|
var MODEL_SEC_SCANS_PATH = "/v1/scans";
|
|
76
76
|
var MODEL_SEC_EVALUATIONS_PATH = "/v1/evaluations";
|
|
77
77
|
var MODEL_SEC_VIOLATIONS_PATH = "/v1/violations";
|
|
78
|
+
var MODEL_SEC_MODELS_PATH = "/v1/models";
|
|
79
|
+
var MODEL_SEC_MODEL_VERSIONS_PATH = "/v1/model-versions";
|
|
78
80
|
var MODEL_SEC_SECURITY_GROUPS_PATH = "/v1/security-groups";
|
|
79
81
|
var MODEL_SEC_SECURITY_RULES_PATH = "/v1/security-rules";
|
|
80
82
|
var MODEL_SEC_PYPI_AUTH_PATH = "/v1/pypi/authenticate";
|
|
81
83
|
var DEFAULT_RED_TEAM_DATA_ENDPOINT = "https://api.sase.paloaltonetworks.com/ai-red-teaming/data-plane";
|
|
82
84
|
var DEFAULT_RED_TEAM_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/ai-red-teaming/mgmt-plane";
|
|
85
|
+
var DEFAULT_RED_TEAM_NETWORK_BROKER_ENDPOINT = "https://api.sase.paloaltonetworks.com/ai-red-teaming/data-plane/network-broker";
|
|
83
86
|
var RED_TEAM_CLIENT_ID = "PANW_RED_TEAM_CLIENT_ID";
|
|
84
87
|
var RED_TEAM_CLIENT_SECRET = "PANW_RED_TEAM_CLIENT_SECRET";
|
|
85
88
|
var RED_TEAM_TSG_ID = "PANW_RED_TEAM_TSG_ID";
|
|
86
89
|
var RED_TEAM_DATA_ENDPOINT = "PANW_RED_TEAM_DATA_ENDPOINT";
|
|
87
90
|
var RED_TEAM_MGMT_ENDPOINT = "PANW_RED_TEAM_MGMT_ENDPOINT";
|
|
88
91
|
var RED_TEAM_TOKEN_ENDPOINT = "PANW_RED_TEAM_TOKEN_ENDPOINT";
|
|
92
|
+
var RED_TEAM_NETWORK_BROKER_ENDPOINT = "PANW_RED_TEAM_NETWORK_BROKER_ENDPOINT";
|
|
89
93
|
var RED_TEAM_SCAN_PATH = "/v1/scan";
|
|
90
94
|
var RED_TEAM_CATEGORIES_PATH = "/v1/categories";
|
|
91
95
|
var RED_TEAM_REPORT_STATIC_PATH = "/v1/report/static";
|
|
@@ -96,6 +100,8 @@ var RED_TEAM_DASHBOARD_PATH = "/v1/dashboard";
|
|
|
96
100
|
var RED_TEAM_QUOTA_PATH = "/v1/metering/quota";
|
|
97
101
|
var RED_TEAM_ERROR_LOG_PATH = "/v1/error-log/job";
|
|
98
102
|
var RED_TEAM_SENTIMENT_PATH = "/v1/sentiment";
|
|
103
|
+
var RED_TEAM_LANGUAGES_PATH = "/v1/languages";
|
|
104
|
+
var RED_TEAM_ERROR_LOG_TARGET_PROFILE_PATH = "/v1/error-log/target-profile";
|
|
99
105
|
var RED_TEAM_TARGET_PATH = "/v1/target";
|
|
100
106
|
var RED_TEAM_TARGET_VALIDATE_AUTH_PATH = "/v1/target/validate-auth";
|
|
101
107
|
var RED_TEAM_TEMPLATE_PATH = "/v1/template";
|
|
@@ -104,6 +110,8 @@ var RED_TEAM_INSTANCES_PATH = "/v1/instances";
|
|
|
104
110
|
var RED_TEAM_REGISTRY_CREDENTIALS_PATH = "/v1/registry-credentials";
|
|
105
111
|
var RED_TEAM_CUSTOM_ATTACK_PATH = "/v1/custom-attack";
|
|
106
112
|
var RED_TEAM_MGMT_DASHBOARD_PATH = "/v1/dashboard/overview";
|
|
113
|
+
var RED_TEAM_CHANNELS_PATH = "/v1/channels";
|
|
114
|
+
var RED_TEAM_CHANNELS_STATS_PATH = "/v1/channels/stats";
|
|
107
115
|
|
|
108
116
|
// src/errors.ts
|
|
109
117
|
var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
|
|
@@ -308,9 +316,38 @@ async function executeWithRetry(opts) {
|
|
|
308
316
|
);
|
|
309
317
|
}
|
|
310
318
|
|
|
319
|
+
// src/http/debug.ts
|
|
320
|
+
import { createHash } from "crypto";
|
|
321
|
+
var TRUTHY = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
322
|
+
var SENSITIVE_HEADERS = /* @__PURE__ */ new Set([HEADER_AUTH_TOKEN.toLowerCase(), HEADER_API_KEY.toLowerCase()]);
|
|
323
|
+
var PREFIX = "[airs-sdk]";
|
|
324
|
+
function isDebugEnabled() {
|
|
325
|
+
const raw = process.env.PANW_AI_SEC_DEBUG;
|
|
326
|
+
return raw !== void 0 && TRUTHY.has(raw.trim().toLowerCase());
|
|
327
|
+
}
|
|
328
|
+
function hashToken(value) {
|
|
329
|
+
return "sha256:" + createHash("sha256").update(value).digest("hex").slice(0, 12);
|
|
330
|
+
}
|
|
331
|
+
function sanitizeHeaders(headers) {
|
|
332
|
+
const out = {};
|
|
333
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
334
|
+
out[key] = SENSITIVE_HEADERS.has(key.toLowerCase()) ? hashToken(value) : value;
|
|
335
|
+
}
|
|
336
|
+
return out;
|
|
337
|
+
}
|
|
338
|
+
function logRequest(method, url, headers, body) {
|
|
339
|
+
console.error(`${PREFIX} \u2192 ${method} ${url}`);
|
|
340
|
+
console.error(`${PREFIX} headers ${JSON.stringify(sanitizeHeaders(headers))}`);
|
|
341
|
+
if (body !== void 0) console.error(`${PREFIX} body ${body}`);
|
|
342
|
+
}
|
|
343
|
+
function logResponse(status, ms, body) {
|
|
344
|
+
console.error(`${PREFIX} \u2190 ${status} (${ms}ms)${body !== void 0 ? ` ${body}` : ""}`);
|
|
345
|
+
}
|
|
346
|
+
|
|
311
347
|
// src/http/request.ts
|
|
312
348
|
async function request(spec) {
|
|
313
349
|
let hasRetriedAuth = false;
|
|
350
|
+
const debug = isDebugEnabled();
|
|
314
351
|
const response = await executeWithRetry({
|
|
315
352
|
maxRetries: spec.numRetries,
|
|
316
353
|
execute: async () => {
|
|
@@ -340,11 +377,25 @@ async function request(spec) {
|
|
|
340
377
|
}
|
|
341
378
|
const prepared = { method: spec.method, url, headers, bodyText };
|
|
342
379
|
const final = await spec.auth.prepare(prepared);
|
|
343
|
-
|
|
380
|
+
const startedAt = debug ? Date.now() : 0;
|
|
381
|
+
if (debug) {
|
|
382
|
+
const logBody = spec.formData !== void 0 ? "[multipart/form-data]" : final.bodyText;
|
|
383
|
+
logRequest(final.method, final.url.toString(), final.headers, logBody);
|
|
384
|
+
}
|
|
385
|
+
const res = await fetch(final.url.toString(), {
|
|
344
386
|
method: final.method,
|
|
345
387
|
headers: final.headers,
|
|
346
388
|
body: spec.formData !== void 0 ? bodyForFetch : final.bodyText
|
|
347
389
|
});
|
|
390
|
+
if (debug) {
|
|
391
|
+
let respBody;
|
|
392
|
+
try {
|
|
393
|
+
respBody = await res.clone().text();
|
|
394
|
+
} catch {
|
|
395
|
+
}
|
|
396
|
+
logResponse(res.status, Date.now() - startedAt, respBody);
|
|
397
|
+
}
|
|
398
|
+
return res;
|
|
348
399
|
},
|
|
349
400
|
onRetryableFailure: async (res) => {
|
|
350
401
|
if (hasRetriedAuth) return false;
|
|
@@ -2306,7 +2357,8 @@ var ScanDetailsSchema = z32.object({
|
|
|
2306
2357
|
var ScanCreateRequestSchema = z32.object({
|
|
2307
2358
|
model_uri: z32.string(),
|
|
2308
2359
|
security_group_uuid: z32.string(),
|
|
2309
|
-
|
|
2360
|
+
// Optional per the OpenAPI spec (server defaults it); the scans-client example still sets it.
|
|
2361
|
+
scan_origin: z32.string().optional(),
|
|
2310
2362
|
allow_patterns: z32.array(z32.string()).nullable().optional(),
|
|
2311
2363
|
ignore_patterns: z32.array(z32.string()).nullable().optional(),
|
|
2312
2364
|
labels: z32.array(LabelSchema).nullable().optional(),
|
|
@@ -2325,7 +2377,8 @@ var ScanBaseResponseSchema = z32.object({
|
|
|
2325
2377
|
scan_origin: z32.string(),
|
|
2326
2378
|
security_group_uuid: z32.string(),
|
|
2327
2379
|
security_group_name: z32.string(),
|
|
2328
|
-
|
|
2380
|
+
// Optional per the OpenAPI spec — a scan may not have a resolved model version yet.
|
|
2381
|
+
model_version_uuid: z32.string().nullable().optional(),
|
|
2329
2382
|
eval_outcome: z32.string(),
|
|
2330
2383
|
source_type: z32.string(),
|
|
2331
2384
|
created_by: z32.string().nullable().optional(),
|
|
@@ -2362,6 +2415,50 @@ var FileListSchema = z32.object({
|
|
|
2362
2415
|
pagination: ModelSecurityPaginationSchema,
|
|
2363
2416
|
files: z32.array(FileResponseSchema)
|
|
2364
2417
|
}).passthrough();
|
|
2418
|
+
var ModelResponseSchema = z32.object({
|
|
2419
|
+
uuid: z32.string(),
|
|
2420
|
+
tsg_id: z32.string(),
|
|
2421
|
+
created_at: z32.string(),
|
|
2422
|
+
updated_at: z32.string(),
|
|
2423
|
+
name: z32.string(),
|
|
2424
|
+
latest_version_uuid: z32.string().nullable().optional(),
|
|
2425
|
+
latest_version_fingerprint: z32.string().nullable().optional(),
|
|
2426
|
+
latest_version_revision: z32.string().nullable().optional(),
|
|
2427
|
+
latest_version_hf_commit_sha: z32.string().nullable().optional(),
|
|
2428
|
+
latest_version_outcome: z32.string().nullable().optional(),
|
|
2429
|
+
latest_version_formats: z32.array(z32.string()).nullable().optional(),
|
|
2430
|
+
latest_version_source_types: z32.array(z32.string()).nullable().optional(),
|
|
2431
|
+
latest_version_scan_time: z32.string().nullable().optional()
|
|
2432
|
+
}).passthrough();
|
|
2433
|
+
var ModelListSchema = z32.object({
|
|
2434
|
+
pagination: ModelSecurityPaginationSchema,
|
|
2435
|
+
models: z32.array(ModelResponseSchema)
|
|
2436
|
+
}).passthrough();
|
|
2437
|
+
var ModelVersionResponseSchema = z32.object({
|
|
2438
|
+
uuid: z32.string(),
|
|
2439
|
+
tsg_id: z32.string(),
|
|
2440
|
+
created_at: z32.string(),
|
|
2441
|
+
updated_at: z32.string(),
|
|
2442
|
+
revision: z32.string(),
|
|
2443
|
+
model_uuid: z32.string(),
|
|
2444
|
+
fingerprint: z32.string().nullable().optional(),
|
|
2445
|
+
file_count: z32.number().int().nullable().optional(),
|
|
2446
|
+
license: z32.string().nullable().optional(),
|
|
2447
|
+
latest_scan_time: z32.string().nullable().optional(),
|
|
2448
|
+
hf_commit_sha: z32.string().nullable().optional(),
|
|
2449
|
+
hf_commit_title: z32.string().nullable().optional(),
|
|
2450
|
+
hf_commit_authors: z32.array(z32.string()).nullable().optional(),
|
|
2451
|
+
hf_model_name: z32.string().nullable().optional(),
|
|
2452
|
+
hf_organization: z32.string().nullable().optional(),
|
|
2453
|
+
model_formats: z32.array(z32.string()).nullable().optional(),
|
|
2454
|
+
source_types: z32.array(z32.string()).nullable().optional(),
|
|
2455
|
+
last_eval_outcome: z32.string().nullable().optional(),
|
|
2456
|
+
last_eval_summary: EvalSummarySchema.nullable().optional()
|
|
2457
|
+
}).passthrough();
|
|
2458
|
+
var ModelVersionListSchema = z32.object({
|
|
2459
|
+
pagination: ModelSecurityPaginationSchema,
|
|
2460
|
+
model_versions: z32.array(ModelVersionResponseSchema)
|
|
2461
|
+
}).passthrough();
|
|
2365
2462
|
var RuleEvaluationResponseSchema = z32.object({
|
|
2366
2463
|
uuid: z32.string(),
|
|
2367
2464
|
tsg_id: z32.string(),
|
|
@@ -2379,6 +2476,10 @@ var RuleEvaluationListSchema = z32.object({
|
|
|
2379
2476
|
pagination: ModelSecurityPaginationSchema,
|
|
2380
2477
|
evaluations: z32.array(RuleEvaluationResponseSchema)
|
|
2381
2478
|
}).passthrough();
|
|
2479
|
+
var ViolationRemediationSchema = z32.object({
|
|
2480
|
+
steps: z32.array(z32.string()),
|
|
2481
|
+
url: z32.string()
|
|
2482
|
+
}).passthrough();
|
|
2382
2483
|
var ViolationResponseSchema = z32.object({
|
|
2383
2484
|
uuid: z32.string(),
|
|
2384
2485
|
tsg_id: z32.string(),
|
|
@@ -2389,6 +2490,7 @@ var ViolationResponseSchema = z32.object({
|
|
|
2389
2490
|
rule_name: z32.string(),
|
|
2390
2491
|
rule_description: z32.string(),
|
|
2391
2492
|
rule_instance_state: z32.string(),
|
|
2493
|
+
remediation: ViolationRemediationSchema,
|
|
2392
2494
|
file: z32.string().nullable().optional(),
|
|
2393
2495
|
hash: z32.string().nullable().optional(),
|
|
2394
2496
|
module: z32.string().nullable().optional(),
|
|
@@ -2524,6 +2626,11 @@ var BrandSubCategory = {
|
|
|
2524
2626
|
DISCRIMINATING_CLAIMS: "DISCRIMINATING_CLAIMS",
|
|
2525
2627
|
POLITICAL_ENDORSEMENTS: "POLITICAL_ENDORSEMENTS"
|
|
2526
2628
|
};
|
|
2629
|
+
var ChannelStatus = {
|
|
2630
|
+
ONLINE: "ONLINE",
|
|
2631
|
+
OFFLINE: "OFFLINE",
|
|
2632
|
+
DRAFT: "DRAFT"
|
|
2633
|
+
};
|
|
2527
2634
|
var ComplianceSubCategory = {
|
|
2528
2635
|
OWASP: "OWASP",
|
|
2529
2636
|
MITRE_ATLAS: "MITRE_ATLAS",
|
|
@@ -3347,6 +3454,12 @@ var ErrorLogSchema = z33.object({
|
|
|
3347
3454
|
version: z33.number().int().optional()
|
|
3348
3455
|
}).passthrough();
|
|
3349
3456
|
var ErrorLogListResponseSchema = z33.object({ pagination: RedTeamPaginationSchema, data: z33.array(ErrorLogSchema) }).passthrough();
|
|
3457
|
+
var LanguageOptionSchema = z33.object({ code: z33.string(), name: z33.string() }).passthrough();
|
|
3458
|
+
var TenantLanguagesResponseSchema = z33.object({
|
|
3459
|
+
multilingual_enabled: z33.boolean(),
|
|
3460
|
+
supported_job_types: z33.array(z33.string()),
|
|
3461
|
+
languages: z33.array(LanguageOptionSchema)
|
|
3462
|
+
}).passthrough();
|
|
3350
3463
|
var TargetRequestBaseFields = {
|
|
3351
3464
|
name: z33.string(),
|
|
3352
3465
|
description: z33.string().nullable().optional(),
|
|
@@ -3701,6 +3814,48 @@ var RegistryCredentialsSchema = z33.object({
|
|
|
3701
3814
|
expiry: z33.string()
|
|
3702
3815
|
}).passthrough();
|
|
3703
3816
|
|
|
3817
|
+
// src/models/red-team-network-broker.ts
|
|
3818
|
+
import { z as z34 } from "zod";
|
|
3819
|
+
var ChannelStatusSchema = z34.nativeEnum(ChannelStatus);
|
|
3820
|
+
var CreateChannelRequestSchema = z34.object({
|
|
3821
|
+
name: z34.string(),
|
|
3822
|
+
description: z34.string().optional()
|
|
3823
|
+
}).passthrough();
|
|
3824
|
+
var UpdateChannelRequestSchema = z34.object({
|
|
3825
|
+
name: z34.string().optional(),
|
|
3826
|
+
description: z34.string().optional()
|
|
3827
|
+
}).passthrough();
|
|
3828
|
+
var ChannelSchema = z34.object({
|
|
3829
|
+
uuid: z34.string().optional(),
|
|
3830
|
+
name: z34.string().nullable().optional(),
|
|
3831
|
+
description: z34.string().nullable().optional(),
|
|
3832
|
+
// Kept as a plain string (not the enum) so unknown upstream statuses never fail parsing.
|
|
3833
|
+
status: z34.string().nullable().optional(),
|
|
3834
|
+
added_by: z34.string().nullable().optional(),
|
|
3835
|
+
created_at: z34.string().nullable().optional(),
|
|
3836
|
+
updated_at: z34.string().nullable().optional(),
|
|
3837
|
+
last_online_at: z34.string().nullable().optional(),
|
|
3838
|
+
// Present on live responses (not in the base OpenAPI Channel schema).
|
|
3839
|
+
connected_clients_count: z34.number().int().nullable().optional(),
|
|
3840
|
+
outdated_clients_count: z34.number().int().nullable().optional(),
|
|
3841
|
+
features: z34.record(z34.boolean()).nullable().optional()
|
|
3842
|
+
}).passthrough();
|
|
3843
|
+
var ChannelListPaginationSchema = z34.object({ total_items: z34.number().int().nullable().optional() }).passthrough();
|
|
3844
|
+
var ChannelListResponseSchema = z34.object({
|
|
3845
|
+
pagination: ChannelListPaginationSchema.optional(),
|
|
3846
|
+
data: z34.array(ChannelSchema).default([])
|
|
3847
|
+
}).passthrough();
|
|
3848
|
+
var ChannelStatsSchema = z34.object({
|
|
3849
|
+
network_channels_server_domain: z34.string().nullable().optional(),
|
|
3850
|
+
docker_registry: z34.string().nullable().optional(),
|
|
3851
|
+
helm_chart: z34.string().nullable().optional(),
|
|
3852
|
+
docker_image: z34.string().nullable().optional(),
|
|
3853
|
+
online_channels: z34.number().int().nullable().optional(),
|
|
3854
|
+
total_channels: z34.number().int().nullable().optional(),
|
|
3855
|
+
// Present on live responses (not in the base OpenAPI ChannelStats schema).
|
|
3856
|
+
client_version: z34.string().nullable().optional()
|
|
3857
|
+
}).passthrough();
|
|
3858
|
+
|
|
3704
3859
|
// src/http/auth/oauth.ts
|
|
3705
3860
|
var OAuthAuth = class {
|
|
3706
3861
|
constructor(oauthClient) {
|
|
@@ -3723,12 +3878,12 @@ var OAuthAuth = class {
|
|
|
3723
3878
|
};
|
|
3724
3879
|
|
|
3725
3880
|
// src/models/oauth-token.ts
|
|
3726
|
-
import { z as
|
|
3727
|
-
var OAuthTokenResponseSchema =
|
|
3728
|
-
access_token:
|
|
3729
|
-
token_type:
|
|
3730
|
-
expires_in:
|
|
3731
|
-
scope:
|
|
3881
|
+
import { z as z35 } from "zod";
|
|
3882
|
+
var OAuthTokenResponseSchema = z35.object({
|
|
3883
|
+
access_token: z35.string(),
|
|
3884
|
+
token_type: z35.string().optional(),
|
|
3885
|
+
expires_in: z35.number(),
|
|
3886
|
+
scope: z35.string().optional()
|
|
3732
3887
|
}).passthrough();
|
|
3733
3888
|
|
|
3734
3889
|
// src/management/oauth-client.ts
|
|
@@ -4519,7 +4674,7 @@ var CustomerAppsClient = class {
|
|
|
4519
4674
|
return request({
|
|
4520
4675
|
method: "GET",
|
|
4521
4676
|
baseUrl: this.baseUrl,
|
|
4522
|
-
path: `${MGMT_CUSTOMER_APPS_TSG_PATH}/${this.tsgId}`,
|
|
4677
|
+
path: `${MGMT_CUSTOMER_APPS_TSG_PATH}/${encodeURIComponent(this.tsgId)}`,
|
|
4523
4678
|
params,
|
|
4524
4679
|
responseSchema: CustomerAppListResponseSchema,
|
|
4525
4680
|
auth: this.auth,
|
|
@@ -4713,7 +4868,7 @@ var ScanLogsClient = class {
|
|
|
4713
4868
|
};
|
|
4714
4869
|
|
|
4715
4870
|
// src/management/oauth-management.ts
|
|
4716
|
-
import { z as
|
|
4871
|
+
import { z as z36 } from "zod";
|
|
4717
4872
|
var OAuthManagementClient = class {
|
|
4718
4873
|
baseUrl;
|
|
4719
4874
|
auth;
|
|
@@ -4747,7 +4902,7 @@ var OAuthManagementClient = class {
|
|
|
4747
4902
|
path: MGMT_OAUTH_INVALIDATE_PATH,
|
|
4748
4903
|
params: { token },
|
|
4749
4904
|
body,
|
|
4750
|
-
responseSchema:
|
|
4905
|
+
responseSchema: z36.string(),
|
|
4751
4906
|
auth: this.auth,
|
|
4752
4907
|
numRetries: this.numRetries
|
|
4753
4908
|
});
|
|
@@ -6375,6 +6530,170 @@ var ModelSecurityRulesClient = class {
|
|
|
6375
6530
|
}
|
|
6376
6531
|
};
|
|
6377
6532
|
|
|
6533
|
+
// src/model-security/models-client.ts
|
|
6534
|
+
function buildModelListParams(opts) {
|
|
6535
|
+
const params = serializeListing(opts);
|
|
6536
|
+
if (opts?.search_query !== void 0) params.search_query = opts.search_query;
|
|
6537
|
+
if (opts?.sort_field !== void 0) params.sort_field = opts.sort_field;
|
|
6538
|
+
if (opts?.sort_order !== void 0) params.sort_order = opts.sort_order;
|
|
6539
|
+
if (opts?.latest_version_outcomes !== void 0)
|
|
6540
|
+
params.latest_version_outcomes = opts.latest_version_outcomes;
|
|
6541
|
+
if (opts?.latest_version_formats !== void 0)
|
|
6542
|
+
params.latest_version_formats = opts.latest_version_formats;
|
|
6543
|
+
if (opts?.latest_version_source_types !== void 0)
|
|
6544
|
+
params.latest_version_source_types = opts.latest_version_source_types;
|
|
6545
|
+
if (opts?.latest_version_scan_time_before !== void 0)
|
|
6546
|
+
params.latest_version_scan_time_before = opts.latest_version_scan_time_before;
|
|
6547
|
+
if (opts?.start_time !== void 0) params.start_time = opts.start_time;
|
|
6548
|
+
if (opts?.end_time !== void 0) params.end_time = opts.end_time;
|
|
6549
|
+
return params;
|
|
6550
|
+
}
|
|
6551
|
+
var ModelSecurityModelsClient = class {
|
|
6552
|
+
baseUrl;
|
|
6553
|
+
auth;
|
|
6554
|
+
numRetries;
|
|
6555
|
+
constructor(opts) {
|
|
6556
|
+
this.baseUrl = opts.baseUrl;
|
|
6557
|
+
this.auth = opts.auth;
|
|
6558
|
+
this.numRetries = opts.numRetries;
|
|
6559
|
+
}
|
|
6560
|
+
/**
|
|
6561
|
+
* List models with optional search, sort, and latest-version filters.
|
|
6562
|
+
* @param opts - Pagination and filter options.
|
|
6563
|
+
* @returns Paginated list of models.
|
|
6564
|
+
* @example
|
|
6565
|
+
* ```ts
|
|
6566
|
+
* import { ModelSecurityClient } from '@cdot65/prisma-airs-sdk';
|
|
6567
|
+
* const ms = new ModelSecurityClient();
|
|
6568
|
+
*
|
|
6569
|
+
* const models = await ms.models.listModels({ limit: 10, search_query: 'llama' });
|
|
6570
|
+
* // models =>
|
|
6571
|
+
* // { pagination: { total_items: 3 }, models: [{ uuid: '550e8400-...', name: 'org/llama', latest_version_outcome: 'PASSED' }] }
|
|
6572
|
+
* ```
|
|
6573
|
+
*/
|
|
6574
|
+
async listModels(opts) {
|
|
6575
|
+
return request({
|
|
6576
|
+
method: "GET",
|
|
6577
|
+
baseUrl: this.baseUrl,
|
|
6578
|
+
path: MODEL_SEC_MODELS_PATH,
|
|
6579
|
+
params: buildModelListParams(opts),
|
|
6580
|
+
responseSchema: ModelListSchema,
|
|
6581
|
+
auth: this.auth,
|
|
6582
|
+
numRetries: this.numRetries
|
|
6583
|
+
});
|
|
6584
|
+
}
|
|
6585
|
+
/**
|
|
6586
|
+
* Get a single model by UUID.
|
|
6587
|
+
* @param uuid - Model UUID.
|
|
6588
|
+
* @returns The model.
|
|
6589
|
+
* @example
|
|
6590
|
+
* ```ts
|
|
6591
|
+
* import { ModelSecurityClient } from '@cdot65/prisma-airs-sdk';
|
|
6592
|
+
* const ms = new ModelSecurityClient();
|
|
6593
|
+
*
|
|
6594
|
+
* const model = await ms.models.getModel('550e8400-e29b-41d4-a716-446655440000');
|
|
6595
|
+
* // model =>
|
|
6596
|
+
* // { uuid: '550e8400-...', name: 'org/model', latest_version_uuid: '660e8400-...', latest_version_outcome: 'PASSED' }
|
|
6597
|
+
* ```
|
|
6598
|
+
*/
|
|
6599
|
+
async getModel(uuid) {
|
|
6600
|
+
assertUuid(uuid, "model uuid");
|
|
6601
|
+
return request({
|
|
6602
|
+
method: "GET",
|
|
6603
|
+
baseUrl: this.baseUrl,
|
|
6604
|
+
path: `${MODEL_SEC_MODELS_PATH}/${uuid}`,
|
|
6605
|
+
responseSchema: ModelResponseSchema,
|
|
6606
|
+
auth: this.auth,
|
|
6607
|
+
numRetries: this.numRetries
|
|
6608
|
+
});
|
|
6609
|
+
}
|
|
6610
|
+
/**
|
|
6611
|
+
* List the versions of a model.
|
|
6612
|
+
* @param modelUuid - Model UUID.
|
|
6613
|
+
* @param opts - Pagination and sort options.
|
|
6614
|
+
* @returns Paginated list of model versions.
|
|
6615
|
+
* @example
|
|
6616
|
+
* ```ts
|
|
6617
|
+
* import { ModelSecurityClient } from '@cdot65/prisma-airs-sdk';
|
|
6618
|
+
* const ms = new ModelSecurityClient();
|
|
6619
|
+
*
|
|
6620
|
+
* const versions = await ms.models.listModelVersions('550e8400-e29b-41d4-a716-446655440000', {
|
|
6621
|
+
* sort_order: 'desc',
|
|
6622
|
+
* });
|
|
6623
|
+
* // versions =>
|
|
6624
|
+
* // { pagination: { total_items: 2 }, model_versions: [{ uuid: '660e8400-...', revision: 'main', file_count: 12 }] }
|
|
6625
|
+
* ```
|
|
6626
|
+
*/
|
|
6627
|
+
async listModelVersions(modelUuid, opts) {
|
|
6628
|
+
assertUuid(modelUuid, "model uuid");
|
|
6629
|
+
const params = serializeListing(opts);
|
|
6630
|
+
if (opts?.sort_order !== void 0) params.sort_order = opts.sort_order;
|
|
6631
|
+
return request({
|
|
6632
|
+
method: "GET",
|
|
6633
|
+
baseUrl: this.baseUrl,
|
|
6634
|
+
path: `${MODEL_SEC_MODELS_PATH}/${modelUuid}/model-versions`,
|
|
6635
|
+
params,
|
|
6636
|
+
responseSchema: ModelVersionListSchema,
|
|
6637
|
+
auth: this.auth,
|
|
6638
|
+
numRetries: this.numRetries
|
|
6639
|
+
});
|
|
6640
|
+
}
|
|
6641
|
+
/**
|
|
6642
|
+
* Get a single model version by UUID.
|
|
6643
|
+
* @param uuid - Model version UUID.
|
|
6644
|
+
* @returns The model version.
|
|
6645
|
+
* @example
|
|
6646
|
+
* ```ts
|
|
6647
|
+
* import { ModelSecurityClient } from '@cdot65/prisma-airs-sdk';
|
|
6648
|
+
* const ms = new ModelSecurityClient();
|
|
6649
|
+
*
|
|
6650
|
+
* const version = await ms.models.getModelVersion('660e8400-e29b-41d4-a716-446655440000');
|
|
6651
|
+
* // version =>
|
|
6652
|
+
* // { uuid: '660e8400-...', revision: 'main', model_uuid: '550e8400-...', last_eval_outcome: 'PASSED' }
|
|
6653
|
+
* ```
|
|
6654
|
+
*/
|
|
6655
|
+
async getModelVersion(uuid) {
|
|
6656
|
+
assertUuid(uuid, "model version uuid");
|
|
6657
|
+
return request({
|
|
6658
|
+
method: "GET",
|
|
6659
|
+
baseUrl: this.baseUrl,
|
|
6660
|
+
path: `${MODEL_SEC_MODEL_VERSIONS_PATH}/${uuid}`,
|
|
6661
|
+
responseSchema: ModelVersionResponseSchema,
|
|
6662
|
+
auth: this.auth,
|
|
6663
|
+
numRetries: this.numRetries
|
|
6664
|
+
});
|
|
6665
|
+
}
|
|
6666
|
+
/**
|
|
6667
|
+
* List the files of a model version.
|
|
6668
|
+
* @param modelVersionUuid - Model version UUID.
|
|
6669
|
+
* @param opts - Pagination options.
|
|
6670
|
+
* @returns Paginated list of files (same shape as scan files).
|
|
6671
|
+
* @example
|
|
6672
|
+
* ```ts
|
|
6673
|
+
* import { ModelSecurityClient } from '@cdot65/prisma-airs-sdk';
|
|
6674
|
+
* const ms = new ModelSecurityClient();
|
|
6675
|
+
*
|
|
6676
|
+
* const files = await ms.models.listModelVersionFiles('660e8400-e29b-41d4-a716-446655440000', {
|
|
6677
|
+
* limit: 50,
|
|
6678
|
+
* });
|
|
6679
|
+
* // files =>
|
|
6680
|
+
* // { pagination: { total_items: 12 }, files: [{ uuid: '770e8400-...', path: '/model.safetensors', type: 'FILE', result: 'SUCCESS' }] }
|
|
6681
|
+
* ```
|
|
6682
|
+
*/
|
|
6683
|
+
async listModelVersionFiles(modelVersionUuid, opts) {
|
|
6684
|
+
assertUuid(modelVersionUuid, "model version uuid");
|
|
6685
|
+
return request({
|
|
6686
|
+
method: "GET",
|
|
6687
|
+
baseUrl: this.baseUrl,
|
|
6688
|
+
path: `${MODEL_SEC_MODEL_VERSIONS_PATH}/${modelVersionUuid}/files`,
|
|
6689
|
+
params: serializeListing(opts),
|
|
6690
|
+
responseSchema: FileListSchema,
|
|
6691
|
+
auth: this.auth,
|
|
6692
|
+
numRetries: this.numRetries
|
|
6693
|
+
});
|
|
6694
|
+
}
|
|
6695
|
+
};
|
|
6696
|
+
|
|
6378
6697
|
// src/model-security/client.ts
|
|
6379
6698
|
var ModelSecurityClient = class {
|
|
6380
6699
|
/** Data plane scan operations. */
|
|
@@ -6383,6 +6702,8 @@ var ModelSecurityClient = class {
|
|
|
6383
6702
|
securityGroups;
|
|
6384
6703
|
/** Management plane security rule operations (read-only). */
|
|
6385
6704
|
securityRules;
|
|
6705
|
+
/** Data plane model and model-version operations (read-only). */
|
|
6706
|
+
models;
|
|
6386
6707
|
mgmtEndpoint;
|
|
6387
6708
|
auth;
|
|
6388
6709
|
numRetries;
|
|
@@ -6404,6 +6725,7 @@ var ModelSecurityClient = class {
|
|
|
6404
6725
|
this.mgmtEndpoint = mgmtEndpoint;
|
|
6405
6726
|
this.numRetries = numRetries;
|
|
6406
6727
|
this.scans = new ModelSecurityScansClient({ baseUrl: dataEndpoint, auth, numRetries });
|
|
6728
|
+
this.models = new ModelSecurityModelsClient({ baseUrl: dataEndpoint, auth, numRetries });
|
|
6407
6729
|
this.securityGroups = new ModelSecurityGroupsClient({
|
|
6408
6730
|
baseUrl: mgmtEndpoint,
|
|
6409
6731
|
auth,
|
|
@@ -6441,7 +6763,7 @@ var ModelSecurityClient = class {
|
|
|
6441
6763
|
};
|
|
6442
6764
|
|
|
6443
6765
|
// src/red-team/scans-client.ts
|
|
6444
|
-
import { z as
|
|
6766
|
+
import { z as z37 } from "zod";
|
|
6445
6767
|
var RedTeamScansClient = class {
|
|
6446
6768
|
baseUrl;
|
|
6447
6769
|
auth;
|
|
@@ -6578,7 +6900,7 @@ var RedTeamScansClient = class {
|
|
|
6578
6900
|
method: "GET",
|
|
6579
6901
|
baseUrl: this.baseUrl,
|
|
6580
6902
|
path: RED_TEAM_CATEGORIES_PATH,
|
|
6581
|
-
responseSchema:
|
|
6903
|
+
responseSchema: z37.array(CategoryModelSchema),
|
|
6582
6904
|
auth: this.auth,
|
|
6583
6905
|
numRetries: this.numRetries
|
|
6584
6906
|
});
|
|
@@ -6586,7 +6908,7 @@ var RedTeamScansClient = class {
|
|
|
6586
6908
|
};
|
|
6587
6909
|
|
|
6588
6910
|
// src/red-team/reports-client.ts
|
|
6589
|
-
import { z as
|
|
6911
|
+
import { z as z38 } from "zod";
|
|
6590
6912
|
var RedTeamReportsClient = class {
|
|
6591
6913
|
baseUrl;
|
|
6592
6914
|
auth;
|
|
@@ -6961,7 +7283,7 @@ var RedTeamReportsClient = class {
|
|
|
6961
7283
|
baseUrl: this.baseUrl,
|
|
6962
7284
|
path: `${RED_TEAM_REPORT_PATH}/${jobId}/download`,
|
|
6963
7285
|
params: { file_format: format },
|
|
6964
|
-
responseSchema:
|
|
7286
|
+
responseSchema: z38.unknown(),
|
|
6965
7287
|
auth: this.auth,
|
|
6966
7288
|
numRetries: this.numRetries
|
|
6967
7289
|
});
|
|
@@ -6985,7 +7307,7 @@ var RedTeamReportsClient = class {
|
|
|
6985
7307
|
method: "POST",
|
|
6986
7308
|
baseUrl: this.baseUrl,
|
|
6987
7309
|
path: `${RED_TEAM_REPORT_PATH}/${jobId}/generate-partial-report`,
|
|
6988
|
-
responseSchema:
|
|
7310
|
+
responseSchema: z38.unknown(),
|
|
6989
7311
|
auth: this.auth,
|
|
6990
7312
|
numRetries: this.numRetries
|
|
6991
7313
|
});
|
|
@@ -6993,7 +7315,7 @@ var RedTeamReportsClient = class {
|
|
|
6993
7315
|
};
|
|
6994
7316
|
|
|
6995
7317
|
// src/red-team/custom-attack-reports-client.ts
|
|
6996
|
-
import { z as
|
|
7318
|
+
import { z as z39 } from "zod";
|
|
6997
7319
|
var RedTeamCustomAttackReportsClient = class {
|
|
6998
7320
|
baseUrl;
|
|
6999
7321
|
auth;
|
|
@@ -7083,7 +7405,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
7083
7405
|
baseUrl: this.baseUrl,
|
|
7084
7406
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/report/${jobId}/prompt-set/${promptSetId}/prompts`,
|
|
7085
7407
|
params,
|
|
7086
|
-
responseSchema:
|
|
7408
|
+
responseSchema: z39.array(PromptDetailResponseSchema),
|
|
7087
7409
|
auth: this.auth,
|
|
7088
7410
|
numRetries: this.numRetries
|
|
7089
7411
|
});
|
|
@@ -7177,7 +7499,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
7177
7499
|
method: "GET",
|
|
7178
7500
|
baseUrl: this.baseUrl,
|
|
7179
7501
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/job/${jobId}/attack/${attackId}/list-outputs`,
|
|
7180
|
-
responseSchema:
|
|
7502
|
+
responseSchema: z39.array(CustomAttackOutputSchema),
|
|
7181
7503
|
auth: this.auth,
|
|
7182
7504
|
numRetries: this.numRetries
|
|
7183
7505
|
});
|
|
@@ -7202,7 +7524,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
7202
7524
|
method: "GET",
|
|
7203
7525
|
baseUrl: this.baseUrl,
|
|
7204
7526
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/job/${jobId}/property-stats`,
|
|
7205
|
-
responseSchema:
|
|
7527
|
+
responseSchema: z39.array(PropertyStatisticSchema),
|
|
7206
7528
|
auth: this.auth,
|
|
7207
7529
|
numRetries: this.numRetries
|
|
7208
7530
|
});
|
|
@@ -7210,7 +7532,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
7210
7532
|
};
|
|
7211
7533
|
|
|
7212
7534
|
// src/red-team/targets-client.ts
|
|
7213
|
-
import { z as
|
|
7535
|
+
import { z as z40 } from "zod";
|
|
7214
7536
|
var RedTeamTargetsClient = class {
|
|
7215
7537
|
baseUrl;
|
|
7216
7538
|
auth;
|
|
@@ -7503,7 +7825,7 @@ var RedTeamTargetsClient = class {
|
|
|
7503
7825
|
method: "GET",
|
|
7504
7826
|
baseUrl: this.baseUrl,
|
|
7505
7827
|
path: `${RED_TEAM_TEMPLATE_PATH}/target-metadata`,
|
|
7506
|
-
responseSchema:
|
|
7828
|
+
responseSchema: z40.record(z40.unknown()),
|
|
7507
7829
|
auth: this.auth,
|
|
7508
7830
|
numRetries: this.numRetries
|
|
7509
7831
|
});
|
|
@@ -8452,6 +8774,155 @@ var RedTeamInstancesClient = class {
|
|
|
8452
8774
|
}
|
|
8453
8775
|
};
|
|
8454
8776
|
|
|
8777
|
+
// src/red-team/network-broker-client.ts
|
|
8778
|
+
var RedTeamNetworkBrokerClient = class {
|
|
8779
|
+
baseUrl;
|
|
8780
|
+
auth;
|
|
8781
|
+
numRetries;
|
|
8782
|
+
constructor(opts) {
|
|
8783
|
+
this.baseUrl = opts.baseUrl;
|
|
8784
|
+
this.auth = opts.auth;
|
|
8785
|
+
this.numRetries = opts.numRetries;
|
|
8786
|
+
}
|
|
8787
|
+
/**
|
|
8788
|
+
* List network broker channels with optional filters.
|
|
8789
|
+
* @param opts - Optional pagination, search, and status filter options.
|
|
8790
|
+
* @returns The paginated list of channels.
|
|
8791
|
+
* @example
|
|
8792
|
+
* ```ts
|
|
8793
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
8794
|
+
* const rt = new RedTeamClient();
|
|
8795
|
+
*
|
|
8796
|
+
* const channels = await rt.networkBroker.listChannels({ status: ['ONLINE', 'DRAFT'], limit: 10 });
|
|
8797
|
+
* // channels =>
|
|
8798
|
+
* // { pagination: { total_items: 2 }, data: [{ uuid: '550e8400-...', name: 'prod-broker', status: 'ONLINE' }] }
|
|
8799
|
+
* ```
|
|
8800
|
+
*/
|
|
8801
|
+
async listChannels(opts) {
|
|
8802
|
+
const params = serializeListing(opts);
|
|
8803
|
+
if (opts?.status !== void 0) {
|
|
8804
|
+
params.status = Array.isArray(opts.status) ? opts.status : [opts.status];
|
|
8805
|
+
}
|
|
8806
|
+
if (opts?.include_all_if_empty !== void 0) {
|
|
8807
|
+
params.include_all_if_empty = String(opts.include_all_if_empty);
|
|
8808
|
+
}
|
|
8809
|
+
return request({
|
|
8810
|
+
method: "GET",
|
|
8811
|
+
baseUrl: this.baseUrl,
|
|
8812
|
+
path: RED_TEAM_CHANNELS_PATH,
|
|
8813
|
+
params,
|
|
8814
|
+
responseSchema: ChannelListResponseSchema,
|
|
8815
|
+
auth: this.auth,
|
|
8816
|
+
numRetries: this.numRetries
|
|
8817
|
+
});
|
|
8818
|
+
}
|
|
8819
|
+
/**
|
|
8820
|
+
* Create a network broker channel.
|
|
8821
|
+
* @param body - Channel creation request body (requires `name`).
|
|
8822
|
+
* @returns The created channel.
|
|
8823
|
+
* @example
|
|
8824
|
+
* ```ts
|
|
8825
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
8826
|
+
* const rt = new RedTeamClient();
|
|
8827
|
+
*
|
|
8828
|
+
* const channel = await rt.networkBroker.createChannel({
|
|
8829
|
+
* name: 'prod-broker',
|
|
8830
|
+
* description: 'Production network broker channel',
|
|
8831
|
+
* });
|
|
8832
|
+
* // channel =>
|
|
8833
|
+
* // { uuid: '550e8400-...', name: 'prod-broker', status: 'DRAFT' }
|
|
8834
|
+
* ```
|
|
8835
|
+
*/
|
|
8836
|
+
async createChannel(body) {
|
|
8837
|
+
return request({
|
|
8838
|
+
method: "POST",
|
|
8839
|
+
baseUrl: this.baseUrl,
|
|
8840
|
+
path: RED_TEAM_CHANNELS_PATH,
|
|
8841
|
+
body,
|
|
8842
|
+
responseSchema: ChannelSchema,
|
|
8843
|
+
auth: this.auth,
|
|
8844
|
+
numRetries: this.numRetries
|
|
8845
|
+
});
|
|
8846
|
+
}
|
|
8847
|
+
/**
|
|
8848
|
+
* Get network broker channel stats.
|
|
8849
|
+
* @returns The channel stats (broker server, registry, chart, image, channel counts).
|
|
8850
|
+
* @example
|
|
8851
|
+
* ```ts
|
|
8852
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
8853
|
+
* const rt = new RedTeamClient();
|
|
8854
|
+
*
|
|
8855
|
+
* const stats = await rt.networkBroker.getChannelStats();
|
|
8856
|
+
* // stats =>
|
|
8857
|
+
* // { network_channels_server_domain: 'broker.example.com', online_channels: 3, total_channels: 5, client_version: '1.4.0' }
|
|
8858
|
+
* ```
|
|
8859
|
+
*/
|
|
8860
|
+
async getChannelStats() {
|
|
8861
|
+
return request({
|
|
8862
|
+
method: "GET",
|
|
8863
|
+
baseUrl: this.baseUrl,
|
|
8864
|
+
path: RED_TEAM_CHANNELS_STATS_PATH,
|
|
8865
|
+
responseSchema: ChannelStatsSchema,
|
|
8866
|
+
auth: this.auth,
|
|
8867
|
+
numRetries: this.numRetries
|
|
8868
|
+
});
|
|
8869
|
+
}
|
|
8870
|
+
/**
|
|
8871
|
+
* Get a network broker channel by UUID.
|
|
8872
|
+
* @param channelId - The channel UUID.
|
|
8873
|
+
* @returns The channel.
|
|
8874
|
+
* @example
|
|
8875
|
+
* ```ts
|
|
8876
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
8877
|
+
* const rt = new RedTeamClient();
|
|
8878
|
+
*
|
|
8879
|
+
* const channel = await rt.networkBroker.getChannel('550e8400-e29b-41d4-a716-446655440000');
|
|
8880
|
+
* // channel =>
|
|
8881
|
+
* // { uuid: '550e8400-...', name: 'prod-broker', status: 'ONLINE' }
|
|
8882
|
+
* ```
|
|
8883
|
+
*/
|
|
8884
|
+
async getChannel(channelId) {
|
|
8885
|
+
assertUuid(channelId, "channel id");
|
|
8886
|
+
return request({
|
|
8887
|
+
method: "GET",
|
|
8888
|
+
baseUrl: this.baseUrl,
|
|
8889
|
+
path: `${RED_TEAM_CHANNELS_PATH}/${channelId}`,
|
|
8890
|
+
responseSchema: ChannelSchema,
|
|
8891
|
+
auth: this.auth,
|
|
8892
|
+
numRetries: this.numRetries
|
|
8893
|
+
});
|
|
8894
|
+
}
|
|
8895
|
+
/**
|
|
8896
|
+
* Update a network broker channel's name or description.
|
|
8897
|
+
* @param channelId - The channel UUID.
|
|
8898
|
+
* @param body - Channel update request body.
|
|
8899
|
+
* @returns The updated channel.
|
|
8900
|
+
* @example
|
|
8901
|
+
* ```ts
|
|
8902
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
8903
|
+
* const rt = new RedTeamClient();
|
|
8904
|
+
*
|
|
8905
|
+
* const channel = await rt.networkBroker.updateChannel('550e8400-e29b-41d4-a716-446655440000', {
|
|
8906
|
+
* description: 'Updated description',
|
|
8907
|
+
* });
|
|
8908
|
+
* // channel =>
|
|
8909
|
+
* // { uuid: '550e8400-...', name: 'prod-broker', description: 'Updated description', status: 'ONLINE' }
|
|
8910
|
+
* ```
|
|
8911
|
+
*/
|
|
8912
|
+
async updateChannel(channelId, body) {
|
|
8913
|
+
assertUuid(channelId, "channel id");
|
|
8914
|
+
return request({
|
|
8915
|
+
method: "PATCH",
|
|
8916
|
+
baseUrl: this.baseUrl,
|
|
8917
|
+
path: `${RED_TEAM_CHANNELS_PATH}/${channelId}`,
|
|
8918
|
+
body,
|
|
8919
|
+
responseSchema: ChannelSchema,
|
|
8920
|
+
auth: this.auth,
|
|
8921
|
+
numRetries: this.numRetries
|
|
8922
|
+
});
|
|
8923
|
+
}
|
|
8924
|
+
};
|
|
8925
|
+
|
|
8455
8926
|
// src/red-team/client.ts
|
|
8456
8927
|
var RedTeamClient = class {
|
|
8457
8928
|
/** Data plane scan operations. */
|
|
@@ -8468,6 +8939,8 @@ var RedTeamClient = class {
|
|
|
8468
8939
|
eula;
|
|
8469
8940
|
/** Management plane instance/licensing operations. */
|
|
8470
8941
|
instances;
|
|
8942
|
+
/** Network broker channel operations (distinct network broker base URL). */
|
|
8943
|
+
networkBroker;
|
|
8471
8944
|
dataEndpoint;
|
|
8472
8945
|
mgmtEndpoint;
|
|
8473
8946
|
auth;
|
|
@@ -8475,6 +8948,7 @@ var RedTeamClient = class {
|
|
|
8475
8948
|
constructor(opts = {}) {
|
|
8476
8949
|
const dataEndpoint = opts.dataEndpoint ?? process.env[RED_TEAM_DATA_ENDPOINT] ?? DEFAULT_RED_TEAM_DATA_ENDPOINT;
|
|
8477
8950
|
const mgmtEndpoint = opts.mgmtEndpoint ?? process.env[RED_TEAM_MGMT_ENDPOINT] ?? DEFAULT_RED_TEAM_MGMT_ENDPOINT;
|
|
8951
|
+
const networkBrokerEndpoint = opts.networkBrokerEndpoint ?? process.env[RED_TEAM_NETWORK_BROKER_ENDPOINT] ?? DEFAULT_RED_TEAM_NETWORK_BROKER_ENDPOINT;
|
|
8478
8952
|
const { oauthClient, numRetries } = resolveOAuthConfig({
|
|
8479
8953
|
clientId: opts.clientId,
|
|
8480
8954
|
clientSecret: opts.clientSecret,
|
|
@@ -8505,6 +8979,11 @@ var RedTeamClient = class {
|
|
|
8505
8979
|
});
|
|
8506
8980
|
this.eula = new RedTeamEulaClient({ baseUrl: mgmtEndpoint, auth, numRetries });
|
|
8507
8981
|
this.instances = new RedTeamInstancesClient({ baseUrl: mgmtEndpoint, auth, numRetries });
|
|
8982
|
+
this.networkBroker = new RedTeamNetworkBrokerClient({
|
|
8983
|
+
baseUrl: networkBrokerEndpoint,
|
|
8984
|
+
auth,
|
|
8985
|
+
numRetries
|
|
8986
|
+
});
|
|
8508
8987
|
}
|
|
8509
8988
|
// -----------------------------------------------------------------------
|
|
8510
8989
|
// Data plane convenience methods
|
|
@@ -8613,6 +9092,82 @@ var RedTeamClient = class {
|
|
|
8613
9092
|
numRetries: this.numRetries
|
|
8614
9093
|
});
|
|
8615
9094
|
}
|
|
9095
|
+
/**
|
|
9096
|
+
* List profiling error logs for a target (data plane).
|
|
9097
|
+
* @param targetId - The target UUID.
|
|
9098
|
+
* @param opts - Optional pagination/search options (the endpoint honors `limit`).
|
|
9099
|
+
* @returns The paginated list of target-profile error logs.
|
|
9100
|
+
* @example
|
|
9101
|
+
* ```ts
|
|
9102
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
9103
|
+
* const rt = new RedTeamClient();
|
|
9104
|
+
*
|
|
9105
|
+
* const logs = await rt.getTargetProfileErrorLogs('550e8400-e29b-41d4-a716-446655440000', { limit: 10 });
|
|
9106
|
+
* // logs =>
|
|
9107
|
+
* // { pagination: { total_items: 1 }, data: [{ target_id: '550e8400-...', error_type: 'PROBE', error_message: '...', created_at: '2025-01-01T00:00:00Z' }] }
|
|
9108
|
+
* ```
|
|
9109
|
+
*/
|
|
9110
|
+
async getTargetProfileErrorLogs(targetId, opts) {
|
|
9111
|
+
assertUuid(targetId, "target id");
|
|
9112
|
+
return request({
|
|
9113
|
+
method: "GET",
|
|
9114
|
+
baseUrl: this.dataEndpoint,
|
|
9115
|
+
path: `${RED_TEAM_ERROR_LOG_TARGET_PROFILE_PATH}/${targetId}`,
|
|
9116
|
+
params: serializeListing(opts),
|
|
9117
|
+
responseSchema: ErrorLogListResponseSchema,
|
|
9118
|
+
auth: this.auth,
|
|
9119
|
+
numRetries: this.numRetries
|
|
9120
|
+
});
|
|
9121
|
+
}
|
|
9122
|
+
/**
|
|
9123
|
+
* Get the tenant's allowed languages for Red Team scans (data plane).
|
|
9124
|
+
* @returns The supported-languages response.
|
|
9125
|
+
* @example
|
|
9126
|
+
* ```ts
|
|
9127
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
9128
|
+
* const rt = new RedTeamClient();
|
|
9129
|
+
*
|
|
9130
|
+
* const langs = await rt.getLanguages();
|
|
9131
|
+
* // langs =>
|
|
9132
|
+
* // { multilingual_enabled: true, supported_job_types: ['STATIC', 'DYNAMIC'],
|
|
9133
|
+
* // languages: [{ code: 'en', name: 'English' }, { code: 'es', name: 'Spanish' }] }
|
|
9134
|
+
* ```
|
|
9135
|
+
*/
|
|
9136
|
+
async getLanguages() {
|
|
9137
|
+
return request({
|
|
9138
|
+
method: "GET",
|
|
9139
|
+
baseUrl: this.dataEndpoint,
|
|
9140
|
+
path: RED_TEAM_LANGUAGES_PATH,
|
|
9141
|
+
responseSchema: TenantLanguagesResponseSchema,
|
|
9142
|
+
auth: this.auth,
|
|
9143
|
+
numRetries: this.numRetries
|
|
9144
|
+
});
|
|
9145
|
+
}
|
|
9146
|
+
/**
|
|
9147
|
+
* Get the tenant's allowed languages from the management plane.
|
|
9148
|
+
* Same response shape as {@link RedTeamClient.getLanguages}, served from the management endpoint.
|
|
9149
|
+
* @returns The supported-languages response.
|
|
9150
|
+
* @example
|
|
9151
|
+
* ```ts
|
|
9152
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
9153
|
+
* const rt = new RedTeamClient();
|
|
9154
|
+
*
|
|
9155
|
+
* const langs = await rt.getManagementLanguages();
|
|
9156
|
+
* // langs =>
|
|
9157
|
+
* // { multilingual_enabled: true, supported_job_types: ['STATIC', 'DYNAMIC'],
|
|
9158
|
+
* // languages: [{ code: 'en', name: 'English' }] }
|
|
9159
|
+
* ```
|
|
9160
|
+
*/
|
|
9161
|
+
async getManagementLanguages() {
|
|
9162
|
+
return request({
|
|
9163
|
+
method: "GET",
|
|
9164
|
+
baseUrl: this.mgmtEndpoint,
|
|
9165
|
+
path: RED_TEAM_LANGUAGES_PATH,
|
|
9166
|
+
responseSchema: TenantLanguagesResponseSchema,
|
|
9167
|
+
auth: this.auth,
|
|
9168
|
+
numRetries: this.numRetries
|
|
9169
|
+
});
|
|
9170
|
+
}
|
|
8616
9171
|
/**
|
|
8617
9172
|
* Update sentiment for a scan report.
|
|
8618
9173
|
* @param body - The sentiment request body.
|
|
@@ -8740,6 +9295,12 @@ export {
|
|
|
8740
9295
|
CategoryModelSchema,
|
|
8741
9296
|
CategoryReportSchema,
|
|
8742
9297
|
CgReportSchema,
|
|
9298
|
+
ChannelListPaginationSchema,
|
|
9299
|
+
ChannelListResponseSchema,
|
|
9300
|
+
ChannelSchema,
|
|
9301
|
+
ChannelStatsSchema,
|
|
9302
|
+
ChannelStatus,
|
|
9303
|
+
ChannelStatusSchema,
|
|
8743
9304
|
ClientIdAndCustomerAppSchema,
|
|
8744
9305
|
CmdEntrySchema,
|
|
8745
9306
|
CmdInjectReportSchema,
|
|
@@ -8753,6 +9314,7 @@ export {
|
|
|
8753
9314
|
ContentErrorType,
|
|
8754
9315
|
CountByNameSchema,
|
|
8755
9316
|
CountedQuotaEnum,
|
|
9317
|
+
CreateChannelRequestSchema,
|
|
8756
9318
|
CreateCustomTopicRequestSchema,
|
|
8757
9319
|
CreateSecurityProfileRequestSchema,
|
|
8758
9320
|
CustomAttackOutputSchema,
|
|
@@ -8787,6 +9349,7 @@ export {
|
|
|
8787
9349
|
DEFAULT_MODEL_SEC_MGMT_ENDPOINT,
|
|
8788
9350
|
DEFAULT_RED_TEAM_DATA_ENDPOINT,
|
|
8789
9351
|
DEFAULT_RED_TEAM_MGMT_ENDPOINT,
|
|
9352
|
+
DEFAULT_RED_TEAM_NETWORK_BROKER_ENDPOINT,
|
|
8790
9353
|
DEFAULT_TOKEN_ENDPOINT,
|
|
8791
9354
|
DLP_DATA_FILTERING_PROFILES_PATH,
|
|
8792
9355
|
DLP_DATA_PATTERNS_PATH,
|
|
@@ -8928,6 +9491,7 @@ export {
|
|
|
8928
9491
|
LabelValueListSchema,
|
|
8929
9492
|
LabelsCreateRequestSchema,
|
|
8930
9493
|
LabelsResponseSchema,
|
|
9494
|
+
LanguageOptionSchema,
|
|
8931
9495
|
ListModelSecurityGroupsResponseSchema,
|
|
8932
9496
|
ListModelSecurityRuleInstancesResponseSchema,
|
|
8933
9497
|
ListModelSecurityRulesResponseSchema,
|
|
@@ -8973,6 +9537,8 @@ export {
|
|
|
8973
9537
|
MODEL_SEC_DATA_ENDPOINT,
|
|
8974
9538
|
MODEL_SEC_EVALUATIONS_PATH,
|
|
8975
9539
|
MODEL_SEC_MGMT_ENDPOINT,
|
|
9540
|
+
MODEL_SEC_MODELS_PATH,
|
|
9541
|
+
MODEL_SEC_MODEL_VERSIONS_PATH,
|
|
8976
9542
|
MODEL_SEC_PYPI_AUTH_PATH,
|
|
8977
9543
|
MODEL_SEC_SCANS_PATH,
|
|
8978
9544
|
MODEL_SEC_SECURITY_GROUPS_PATH,
|
|
@@ -8989,7 +9555,9 @@ export {
|
|
|
8989
9555
|
MetadataCriterionSchema,
|
|
8990
9556
|
MetadataSchema,
|
|
8991
9557
|
ModelConfigurationSchema,
|
|
9558
|
+
ModelListSchema,
|
|
8992
9559
|
ModelProtectionItemSchema,
|
|
9560
|
+
ModelResponseSchema,
|
|
8993
9561
|
ModelScanIssueSchema,
|
|
8994
9562
|
ModelScanStatus,
|
|
8995
9563
|
ModelSecurityClient,
|
|
@@ -8998,12 +9566,15 @@ export {
|
|
|
8998
9566
|
ModelSecurityGroupState,
|
|
8999
9567
|
ModelSecurityGroupUpdateRequestSchema,
|
|
9000
9568
|
ModelSecurityGroupsClient,
|
|
9569
|
+
ModelSecurityModelsClient,
|
|
9001
9570
|
ModelSecurityPaginationSchema,
|
|
9002
9571
|
ModelSecurityRuleInstanceResponseSchema,
|
|
9003
9572
|
ModelSecurityRuleInstanceUpdateRequestSchema,
|
|
9004
9573
|
ModelSecurityRuleResponseSchema,
|
|
9005
9574
|
ModelSecurityRulesClient,
|
|
9006
9575
|
ModelSecurityScansClient,
|
|
9576
|
+
ModelVersionListSchema,
|
|
9577
|
+
ModelVersionResponseSchema,
|
|
9007
9578
|
MultiProfileDataNodeSchema,
|
|
9008
9579
|
MultiProfileDetectionRuleSchema,
|
|
9009
9580
|
MultiTurnStatefulConfigSchema,
|
|
@@ -9048,6 +9619,8 @@ export {
|
|
|
9048
9619
|
QuotaDetailsSchema,
|
|
9049
9620
|
QuotaSummarySchema,
|
|
9050
9621
|
RED_TEAM_CATEGORIES_PATH,
|
|
9622
|
+
RED_TEAM_CHANNELS_PATH,
|
|
9623
|
+
RED_TEAM_CHANNELS_STATS_PATH,
|
|
9051
9624
|
RED_TEAM_CLIENT_ID,
|
|
9052
9625
|
RED_TEAM_CLIENT_SECRET,
|
|
9053
9626
|
RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH,
|
|
@@ -9055,10 +9628,13 @@ export {
|
|
|
9055
9628
|
RED_TEAM_DASHBOARD_PATH,
|
|
9056
9629
|
RED_TEAM_DATA_ENDPOINT,
|
|
9057
9630
|
RED_TEAM_ERROR_LOG_PATH,
|
|
9631
|
+
RED_TEAM_ERROR_LOG_TARGET_PROFILE_PATH,
|
|
9058
9632
|
RED_TEAM_EULA_PATH,
|
|
9059
9633
|
RED_TEAM_INSTANCES_PATH,
|
|
9634
|
+
RED_TEAM_LANGUAGES_PATH,
|
|
9060
9635
|
RED_TEAM_MGMT_DASHBOARD_PATH,
|
|
9061
9636
|
RED_TEAM_MGMT_ENDPOINT,
|
|
9637
|
+
RED_TEAM_NETWORK_BROKER_ENDPOINT,
|
|
9062
9638
|
RED_TEAM_QUOTA_PATH,
|
|
9063
9639
|
RED_TEAM_REGISTRY_CREDENTIALS_PATH,
|
|
9064
9640
|
RED_TEAM_REPORT_DYNAMIC_PATH,
|
|
@@ -9078,6 +9654,7 @@ export {
|
|
|
9078
9654
|
RedTeamErrorType,
|
|
9079
9655
|
RedTeamEulaClient,
|
|
9080
9656
|
RedTeamInstancesClient,
|
|
9657
|
+
RedTeamNetworkBrokerClient,
|
|
9081
9658
|
RedTeamPaginationSchema,
|
|
9082
9659
|
RedTeamReportsClient,
|
|
9083
9660
|
RedTeamScansClient,
|
|
@@ -9180,6 +9757,7 @@ export {
|
|
|
9180
9757
|
TargetType,
|
|
9181
9758
|
TargetUpdateRequestSchema,
|
|
9182
9759
|
TcReportSchema,
|
|
9760
|
+
TenantLanguagesResponseSchema,
|
|
9183
9761
|
TgReportSchema,
|
|
9184
9762
|
ThreatCategory,
|
|
9185
9763
|
ThreatScanReportSchema,
|
|
@@ -9195,11 +9773,13 @@ export {
|
|
|
9195
9773
|
TopicsClient,
|
|
9196
9774
|
URLExclusionSchema,
|
|
9197
9775
|
USER_AGENT,
|
|
9776
|
+
UpdateChannelRequestSchema,
|
|
9198
9777
|
UrlCategorySchema,
|
|
9199
9778
|
UrlfEntrySchema,
|
|
9200
9779
|
ValidationErrorSchema,
|
|
9201
9780
|
Verdict,
|
|
9202
9781
|
ViolationListSchema,
|
|
9782
|
+
ViolationRemediationSchema,
|
|
9203
9783
|
ViolationResponseSchema,
|
|
9204
9784
|
ViolationSeverityCountsSchema,
|
|
9205
9785
|
WebSocketConnectionParamsSchema,
|