@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/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.1";
|
|
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) => {
|
|
@@ -121,11 +129,15 @@ var AISecSDKException = class _AISecSDKException extends Error {
|
|
|
121
129
|
/**
|
|
122
130
|
* @param message - Human-readable error description.
|
|
123
131
|
* @param errorType - Classification of the error.
|
|
132
|
+
* @param metadata - Optional transport failure metadata.
|
|
124
133
|
*/
|
|
125
|
-
constructor(message, errorType) {
|
|
134
|
+
constructor(message, errorType, metadata = {}) {
|
|
126
135
|
super(errorType ? `${errorType}:${message}` : message);
|
|
127
136
|
this.name = "AISecSDKException";
|
|
128
137
|
this.errorType = errorType;
|
|
138
|
+
if (metadata.failureKind !== void 0) this.failureKind = metadata.failureKind;
|
|
139
|
+
if (metadata.statusCode !== void 0) this.statusCode = metadata.statusCode;
|
|
140
|
+
if (metadata.retryAfterMs !== void 0) this.retryAfterMs = metadata.retryAfterMs;
|
|
129
141
|
if (Error.captureStackTrace) {
|
|
130
142
|
Error.captureStackTrace(this, _AISecSDKException);
|
|
131
143
|
}
|
|
@@ -267,6 +279,59 @@ function extractErrorMessage(body, status) {
|
|
|
267
279
|
return body ? `API error ${status}: ${body}` : `API error ${status}`;
|
|
268
280
|
}
|
|
269
281
|
}
|
|
282
|
+
function parseRetryAfterHeader(value) {
|
|
283
|
+
if (value === null) return void 0;
|
|
284
|
+
const normalized = value.trim();
|
|
285
|
+
if (/^\d+$/.test(normalized)) {
|
|
286
|
+
const milliseconds = Number(normalized) * 1e3;
|
|
287
|
+
return Number.isFinite(milliseconds) ? milliseconds : void 0;
|
|
288
|
+
}
|
|
289
|
+
const weekday = "(?:Mon|Tue|Wed|Thu|Fri|Sat|Sun)";
|
|
290
|
+
const longWeekday = "(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday)";
|
|
291
|
+
const month = "(?:Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)";
|
|
292
|
+
const httpDatePatterns = [
|
|
293
|
+
new RegExp(`^${weekday}, \\d{2} ${month} \\d{4} \\d{2}:\\d{2}:\\d{2} GMT$`),
|
|
294
|
+
new RegExp(`^${longWeekday}, \\d{2}-${month}-\\d{2} \\d{2}:\\d{2}:\\d{2} GMT$`),
|
|
295
|
+
new RegExp(`^${weekday} ${month} [ \\d]\\d \\d{2}:\\d{2}:\\d{2} \\d{4}$`)
|
|
296
|
+
];
|
|
297
|
+
if (!httpDatePatterns.some((pattern) => pattern.test(normalized))) return void 0;
|
|
298
|
+
const timestamp = Date.parse(normalized);
|
|
299
|
+
if (!Number.isFinite(timestamp)) return void 0;
|
|
300
|
+
return Math.max(0, timestamp - Date.now());
|
|
301
|
+
}
|
|
302
|
+
function parseRetryAfterBody(body) {
|
|
303
|
+
try {
|
|
304
|
+
const parsed = JSON.parse(body);
|
|
305
|
+
const interval = parsed.retry_after?.interval;
|
|
306
|
+
const unit = parsed.retry_after?.unit;
|
|
307
|
+
if (typeof interval !== "number" || !Number.isFinite(interval) || interval < 0)
|
|
308
|
+
return void 0;
|
|
309
|
+
if (typeof unit !== "string") return void 0;
|
|
310
|
+
const unitMultipliers = {
|
|
311
|
+
ms: 1,
|
|
312
|
+
msec: 1,
|
|
313
|
+
msecs: 1,
|
|
314
|
+
millisecond: 1,
|
|
315
|
+
milliseconds: 1,
|
|
316
|
+
s: 1e3,
|
|
317
|
+
sec: 1e3,
|
|
318
|
+
secs: 1e3,
|
|
319
|
+
second: 1e3,
|
|
320
|
+
seconds: 1e3,
|
|
321
|
+
m: 6e4,
|
|
322
|
+
min: 6e4,
|
|
323
|
+
mins: 6e4,
|
|
324
|
+
minute: 6e4,
|
|
325
|
+
minutes: 6e4
|
|
326
|
+
};
|
|
327
|
+
const multiplier = unitMultipliers[unit.toLowerCase()];
|
|
328
|
+
if (multiplier === void 0) return void 0;
|
|
329
|
+
const milliseconds = interval * multiplier;
|
|
330
|
+
return Number.isFinite(milliseconds) ? milliseconds : void 0;
|
|
331
|
+
} catch {
|
|
332
|
+
return void 0;
|
|
333
|
+
}
|
|
334
|
+
}
|
|
270
335
|
async function executeWithRetry(opts) {
|
|
271
336
|
const { maxRetries, execute, onRetryableFailure } = opts;
|
|
272
337
|
let lastError;
|
|
@@ -283,7 +348,8 @@ async function executeWithRetry(opts) {
|
|
|
283
348
|
}
|
|
284
349
|
throw new AISecSDKException(
|
|
285
350
|
lastError.message ?? "Network error",
|
|
286
|
-
"AISEC_CLIENT_SIDE_ERROR" /* CLIENT_SIDE_ERROR
|
|
351
|
+
"AISEC_CLIENT_SIDE_ERROR" /* CLIENT_SIDE_ERROR */,
|
|
352
|
+
{ failureKind: "network" }
|
|
287
353
|
);
|
|
288
354
|
}
|
|
289
355
|
if (response.ok) return response;
|
|
@@ -300,17 +366,53 @@ async function executeWithRetry(opts) {
|
|
|
300
366
|
}
|
|
301
367
|
const errorText = await response.text();
|
|
302
368
|
const errorMessage = extractErrorMessage(errorText, response.status);
|
|
303
|
-
|
|
369
|
+
const retryAfterHeader = response.headers?.get?.("Retry-After") ?? null;
|
|
370
|
+
const headerRetryAfterMs = parseRetryAfterHeader(retryAfterHeader);
|
|
371
|
+
throw new AISecSDKException(errorMessage, classifyErrorType(response.status), {
|
|
372
|
+
failureKind: "http",
|
|
373
|
+
statusCode: response.status,
|
|
374
|
+
retryAfterMs: headerRetryAfterMs ?? parseRetryAfterBody(errorText)
|
|
375
|
+
});
|
|
304
376
|
}
|
|
305
377
|
throw new AISecSDKException(
|
|
306
378
|
lastError?.message ?? "Max retries exceeded",
|
|
307
|
-
"AISEC_CLIENT_SIDE_ERROR" /* CLIENT_SIDE_ERROR
|
|
379
|
+
"AISEC_CLIENT_SIDE_ERROR" /* CLIENT_SIDE_ERROR */,
|
|
380
|
+
lastError ? { failureKind: "network" } : {}
|
|
308
381
|
);
|
|
309
382
|
}
|
|
310
383
|
|
|
384
|
+
// src/http/debug.ts
|
|
385
|
+
import { createHash } from "crypto";
|
|
386
|
+
var TRUTHY = /* @__PURE__ */ new Set(["1", "true", "yes", "on"]);
|
|
387
|
+
var SENSITIVE_HEADERS = /* @__PURE__ */ new Set([HEADER_AUTH_TOKEN.toLowerCase(), HEADER_API_KEY.toLowerCase()]);
|
|
388
|
+
var PREFIX = "[airs-sdk]";
|
|
389
|
+
function isDebugEnabled() {
|
|
390
|
+
const raw = process.env.PANW_AI_SEC_DEBUG;
|
|
391
|
+
return raw !== void 0 && TRUTHY.has(raw.trim().toLowerCase());
|
|
392
|
+
}
|
|
393
|
+
function hashToken(value) {
|
|
394
|
+
return "sha256:" + createHash("sha256").update(value).digest("hex").slice(0, 12);
|
|
395
|
+
}
|
|
396
|
+
function sanitizeHeaders(headers) {
|
|
397
|
+
const out = {};
|
|
398
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
399
|
+
out[key] = SENSITIVE_HEADERS.has(key.toLowerCase()) ? hashToken(value) : value;
|
|
400
|
+
}
|
|
401
|
+
return out;
|
|
402
|
+
}
|
|
403
|
+
function logRequest(method, url, headers, body) {
|
|
404
|
+
console.error(`${PREFIX} \u2192 ${method} ${url}`);
|
|
405
|
+
console.error(`${PREFIX} headers ${JSON.stringify(sanitizeHeaders(headers))}`);
|
|
406
|
+
if (body !== void 0) console.error(`${PREFIX} body ${body}`);
|
|
407
|
+
}
|
|
408
|
+
function logResponse(status, ms, body) {
|
|
409
|
+
console.error(`${PREFIX} \u2190 ${status} (${ms}ms)${body !== void 0 ? ` ${body}` : ""}`);
|
|
410
|
+
}
|
|
411
|
+
|
|
311
412
|
// src/http/request.ts
|
|
312
413
|
async function request(spec) {
|
|
313
414
|
let hasRetriedAuth = false;
|
|
415
|
+
const debug = isDebugEnabled();
|
|
314
416
|
const response = await executeWithRetry({
|
|
315
417
|
maxRetries: spec.numRetries,
|
|
316
418
|
execute: async () => {
|
|
@@ -340,11 +442,25 @@ async function request(spec) {
|
|
|
340
442
|
}
|
|
341
443
|
const prepared = { method: spec.method, url, headers, bodyText };
|
|
342
444
|
const final = await spec.auth.prepare(prepared);
|
|
343
|
-
|
|
445
|
+
const startedAt = debug ? Date.now() : 0;
|
|
446
|
+
if (debug) {
|
|
447
|
+
const logBody = spec.formData !== void 0 ? "[multipart/form-data]" : final.bodyText;
|
|
448
|
+
logRequest(final.method, final.url.toString(), final.headers, logBody);
|
|
449
|
+
}
|
|
450
|
+
const res = await fetch(final.url.toString(), {
|
|
344
451
|
method: final.method,
|
|
345
452
|
headers: final.headers,
|
|
346
453
|
body: spec.formData !== void 0 ? bodyForFetch : final.bodyText
|
|
347
454
|
});
|
|
455
|
+
if (debug) {
|
|
456
|
+
let respBody;
|
|
457
|
+
try {
|
|
458
|
+
respBody = await res.clone().text();
|
|
459
|
+
} catch {
|
|
460
|
+
}
|
|
461
|
+
logResponse(res.status, Date.now() - startedAt, respBody);
|
|
462
|
+
}
|
|
463
|
+
return res;
|
|
348
464
|
},
|
|
349
465
|
onRetryableFailure: async (res) => {
|
|
350
466
|
if (hasRetriedAuth) return false;
|
|
@@ -394,6 +510,7 @@ var PromptDetectedSchema = z.object({
|
|
|
394
510
|
injection: z.boolean().optional(),
|
|
395
511
|
toxic_content: z.boolean().optional(),
|
|
396
512
|
malicious_code: z.boolean().optional(),
|
|
513
|
+
source_code: z.boolean().optional(),
|
|
397
514
|
agent: z.boolean().optional(),
|
|
398
515
|
topic_violation: z.boolean().optional()
|
|
399
516
|
}).passthrough();
|
|
@@ -698,6 +815,16 @@ var ThreatScanReportSchema = z14.object({
|
|
|
698
815
|
}).passthrough();
|
|
699
816
|
|
|
700
817
|
// src/scan/scanner.ts
|
|
818
|
+
function resolveNumRetries(opts) {
|
|
819
|
+
const numRetries = opts.numRetries ?? globalConfiguration.numRetries;
|
|
820
|
+
if (!Number.isFinite(numRetries) || !Number.isInteger(numRetries) || numRetries < 0 || numRetries > MAX_NUMBER_OF_RETRIES) {
|
|
821
|
+
throw new AISecSDKException(
|
|
822
|
+
`numRetries must be a finite integer between 0 and ${MAX_NUMBER_OF_RETRIES}`,
|
|
823
|
+
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
824
|
+
);
|
|
825
|
+
}
|
|
826
|
+
return numRetries;
|
|
827
|
+
}
|
|
701
828
|
var Scanner = class {
|
|
702
829
|
/**
|
|
703
830
|
* @internal
|
|
@@ -718,7 +845,7 @@ var Scanner = class {
|
|
|
718
845
|
* Perform a synchronous content scan.
|
|
719
846
|
* @param aiProfile - AI security profile to scan against.
|
|
720
847
|
* @param content - Content to scan.
|
|
721
|
-
* @param opts - Optional transaction/session IDs and
|
|
848
|
+
* @param opts - Optional transaction/session IDs, metadata, and per-call retry override.
|
|
722
849
|
* @returns Scan response with verdict, action, and detection details.
|
|
723
850
|
* @example
|
|
724
851
|
* ```ts
|
|
@@ -737,6 +864,7 @@ var Scanner = class {
|
|
|
737
864
|
* ```
|
|
738
865
|
*/
|
|
739
866
|
async syncScan(aiProfile, content, opts = {}) {
|
|
867
|
+
const numRetries = resolveNumRetries(opts);
|
|
740
868
|
if (opts.trId && opts.trId.length > MAX_TRANSACTION_ID_STR_LENGTH) {
|
|
741
869
|
throw new AISecSDKException(
|
|
742
870
|
`trId exceeds max length of ${MAX_TRANSACTION_ID_STR_LENGTH}`,
|
|
@@ -763,33 +891,52 @@ var Scanner = class {
|
|
|
763
891
|
body,
|
|
764
892
|
responseSchema: ScanResponseSchema,
|
|
765
893
|
auth: this.buildAuth(),
|
|
766
|
-
numRetries
|
|
894
|
+
numRetries
|
|
767
895
|
});
|
|
768
896
|
}
|
|
769
897
|
/**
|
|
770
|
-
* Submit content for asynchronous scanning.
|
|
771
|
-
*
|
|
772
|
-
*
|
|
898
|
+
* Submit one batch of content for asynchronous scanning.
|
|
899
|
+
*
|
|
900
|
+
* The call accepts 1–5 request objects and returns one batch receipt. A batch `scan_id` can fan
|
|
901
|
+
* out to several unordered result rows. Correlate each row by `(scan_id, req_id)`, never array
|
|
902
|
+
* position or `scan_id` alone. The SDK preserves the server's row order and cardinality.
|
|
903
|
+
*
|
|
904
|
+
* Setting `numRetries: 0` guarantees one SDK fetch attempt, but cannot guarantee exactly-once
|
|
905
|
+
* server submission after an ambiguous network or 5xx failure.
|
|
906
|
+
* @param scanObjects - Array of scan objects (1–5 items), each with its own `req_id`.
|
|
907
|
+
* @param opts - Optional per-call retry override.
|
|
908
|
+
* @returns One batch receipt containing the shared scan ID for later querying.
|
|
773
909
|
* @example
|
|
774
910
|
* ```ts
|
|
775
911
|
* import { init, Scanner } from '@cdot65/prisma-airs-sdk';
|
|
776
912
|
* init();
|
|
777
913
|
* const scanner = new Scanner();
|
|
778
914
|
*
|
|
779
|
-
* const
|
|
780
|
-
*
|
|
781
|
-
*
|
|
782
|
-
*
|
|
783
|
-
*
|
|
784
|
-
*
|
|
915
|
+
* const receipt = await scanner.asyncScan(
|
|
916
|
+
* [
|
|
917
|
+
* {
|
|
918
|
+
* req_id: 1,
|
|
919
|
+
* scan_req: {
|
|
920
|
+
* ai_profile: { profile_name: 'my-profile' },
|
|
921
|
+
* contents: [{ prompt: 'Tell me about machine learning.' }],
|
|
922
|
+
* },
|
|
785
923
|
* },
|
|
786
|
-
*
|
|
787
|
-
*
|
|
788
|
-
*
|
|
924
|
+
* {
|
|
925
|
+
* req_id: 2,
|
|
926
|
+
* scan_req: {
|
|
927
|
+
* ai_profile: { profile_name: 'my-profile' },
|
|
928
|
+
* contents: [{ prompt: 'What are neural networks?' }],
|
|
929
|
+
* },
|
|
930
|
+
* },
|
|
931
|
+
* ],
|
|
932
|
+
* { numRetries: 0 },
|
|
933
|
+
* );
|
|
934
|
+
* // receipt =>
|
|
789
935
|
* // { received: '2024-01-01T00:00:00Z', scan_id: '550e...' }
|
|
790
936
|
* ```
|
|
791
937
|
*/
|
|
792
|
-
async asyncScan(scanObjects) {
|
|
938
|
+
async asyncScan(scanObjects, opts = {}) {
|
|
939
|
+
const numRetries = resolveNumRetries(opts);
|
|
793
940
|
if (scanObjects.length < 1) {
|
|
794
941
|
throw new AISecSDKException(
|
|
795
942
|
"At least 1 scan object is required",
|
|
@@ -809,13 +956,17 @@ var Scanner = class {
|
|
|
809
956
|
body: scanObjects,
|
|
810
957
|
responseSchema: AsyncScanResponseSchema,
|
|
811
958
|
auth: this.buildAuth(),
|
|
812
|
-
numRetries
|
|
959
|
+
numRetries
|
|
813
960
|
});
|
|
814
961
|
}
|
|
815
962
|
/**
|
|
816
963
|
* Query scan results by scan IDs.
|
|
964
|
+
*
|
|
965
|
+
* One scan ID can return several unordered rows. Correlate them using `(scan_id, req_id)`. The
|
|
966
|
+
* SDK does not sort, deduplicate, or collapse the response.
|
|
817
967
|
* @param scanIds - Array of scan UUIDs (1–5 items).
|
|
818
|
-
* @
|
|
968
|
+
* @param opts - Optional per-call retry override.
|
|
969
|
+
* @returns Every scan-result row in server order, with status and response data.
|
|
819
970
|
* @example
|
|
820
971
|
* ```ts
|
|
821
972
|
* import { init, Scanner } from '@cdot65/prisma-airs-sdk';
|
|
@@ -825,12 +976,14 @@ var Scanner = class {
|
|
|
825
976
|
* const results = await scanner.queryByScanIds([
|
|
826
977
|
* '550e8400-e29b-41d4-a716-446655440000',
|
|
827
978
|
* ]);
|
|
828
|
-
* //
|
|
829
|
-
*
|
|
830
|
-
*
|
|
979
|
+
* // A single scan ID may produce multiple rows, for example req_id 2 then req_id 1.
|
|
980
|
+
* for (const row of results) {
|
|
981
|
+
* console.log(`${row.scan_id}:${row.req_id}`, row.status, row.result?.action);
|
|
982
|
+
* }
|
|
831
983
|
* ```
|
|
832
984
|
*/
|
|
833
|
-
async queryByScanIds(scanIds) {
|
|
985
|
+
async queryByScanIds(scanIds, opts = {}) {
|
|
986
|
+
const numRetries = resolveNumRetries(opts);
|
|
834
987
|
if (scanIds.length < 1) {
|
|
835
988
|
throw new AISecSDKException(
|
|
836
989
|
"At least 1 scan_id is required",
|
|
@@ -855,13 +1008,17 @@ var Scanner = class {
|
|
|
855
1008
|
params: { scan_ids: scanIds.join(",") },
|
|
856
1009
|
responseSchema: z15.array(ScanIdResultSchema),
|
|
857
1010
|
auth: this.buildAuth(),
|
|
858
|
-
numRetries
|
|
1011
|
+
numRetries
|
|
859
1012
|
});
|
|
860
1013
|
}
|
|
861
1014
|
/**
|
|
862
1015
|
* Query detailed threat reports by report IDs.
|
|
1016
|
+
*
|
|
1017
|
+
* One report ID can return several rows. Correlate them using `(report_id, req_id)`. The SDK
|
|
1018
|
+
* preserves server order and cardinality without sorting or deduplicating.
|
|
863
1019
|
* @param reportIds - Array of report IDs (1–5 items).
|
|
864
|
-
* @
|
|
1020
|
+
* @param opts - Optional per-call retry override.
|
|
1021
|
+
* @returns Every report row in server order, with detection details.
|
|
865
1022
|
* @example
|
|
866
1023
|
* ```ts
|
|
867
1024
|
* import { init, Scanner } from '@cdot65/prisma-airs-sdk';
|
|
@@ -869,12 +1026,13 @@ var Scanner = class {
|
|
|
869
1026
|
* const scanner = new Scanner();
|
|
870
1027
|
*
|
|
871
1028
|
* const reports = await scanner.queryByReportIds(['R000...']);
|
|
872
|
-
*
|
|
873
|
-
*
|
|
874
|
-
*
|
|
1029
|
+
* for (const report of reports) {
|
|
1030
|
+
* console.log(`${report.report_id}:${report.req_id}`, report.detection_results);
|
|
1031
|
+
* }
|
|
875
1032
|
* ```
|
|
876
1033
|
*/
|
|
877
|
-
async queryByReportIds(reportIds) {
|
|
1034
|
+
async queryByReportIds(reportIds, opts = {}) {
|
|
1035
|
+
const numRetries = resolveNumRetries(opts);
|
|
878
1036
|
if (reportIds.length < 1) {
|
|
879
1037
|
throw new AISecSDKException(
|
|
880
1038
|
"At least 1 report_id is required",
|
|
@@ -894,7 +1052,7 @@ var Scanner = class {
|
|
|
894
1052
|
params: { report_ids: reportIds.join(",") },
|
|
895
1053
|
responseSchema: z15.array(ThreatScanReportSchema),
|
|
896
1054
|
auth: this.buildAuth(),
|
|
897
|
-
numRetries
|
|
1055
|
+
numRetries
|
|
898
1056
|
});
|
|
899
1057
|
}
|
|
900
1058
|
};
|
|
@@ -2306,7 +2464,8 @@ var ScanDetailsSchema = z32.object({
|
|
|
2306
2464
|
var ScanCreateRequestSchema = z32.object({
|
|
2307
2465
|
model_uri: z32.string(),
|
|
2308
2466
|
security_group_uuid: z32.string(),
|
|
2309
|
-
|
|
2467
|
+
// Optional per the OpenAPI spec (server defaults it); the scans-client example still sets it.
|
|
2468
|
+
scan_origin: z32.string().optional(),
|
|
2310
2469
|
allow_patterns: z32.array(z32.string()).nullable().optional(),
|
|
2311
2470
|
ignore_patterns: z32.array(z32.string()).nullable().optional(),
|
|
2312
2471
|
labels: z32.array(LabelSchema).nullable().optional(),
|
|
@@ -2325,7 +2484,8 @@ var ScanBaseResponseSchema = z32.object({
|
|
|
2325
2484
|
scan_origin: z32.string(),
|
|
2326
2485
|
security_group_uuid: z32.string(),
|
|
2327
2486
|
security_group_name: z32.string(),
|
|
2328
|
-
|
|
2487
|
+
// Optional per the OpenAPI spec — a scan may not have a resolved model version yet.
|
|
2488
|
+
model_version_uuid: z32.string().nullable().optional(),
|
|
2329
2489
|
eval_outcome: z32.string(),
|
|
2330
2490
|
source_type: z32.string(),
|
|
2331
2491
|
created_by: z32.string().nullable().optional(),
|
|
@@ -2362,6 +2522,50 @@ var FileListSchema = z32.object({
|
|
|
2362
2522
|
pagination: ModelSecurityPaginationSchema,
|
|
2363
2523
|
files: z32.array(FileResponseSchema)
|
|
2364
2524
|
}).passthrough();
|
|
2525
|
+
var ModelResponseSchema = z32.object({
|
|
2526
|
+
uuid: z32.string(),
|
|
2527
|
+
tsg_id: z32.string(),
|
|
2528
|
+
created_at: z32.string(),
|
|
2529
|
+
updated_at: z32.string(),
|
|
2530
|
+
name: z32.string(),
|
|
2531
|
+
latest_version_uuid: z32.string().nullable().optional(),
|
|
2532
|
+
latest_version_fingerprint: z32.string().nullable().optional(),
|
|
2533
|
+
latest_version_revision: z32.string().nullable().optional(),
|
|
2534
|
+
latest_version_hf_commit_sha: z32.string().nullable().optional(),
|
|
2535
|
+
latest_version_outcome: z32.string().nullable().optional(),
|
|
2536
|
+
latest_version_formats: z32.array(z32.string()).nullable().optional(),
|
|
2537
|
+
latest_version_source_types: z32.array(z32.string()).nullable().optional(),
|
|
2538
|
+
latest_version_scan_time: z32.string().nullable().optional()
|
|
2539
|
+
}).passthrough();
|
|
2540
|
+
var ModelListSchema = z32.object({
|
|
2541
|
+
pagination: ModelSecurityPaginationSchema,
|
|
2542
|
+
models: z32.array(ModelResponseSchema)
|
|
2543
|
+
}).passthrough();
|
|
2544
|
+
var ModelVersionResponseSchema = z32.object({
|
|
2545
|
+
uuid: z32.string(),
|
|
2546
|
+
tsg_id: z32.string(),
|
|
2547
|
+
created_at: z32.string(),
|
|
2548
|
+
updated_at: z32.string(),
|
|
2549
|
+
revision: z32.string(),
|
|
2550
|
+
model_uuid: z32.string(),
|
|
2551
|
+
fingerprint: z32.string().nullable().optional(),
|
|
2552
|
+
file_count: z32.number().int().nullable().optional(),
|
|
2553
|
+
license: z32.string().nullable().optional(),
|
|
2554
|
+
latest_scan_time: z32.string().nullable().optional(),
|
|
2555
|
+
hf_commit_sha: z32.string().nullable().optional(),
|
|
2556
|
+
hf_commit_title: z32.string().nullable().optional(),
|
|
2557
|
+
hf_commit_authors: z32.array(z32.string()).nullable().optional(),
|
|
2558
|
+
hf_model_name: z32.string().nullable().optional(),
|
|
2559
|
+
hf_organization: z32.string().nullable().optional(),
|
|
2560
|
+
model_formats: z32.array(z32.string()).nullable().optional(),
|
|
2561
|
+
source_types: z32.array(z32.string()).nullable().optional(),
|
|
2562
|
+
last_eval_outcome: z32.string().nullable().optional(),
|
|
2563
|
+
last_eval_summary: EvalSummarySchema.nullable().optional()
|
|
2564
|
+
}).passthrough();
|
|
2565
|
+
var ModelVersionListSchema = z32.object({
|
|
2566
|
+
pagination: ModelSecurityPaginationSchema,
|
|
2567
|
+
model_versions: z32.array(ModelVersionResponseSchema)
|
|
2568
|
+
}).passthrough();
|
|
2365
2569
|
var RuleEvaluationResponseSchema = z32.object({
|
|
2366
2570
|
uuid: z32.string(),
|
|
2367
2571
|
tsg_id: z32.string(),
|
|
@@ -2379,6 +2583,10 @@ var RuleEvaluationListSchema = z32.object({
|
|
|
2379
2583
|
pagination: ModelSecurityPaginationSchema,
|
|
2380
2584
|
evaluations: z32.array(RuleEvaluationResponseSchema)
|
|
2381
2585
|
}).passthrough();
|
|
2586
|
+
var ViolationRemediationSchema = z32.object({
|
|
2587
|
+
steps: z32.array(z32.string()),
|
|
2588
|
+
url: z32.string()
|
|
2589
|
+
}).passthrough();
|
|
2382
2590
|
var ViolationResponseSchema = z32.object({
|
|
2383
2591
|
uuid: z32.string(),
|
|
2384
2592
|
tsg_id: z32.string(),
|
|
@@ -2389,6 +2597,7 @@ var ViolationResponseSchema = z32.object({
|
|
|
2389
2597
|
rule_name: z32.string(),
|
|
2390
2598
|
rule_description: z32.string(),
|
|
2391
2599
|
rule_instance_state: z32.string(),
|
|
2600
|
+
remediation: ViolationRemediationSchema,
|
|
2392
2601
|
file: z32.string().nullable().optional(),
|
|
2393
2602
|
hash: z32.string().nullable().optional(),
|
|
2394
2603
|
module: z32.string().nullable().optional(),
|
|
@@ -2524,6 +2733,11 @@ var BrandSubCategory = {
|
|
|
2524
2733
|
DISCRIMINATING_CLAIMS: "DISCRIMINATING_CLAIMS",
|
|
2525
2734
|
POLITICAL_ENDORSEMENTS: "POLITICAL_ENDORSEMENTS"
|
|
2526
2735
|
};
|
|
2736
|
+
var ChannelStatus = {
|
|
2737
|
+
ONLINE: "ONLINE",
|
|
2738
|
+
OFFLINE: "OFFLINE",
|
|
2739
|
+
DRAFT: "DRAFT"
|
|
2740
|
+
};
|
|
2527
2741
|
var ComplianceSubCategory = {
|
|
2528
2742
|
OWASP: "OWASP",
|
|
2529
2743
|
MITRE_ATLAS: "MITRE_ATLAS",
|
|
@@ -3347,6 +3561,12 @@ var ErrorLogSchema = z33.object({
|
|
|
3347
3561
|
version: z33.number().int().optional()
|
|
3348
3562
|
}).passthrough();
|
|
3349
3563
|
var ErrorLogListResponseSchema = z33.object({ pagination: RedTeamPaginationSchema, data: z33.array(ErrorLogSchema) }).passthrough();
|
|
3564
|
+
var LanguageOptionSchema = z33.object({ code: z33.string(), name: z33.string() }).passthrough();
|
|
3565
|
+
var TenantLanguagesResponseSchema = z33.object({
|
|
3566
|
+
multilingual_enabled: z33.boolean(),
|
|
3567
|
+
supported_job_types: z33.array(z33.string()),
|
|
3568
|
+
languages: z33.array(LanguageOptionSchema)
|
|
3569
|
+
}).passthrough();
|
|
3350
3570
|
var TargetRequestBaseFields = {
|
|
3351
3571
|
name: z33.string(),
|
|
3352
3572
|
description: z33.string().nullable().optional(),
|
|
@@ -3701,6 +3921,48 @@ var RegistryCredentialsSchema = z33.object({
|
|
|
3701
3921
|
expiry: z33.string()
|
|
3702
3922
|
}).passthrough();
|
|
3703
3923
|
|
|
3924
|
+
// src/models/red-team-network-broker.ts
|
|
3925
|
+
import { z as z34 } from "zod";
|
|
3926
|
+
var ChannelStatusSchema = z34.nativeEnum(ChannelStatus);
|
|
3927
|
+
var CreateChannelRequestSchema = z34.object({
|
|
3928
|
+
name: z34.string(),
|
|
3929
|
+
description: z34.string().optional()
|
|
3930
|
+
}).passthrough();
|
|
3931
|
+
var UpdateChannelRequestSchema = z34.object({
|
|
3932
|
+
name: z34.string().optional(),
|
|
3933
|
+
description: z34.string().optional()
|
|
3934
|
+
}).passthrough();
|
|
3935
|
+
var ChannelSchema = z34.object({
|
|
3936
|
+
uuid: z34.string().optional(),
|
|
3937
|
+
name: z34.string().nullable().optional(),
|
|
3938
|
+
description: z34.string().nullable().optional(),
|
|
3939
|
+
// Kept as a plain string (not the enum) so unknown upstream statuses never fail parsing.
|
|
3940
|
+
status: z34.string().nullable().optional(),
|
|
3941
|
+
added_by: z34.string().nullable().optional(),
|
|
3942
|
+
created_at: z34.string().nullable().optional(),
|
|
3943
|
+
updated_at: z34.string().nullable().optional(),
|
|
3944
|
+
last_online_at: z34.string().nullable().optional(),
|
|
3945
|
+
// Present on live responses (not in the base OpenAPI Channel schema).
|
|
3946
|
+
connected_clients_count: z34.number().int().nullable().optional(),
|
|
3947
|
+
outdated_clients_count: z34.number().int().nullable().optional(),
|
|
3948
|
+
features: z34.record(z34.boolean()).nullable().optional()
|
|
3949
|
+
}).passthrough();
|
|
3950
|
+
var ChannelListPaginationSchema = z34.object({ total_items: z34.number().int().nullable().optional() }).passthrough();
|
|
3951
|
+
var ChannelListResponseSchema = z34.object({
|
|
3952
|
+
pagination: ChannelListPaginationSchema.optional(),
|
|
3953
|
+
data: z34.array(ChannelSchema).default([])
|
|
3954
|
+
}).passthrough();
|
|
3955
|
+
var ChannelStatsSchema = z34.object({
|
|
3956
|
+
network_channels_server_domain: z34.string().nullable().optional(),
|
|
3957
|
+
docker_registry: z34.string().nullable().optional(),
|
|
3958
|
+
helm_chart: z34.string().nullable().optional(),
|
|
3959
|
+
docker_image: z34.string().nullable().optional(),
|
|
3960
|
+
online_channels: z34.number().int().nullable().optional(),
|
|
3961
|
+
total_channels: z34.number().int().nullable().optional(),
|
|
3962
|
+
// Present on live responses (not in the base OpenAPI ChannelStats schema).
|
|
3963
|
+
client_version: z34.string().nullable().optional()
|
|
3964
|
+
}).passthrough();
|
|
3965
|
+
|
|
3704
3966
|
// src/http/auth/oauth.ts
|
|
3705
3967
|
var OAuthAuth = class {
|
|
3706
3968
|
constructor(oauthClient) {
|
|
@@ -3723,12 +3985,12 @@ var OAuthAuth = class {
|
|
|
3723
3985
|
};
|
|
3724
3986
|
|
|
3725
3987
|
// src/models/oauth-token.ts
|
|
3726
|
-
import { z as
|
|
3727
|
-
var OAuthTokenResponseSchema =
|
|
3728
|
-
access_token:
|
|
3729
|
-
token_type:
|
|
3730
|
-
expires_in:
|
|
3731
|
-
scope:
|
|
3988
|
+
import { z as z35 } from "zod";
|
|
3989
|
+
var OAuthTokenResponseSchema = z35.object({
|
|
3990
|
+
access_token: z35.string(),
|
|
3991
|
+
token_type: z35.string().optional(),
|
|
3992
|
+
expires_in: z35.number(),
|
|
3993
|
+
scope: z35.string().optional()
|
|
3732
3994
|
}).passthrough();
|
|
3733
3995
|
|
|
3734
3996
|
// src/management/oauth-client.ts
|
|
@@ -4519,7 +4781,7 @@ var CustomerAppsClient = class {
|
|
|
4519
4781
|
return request({
|
|
4520
4782
|
method: "GET",
|
|
4521
4783
|
baseUrl: this.baseUrl,
|
|
4522
|
-
path: `${MGMT_CUSTOMER_APPS_TSG_PATH}/${this.tsgId}`,
|
|
4784
|
+
path: `${MGMT_CUSTOMER_APPS_TSG_PATH}/${encodeURIComponent(this.tsgId)}`,
|
|
4523
4785
|
params,
|
|
4524
4786
|
responseSchema: CustomerAppListResponseSchema,
|
|
4525
4787
|
auth: this.auth,
|
|
@@ -4713,7 +4975,7 @@ var ScanLogsClient = class {
|
|
|
4713
4975
|
};
|
|
4714
4976
|
|
|
4715
4977
|
// src/management/oauth-management.ts
|
|
4716
|
-
import { z as
|
|
4978
|
+
import { z as z36 } from "zod";
|
|
4717
4979
|
var OAuthManagementClient = class {
|
|
4718
4980
|
baseUrl;
|
|
4719
4981
|
auth;
|
|
@@ -4747,7 +5009,7 @@ var OAuthManagementClient = class {
|
|
|
4747
5009
|
path: MGMT_OAUTH_INVALIDATE_PATH,
|
|
4748
5010
|
params: { token },
|
|
4749
5011
|
body,
|
|
4750
|
-
responseSchema:
|
|
5012
|
+
responseSchema: z36.string(),
|
|
4751
5013
|
auth: this.auth,
|
|
4752
5014
|
numRetries: this.numRetries
|
|
4753
5015
|
});
|
|
@@ -6375,6 +6637,170 @@ var ModelSecurityRulesClient = class {
|
|
|
6375
6637
|
}
|
|
6376
6638
|
};
|
|
6377
6639
|
|
|
6640
|
+
// src/model-security/models-client.ts
|
|
6641
|
+
function buildModelListParams(opts) {
|
|
6642
|
+
const params = serializeListing(opts);
|
|
6643
|
+
if (opts?.search_query !== void 0) params.search_query = opts.search_query;
|
|
6644
|
+
if (opts?.sort_field !== void 0) params.sort_field = opts.sort_field;
|
|
6645
|
+
if (opts?.sort_order !== void 0) params.sort_order = opts.sort_order;
|
|
6646
|
+
if (opts?.latest_version_outcomes !== void 0)
|
|
6647
|
+
params.latest_version_outcomes = opts.latest_version_outcomes;
|
|
6648
|
+
if (opts?.latest_version_formats !== void 0)
|
|
6649
|
+
params.latest_version_formats = opts.latest_version_formats;
|
|
6650
|
+
if (opts?.latest_version_source_types !== void 0)
|
|
6651
|
+
params.latest_version_source_types = opts.latest_version_source_types;
|
|
6652
|
+
if (opts?.latest_version_scan_time_before !== void 0)
|
|
6653
|
+
params.latest_version_scan_time_before = opts.latest_version_scan_time_before;
|
|
6654
|
+
if (opts?.start_time !== void 0) params.start_time = opts.start_time;
|
|
6655
|
+
if (opts?.end_time !== void 0) params.end_time = opts.end_time;
|
|
6656
|
+
return params;
|
|
6657
|
+
}
|
|
6658
|
+
var ModelSecurityModelsClient = class {
|
|
6659
|
+
baseUrl;
|
|
6660
|
+
auth;
|
|
6661
|
+
numRetries;
|
|
6662
|
+
constructor(opts) {
|
|
6663
|
+
this.baseUrl = opts.baseUrl;
|
|
6664
|
+
this.auth = opts.auth;
|
|
6665
|
+
this.numRetries = opts.numRetries;
|
|
6666
|
+
}
|
|
6667
|
+
/**
|
|
6668
|
+
* List models with optional search, sort, and latest-version filters.
|
|
6669
|
+
* @param opts - Pagination and filter options.
|
|
6670
|
+
* @returns Paginated list of models.
|
|
6671
|
+
* @example
|
|
6672
|
+
* ```ts
|
|
6673
|
+
* import { ModelSecurityClient } from '@cdot65/prisma-airs-sdk';
|
|
6674
|
+
* const ms = new ModelSecurityClient();
|
|
6675
|
+
*
|
|
6676
|
+
* const models = await ms.models.listModels({ limit: 10, search_query: 'llama' });
|
|
6677
|
+
* // models =>
|
|
6678
|
+
* // { pagination: { total_items: 3 }, models: [{ uuid: '550e8400-...', name: 'org/llama', latest_version_outcome: 'PASSED' }] }
|
|
6679
|
+
* ```
|
|
6680
|
+
*/
|
|
6681
|
+
async listModels(opts) {
|
|
6682
|
+
return request({
|
|
6683
|
+
method: "GET",
|
|
6684
|
+
baseUrl: this.baseUrl,
|
|
6685
|
+
path: MODEL_SEC_MODELS_PATH,
|
|
6686
|
+
params: buildModelListParams(opts),
|
|
6687
|
+
responseSchema: ModelListSchema,
|
|
6688
|
+
auth: this.auth,
|
|
6689
|
+
numRetries: this.numRetries
|
|
6690
|
+
});
|
|
6691
|
+
}
|
|
6692
|
+
/**
|
|
6693
|
+
* Get a single model by UUID.
|
|
6694
|
+
* @param uuid - Model UUID.
|
|
6695
|
+
* @returns The model.
|
|
6696
|
+
* @example
|
|
6697
|
+
* ```ts
|
|
6698
|
+
* import { ModelSecurityClient } from '@cdot65/prisma-airs-sdk';
|
|
6699
|
+
* const ms = new ModelSecurityClient();
|
|
6700
|
+
*
|
|
6701
|
+
* const model = await ms.models.getModel('550e8400-e29b-41d4-a716-446655440000');
|
|
6702
|
+
* // model =>
|
|
6703
|
+
* // { uuid: '550e8400-...', name: 'org/model', latest_version_uuid: '660e8400-...', latest_version_outcome: 'PASSED' }
|
|
6704
|
+
* ```
|
|
6705
|
+
*/
|
|
6706
|
+
async getModel(uuid) {
|
|
6707
|
+
assertUuid(uuid, "model uuid");
|
|
6708
|
+
return request({
|
|
6709
|
+
method: "GET",
|
|
6710
|
+
baseUrl: this.baseUrl,
|
|
6711
|
+
path: `${MODEL_SEC_MODELS_PATH}/${uuid}`,
|
|
6712
|
+
responseSchema: ModelResponseSchema,
|
|
6713
|
+
auth: this.auth,
|
|
6714
|
+
numRetries: this.numRetries
|
|
6715
|
+
});
|
|
6716
|
+
}
|
|
6717
|
+
/**
|
|
6718
|
+
* List the versions of a model.
|
|
6719
|
+
* @param modelUuid - Model UUID.
|
|
6720
|
+
* @param opts - Pagination and sort options.
|
|
6721
|
+
* @returns Paginated list of model versions.
|
|
6722
|
+
* @example
|
|
6723
|
+
* ```ts
|
|
6724
|
+
* import { ModelSecurityClient } from '@cdot65/prisma-airs-sdk';
|
|
6725
|
+
* const ms = new ModelSecurityClient();
|
|
6726
|
+
*
|
|
6727
|
+
* const versions = await ms.models.listModelVersions('550e8400-e29b-41d4-a716-446655440000', {
|
|
6728
|
+
* sort_order: 'desc',
|
|
6729
|
+
* });
|
|
6730
|
+
* // versions =>
|
|
6731
|
+
* // { pagination: { total_items: 2 }, model_versions: [{ uuid: '660e8400-...', revision: 'main', file_count: 12 }] }
|
|
6732
|
+
* ```
|
|
6733
|
+
*/
|
|
6734
|
+
async listModelVersions(modelUuid, opts) {
|
|
6735
|
+
assertUuid(modelUuid, "model uuid");
|
|
6736
|
+
const params = serializeListing(opts);
|
|
6737
|
+
if (opts?.sort_order !== void 0) params.sort_order = opts.sort_order;
|
|
6738
|
+
return request({
|
|
6739
|
+
method: "GET",
|
|
6740
|
+
baseUrl: this.baseUrl,
|
|
6741
|
+
path: `${MODEL_SEC_MODELS_PATH}/${modelUuid}/model-versions`,
|
|
6742
|
+
params,
|
|
6743
|
+
responseSchema: ModelVersionListSchema,
|
|
6744
|
+
auth: this.auth,
|
|
6745
|
+
numRetries: this.numRetries
|
|
6746
|
+
});
|
|
6747
|
+
}
|
|
6748
|
+
/**
|
|
6749
|
+
* Get a single model version by UUID.
|
|
6750
|
+
* @param uuid - Model version UUID.
|
|
6751
|
+
* @returns The model version.
|
|
6752
|
+
* @example
|
|
6753
|
+
* ```ts
|
|
6754
|
+
* import { ModelSecurityClient } from '@cdot65/prisma-airs-sdk';
|
|
6755
|
+
* const ms = new ModelSecurityClient();
|
|
6756
|
+
*
|
|
6757
|
+
* const version = await ms.models.getModelVersion('660e8400-e29b-41d4-a716-446655440000');
|
|
6758
|
+
* // version =>
|
|
6759
|
+
* // { uuid: '660e8400-...', revision: 'main', model_uuid: '550e8400-...', last_eval_outcome: 'PASSED' }
|
|
6760
|
+
* ```
|
|
6761
|
+
*/
|
|
6762
|
+
async getModelVersion(uuid) {
|
|
6763
|
+
assertUuid(uuid, "model version uuid");
|
|
6764
|
+
return request({
|
|
6765
|
+
method: "GET",
|
|
6766
|
+
baseUrl: this.baseUrl,
|
|
6767
|
+
path: `${MODEL_SEC_MODEL_VERSIONS_PATH}/${uuid}`,
|
|
6768
|
+
responseSchema: ModelVersionResponseSchema,
|
|
6769
|
+
auth: this.auth,
|
|
6770
|
+
numRetries: this.numRetries
|
|
6771
|
+
});
|
|
6772
|
+
}
|
|
6773
|
+
/**
|
|
6774
|
+
* List the files of a model version.
|
|
6775
|
+
* @param modelVersionUuid - Model version UUID.
|
|
6776
|
+
* @param opts - Pagination options.
|
|
6777
|
+
* @returns Paginated list of files (same shape as scan files).
|
|
6778
|
+
* @example
|
|
6779
|
+
* ```ts
|
|
6780
|
+
* import { ModelSecurityClient } from '@cdot65/prisma-airs-sdk';
|
|
6781
|
+
* const ms = new ModelSecurityClient();
|
|
6782
|
+
*
|
|
6783
|
+
* const files = await ms.models.listModelVersionFiles('660e8400-e29b-41d4-a716-446655440000', {
|
|
6784
|
+
* limit: 50,
|
|
6785
|
+
* });
|
|
6786
|
+
* // files =>
|
|
6787
|
+
* // { pagination: { total_items: 12 }, files: [{ uuid: '770e8400-...', path: '/model.safetensors', type: 'FILE', result: 'SUCCESS' }] }
|
|
6788
|
+
* ```
|
|
6789
|
+
*/
|
|
6790
|
+
async listModelVersionFiles(modelVersionUuid, opts) {
|
|
6791
|
+
assertUuid(modelVersionUuid, "model version uuid");
|
|
6792
|
+
return request({
|
|
6793
|
+
method: "GET",
|
|
6794
|
+
baseUrl: this.baseUrl,
|
|
6795
|
+
path: `${MODEL_SEC_MODEL_VERSIONS_PATH}/${modelVersionUuid}/files`,
|
|
6796
|
+
params: serializeListing(opts),
|
|
6797
|
+
responseSchema: FileListSchema,
|
|
6798
|
+
auth: this.auth,
|
|
6799
|
+
numRetries: this.numRetries
|
|
6800
|
+
});
|
|
6801
|
+
}
|
|
6802
|
+
};
|
|
6803
|
+
|
|
6378
6804
|
// src/model-security/client.ts
|
|
6379
6805
|
var ModelSecurityClient = class {
|
|
6380
6806
|
/** Data plane scan operations. */
|
|
@@ -6383,6 +6809,8 @@ var ModelSecurityClient = class {
|
|
|
6383
6809
|
securityGroups;
|
|
6384
6810
|
/** Management plane security rule operations (read-only). */
|
|
6385
6811
|
securityRules;
|
|
6812
|
+
/** Data plane model and model-version operations (read-only). */
|
|
6813
|
+
models;
|
|
6386
6814
|
mgmtEndpoint;
|
|
6387
6815
|
auth;
|
|
6388
6816
|
numRetries;
|
|
@@ -6404,6 +6832,7 @@ var ModelSecurityClient = class {
|
|
|
6404
6832
|
this.mgmtEndpoint = mgmtEndpoint;
|
|
6405
6833
|
this.numRetries = numRetries;
|
|
6406
6834
|
this.scans = new ModelSecurityScansClient({ baseUrl: dataEndpoint, auth, numRetries });
|
|
6835
|
+
this.models = new ModelSecurityModelsClient({ baseUrl: dataEndpoint, auth, numRetries });
|
|
6407
6836
|
this.securityGroups = new ModelSecurityGroupsClient({
|
|
6408
6837
|
baseUrl: mgmtEndpoint,
|
|
6409
6838
|
auth,
|
|
@@ -6441,7 +6870,7 @@ var ModelSecurityClient = class {
|
|
|
6441
6870
|
};
|
|
6442
6871
|
|
|
6443
6872
|
// src/red-team/scans-client.ts
|
|
6444
|
-
import { z as
|
|
6873
|
+
import { z as z37 } from "zod";
|
|
6445
6874
|
var RedTeamScansClient = class {
|
|
6446
6875
|
baseUrl;
|
|
6447
6876
|
auth;
|
|
@@ -6578,7 +7007,7 @@ var RedTeamScansClient = class {
|
|
|
6578
7007
|
method: "GET",
|
|
6579
7008
|
baseUrl: this.baseUrl,
|
|
6580
7009
|
path: RED_TEAM_CATEGORIES_PATH,
|
|
6581
|
-
responseSchema:
|
|
7010
|
+
responseSchema: z37.array(CategoryModelSchema),
|
|
6582
7011
|
auth: this.auth,
|
|
6583
7012
|
numRetries: this.numRetries
|
|
6584
7013
|
});
|
|
@@ -6586,7 +7015,7 @@ var RedTeamScansClient = class {
|
|
|
6586
7015
|
};
|
|
6587
7016
|
|
|
6588
7017
|
// src/red-team/reports-client.ts
|
|
6589
|
-
import { z as
|
|
7018
|
+
import { z as z38 } from "zod";
|
|
6590
7019
|
var RedTeamReportsClient = class {
|
|
6591
7020
|
baseUrl;
|
|
6592
7021
|
auth;
|
|
@@ -6961,7 +7390,7 @@ var RedTeamReportsClient = class {
|
|
|
6961
7390
|
baseUrl: this.baseUrl,
|
|
6962
7391
|
path: `${RED_TEAM_REPORT_PATH}/${jobId}/download`,
|
|
6963
7392
|
params: { file_format: format },
|
|
6964
|
-
responseSchema:
|
|
7393
|
+
responseSchema: z38.unknown(),
|
|
6965
7394
|
auth: this.auth,
|
|
6966
7395
|
numRetries: this.numRetries
|
|
6967
7396
|
});
|
|
@@ -6985,7 +7414,7 @@ var RedTeamReportsClient = class {
|
|
|
6985
7414
|
method: "POST",
|
|
6986
7415
|
baseUrl: this.baseUrl,
|
|
6987
7416
|
path: `${RED_TEAM_REPORT_PATH}/${jobId}/generate-partial-report`,
|
|
6988
|
-
responseSchema:
|
|
7417
|
+
responseSchema: z38.unknown(),
|
|
6989
7418
|
auth: this.auth,
|
|
6990
7419
|
numRetries: this.numRetries
|
|
6991
7420
|
});
|
|
@@ -6993,7 +7422,7 @@ var RedTeamReportsClient = class {
|
|
|
6993
7422
|
};
|
|
6994
7423
|
|
|
6995
7424
|
// src/red-team/custom-attack-reports-client.ts
|
|
6996
|
-
import { z as
|
|
7425
|
+
import { z as z39 } from "zod";
|
|
6997
7426
|
var RedTeamCustomAttackReportsClient = class {
|
|
6998
7427
|
baseUrl;
|
|
6999
7428
|
auth;
|
|
@@ -7083,7 +7512,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
7083
7512
|
baseUrl: this.baseUrl,
|
|
7084
7513
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/report/${jobId}/prompt-set/${promptSetId}/prompts`,
|
|
7085
7514
|
params,
|
|
7086
|
-
responseSchema:
|
|
7515
|
+
responseSchema: z39.array(PromptDetailResponseSchema),
|
|
7087
7516
|
auth: this.auth,
|
|
7088
7517
|
numRetries: this.numRetries
|
|
7089
7518
|
});
|
|
@@ -7177,7 +7606,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
7177
7606
|
method: "GET",
|
|
7178
7607
|
baseUrl: this.baseUrl,
|
|
7179
7608
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/job/${jobId}/attack/${attackId}/list-outputs`,
|
|
7180
|
-
responseSchema:
|
|
7609
|
+
responseSchema: z39.array(CustomAttackOutputSchema),
|
|
7181
7610
|
auth: this.auth,
|
|
7182
7611
|
numRetries: this.numRetries
|
|
7183
7612
|
});
|
|
@@ -7202,7 +7631,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
7202
7631
|
method: "GET",
|
|
7203
7632
|
baseUrl: this.baseUrl,
|
|
7204
7633
|
path: `${RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH}/job/${jobId}/property-stats`,
|
|
7205
|
-
responseSchema:
|
|
7634
|
+
responseSchema: z39.array(PropertyStatisticSchema),
|
|
7206
7635
|
auth: this.auth,
|
|
7207
7636
|
numRetries: this.numRetries
|
|
7208
7637
|
});
|
|
@@ -7210,7 +7639,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
7210
7639
|
};
|
|
7211
7640
|
|
|
7212
7641
|
// src/red-team/targets-client.ts
|
|
7213
|
-
import { z as
|
|
7642
|
+
import { z as z40 } from "zod";
|
|
7214
7643
|
var RedTeamTargetsClient = class {
|
|
7215
7644
|
baseUrl;
|
|
7216
7645
|
auth;
|
|
@@ -7503,7 +7932,7 @@ var RedTeamTargetsClient = class {
|
|
|
7503
7932
|
method: "GET",
|
|
7504
7933
|
baseUrl: this.baseUrl,
|
|
7505
7934
|
path: `${RED_TEAM_TEMPLATE_PATH}/target-metadata`,
|
|
7506
|
-
responseSchema:
|
|
7935
|
+
responseSchema: z40.record(z40.unknown()),
|
|
7507
7936
|
auth: this.auth,
|
|
7508
7937
|
numRetries: this.numRetries
|
|
7509
7938
|
});
|
|
@@ -8452,6 +8881,155 @@ var RedTeamInstancesClient = class {
|
|
|
8452
8881
|
}
|
|
8453
8882
|
};
|
|
8454
8883
|
|
|
8884
|
+
// src/red-team/network-broker-client.ts
|
|
8885
|
+
var RedTeamNetworkBrokerClient = class {
|
|
8886
|
+
baseUrl;
|
|
8887
|
+
auth;
|
|
8888
|
+
numRetries;
|
|
8889
|
+
constructor(opts) {
|
|
8890
|
+
this.baseUrl = opts.baseUrl;
|
|
8891
|
+
this.auth = opts.auth;
|
|
8892
|
+
this.numRetries = opts.numRetries;
|
|
8893
|
+
}
|
|
8894
|
+
/**
|
|
8895
|
+
* List network broker channels with optional filters.
|
|
8896
|
+
* @param opts - Optional pagination, search, and status filter options.
|
|
8897
|
+
* @returns The paginated list of channels.
|
|
8898
|
+
* @example
|
|
8899
|
+
* ```ts
|
|
8900
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
8901
|
+
* const rt = new RedTeamClient();
|
|
8902
|
+
*
|
|
8903
|
+
* const channels = await rt.networkBroker.listChannels({ status: ['ONLINE', 'DRAFT'], limit: 10 });
|
|
8904
|
+
* // channels =>
|
|
8905
|
+
* // { pagination: { total_items: 2 }, data: [{ uuid: '550e8400-...', name: 'prod-broker', status: 'ONLINE' }] }
|
|
8906
|
+
* ```
|
|
8907
|
+
*/
|
|
8908
|
+
async listChannels(opts) {
|
|
8909
|
+
const params = serializeListing(opts);
|
|
8910
|
+
if (opts?.status !== void 0) {
|
|
8911
|
+
params.status = Array.isArray(opts.status) ? opts.status : [opts.status];
|
|
8912
|
+
}
|
|
8913
|
+
if (opts?.include_all_if_empty !== void 0) {
|
|
8914
|
+
params.include_all_if_empty = String(opts.include_all_if_empty);
|
|
8915
|
+
}
|
|
8916
|
+
return request({
|
|
8917
|
+
method: "GET",
|
|
8918
|
+
baseUrl: this.baseUrl,
|
|
8919
|
+
path: RED_TEAM_CHANNELS_PATH,
|
|
8920
|
+
params,
|
|
8921
|
+
responseSchema: ChannelListResponseSchema,
|
|
8922
|
+
auth: this.auth,
|
|
8923
|
+
numRetries: this.numRetries
|
|
8924
|
+
});
|
|
8925
|
+
}
|
|
8926
|
+
/**
|
|
8927
|
+
* Create a network broker channel.
|
|
8928
|
+
* @param body - Channel creation request body (requires `name`).
|
|
8929
|
+
* @returns The created channel.
|
|
8930
|
+
* @example
|
|
8931
|
+
* ```ts
|
|
8932
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
8933
|
+
* const rt = new RedTeamClient();
|
|
8934
|
+
*
|
|
8935
|
+
* const channel = await rt.networkBroker.createChannel({
|
|
8936
|
+
* name: 'prod-broker',
|
|
8937
|
+
* description: 'Production network broker channel',
|
|
8938
|
+
* });
|
|
8939
|
+
* // channel =>
|
|
8940
|
+
* // { uuid: '550e8400-...', name: 'prod-broker', status: 'DRAFT' }
|
|
8941
|
+
* ```
|
|
8942
|
+
*/
|
|
8943
|
+
async createChannel(body) {
|
|
8944
|
+
return request({
|
|
8945
|
+
method: "POST",
|
|
8946
|
+
baseUrl: this.baseUrl,
|
|
8947
|
+
path: RED_TEAM_CHANNELS_PATH,
|
|
8948
|
+
body,
|
|
8949
|
+
responseSchema: ChannelSchema,
|
|
8950
|
+
auth: this.auth,
|
|
8951
|
+
numRetries: this.numRetries
|
|
8952
|
+
});
|
|
8953
|
+
}
|
|
8954
|
+
/**
|
|
8955
|
+
* Get network broker channel stats.
|
|
8956
|
+
* @returns The channel stats (broker server, registry, chart, image, channel counts).
|
|
8957
|
+
* @example
|
|
8958
|
+
* ```ts
|
|
8959
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
8960
|
+
* const rt = new RedTeamClient();
|
|
8961
|
+
*
|
|
8962
|
+
* const stats = await rt.networkBroker.getChannelStats();
|
|
8963
|
+
* // stats =>
|
|
8964
|
+
* // { network_channels_server_domain: 'broker.example.com', online_channels: 3, total_channels: 5, client_version: '1.4.0' }
|
|
8965
|
+
* ```
|
|
8966
|
+
*/
|
|
8967
|
+
async getChannelStats() {
|
|
8968
|
+
return request({
|
|
8969
|
+
method: "GET",
|
|
8970
|
+
baseUrl: this.baseUrl,
|
|
8971
|
+
path: RED_TEAM_CHANNELS_STATS_PATH,
|
|
8972
|
+
responseSchema: ChannelStatsSchema,
|
|
8973
|
+
auth: this.auth,
|
|
8974
|
+
numRetries: this.numRetries
|
|
8975
|
+
});
|
|
8976
|
+
}
|
|
8977
|
+
/**
|
|
8978
|
+
* Get a network broker channel by UUID.
|
|
8979
|
+
* @param channelId - The channel UUID.
|
|
8980
|
+
* @returns The channel.
|
|
8981
|
+
* @example
|
|
8982
|
+
* ```ts
|
|
8983
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
8984
|
+
* const rt = new RedTeamClient();
|
|
8985
|
+
*
|
|
8986
|
+
* const channel = await rt.networkBroker.getChannel('550e8400-e29b-41d4-a716-446655440000');
|
|
8987
|
+
* // channel =>
|
|
8988
|
+
* // { uuid: '550e8400-...', name: 'prod-broker', status: 'ONLINE' }
|
|
8989
|
+
* ```
|
|
8990
|
+
*/
|
|
8991
|
+
async getChannel(channelId) {
|
|
8992
|
+
assertUuid(channelId, "channel id");
|
|
8993
|
+
return request({
|
|
8994
|
+
method: "GET",
|
|
8995
|
+
baseUrl: this.baseUrl,
|
|
8996
|
+
path: `${RED_TEAM_CHANNELS_PATH}/${channelId}`,
|
|
8997
|
+
responseSchema: ChannelSchema,
|
|
8998
|
+
auth: this.auth,
|
|
8999
|
+
numRetries: this.numRetries
|
|
9000
|
+
});
|
|
9001
|
+
}
|
|
9002
|
+
/**
|
|
9003
|
+
* Update a network broker channel's name or description.
|
|
9004
|
+
* @param channelId - The channel UUID.
|
|
9005
|
+
* @param body - Channel update request body.
|
|
9006
|
+
* @returns The updated channel.
|
|
9007
|
+
* @example
|
|
9008
|
+
* ```ts
|
|
9009
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
9010
|
+
* const rt = new RedTeamClient();
|
|
9011
|
+
*
|
|
9012
|
+
* const channel = await rt.networkBroker.updateChannel('550e8400-e29b-41d4-a716-446655440000', {
|
|
9013
|
+
* description: 'Updated description',
|
|
9014
|
+
* });
|
|
9015
|
+
* // channel =>
|
|
9016
|
+
* // { uuid: '550e8400-...', name: 'prod-broker', description: 'Updated description', status: 'ONLINE' }
|
|
9017
|
+
* ```
|
|
9018
|
+
*/
|
|
9019
|
+
async updateChannel(channelId, body) {
|
|
9020
|
+
assertUuid(channelId, "channel id");
|
|
9021
|
+
return request({
|
|
9022
|
+
method: "PATCH",
|
|
9023
|
+
baseUrl: this.baseUrl,
|
|
9024
|
+
path: `${RED_TEAM_CHANNELS_PATH}/${channelId}`,
|
|
9025
|
+
body,
|
|
9026
|
+
responseSchema: ChannelSchema,
|
|
9027
|
+
auth: this.auth,
|
|
9028
|
+
numRetries: this.numRetries
|
|
9029
|
+
});
|
|
9030
|
+
}
|
|
9031
|
+
};
|
|
9032
|
+
|
|
8455
9033
|
// src/red-team/client.ts
|
|
8456
9034
|
var RedTeamClient = class {
|
|
8457
9035
|
/** Data plane scan operations. */
|
|
@@ -8468,6 +9046,8 @@ var RedTeamClient = class {
|
|
|
8468
9046
|
eula;
|
|
8469
9047
|
/** Management plane instance/licensing operations. */
|
|
8470
9048
|
instances;
|
|
9049
|
+
/** Network broker channel operations (distinct network broker base URL). */
|
|
9050
|
+
networkBroker;
|
|
8471
9051
|
dataEndpoint;
|
|
8472
9052
|
mgmtEndpoint;
|
|
8473
9053
|
auth;
|
|
@@ -8475,6 +9055,7 @@ var RedTeamClient = class {
|
|
|
8475
9055
|
constructor(opts = {}) {
|
|
8476
9056
|
const dataEndpoint = opts.dataEndpoint ?? process.env[RED_TEAM_DATA_ENDPOINT] ?? DEFAULT_RED_TEAM_DATA_ENDPOINT;
|
|
8477
9057
|
const mgmtEndpoint = opts.mgmtEndpoint ?? process.env[RED_TEAM_MGMT_ENDPOINT] ?? DEFAULT_RED_TEAM_MGMT_ENDPOINT;
|
|
9058
|
+
const networkBrokerEndpoint = opts.networkBrokerEndpoint ?? process.env[RED_TEAM_NETWORK_BROKER_ENDPOINT] ?? DEFAULT_RED_TEAM_NETWORK_BROKER_ENDPOINT;
|
|
8478
9059
|
const { oauthClient, numRetries } = resolveOAuthConfig({
|
|
8479
9060
|
clientId: opts.clientId,
|
|
8480
9061
|
clientSecret: opts.clientSecret,
|
|
@@ -8505,6 +9086,11 @@ var RedTeamClient = class {
|
|
|
8505
9086
|
});
|
|
8506
9087
|
this.eula = new RedTeamEulaClient({ baseUrl: mgmtEndpoint, auth, numRetries });
|
|
8507
9088
|
this.instances = new RedTeamInstancesClient({ baseUrl: mgmtEndpoint, auth, numRetries });
|
|
9089
|
+
this.networkBroker = new RedTeamNetworkBrokerClient({
|
|
9090
|
+
baseUrl: networkBrokerEndpoint,
|
|
9091
|
+
auth,
|
|
9092
|
+
numRetries
|
|
9093
|
+
});
|
|
8508
9094
|
}
|
|
8509
9095
|
// -----------------------------------------------------------------------
|
|
8510
9096
|
// Data plane convenience methods
|
|
@@ -8613,6 +9199,82 @@ var RedTeamClient = class {
|
|
|
8613
9199
|
numRetries: this.numRetries
|
|
8614
9200
|
});
|
|
8615
9201
|
}
|
|
9202
|
+
/**
|
|
9203
|
+
* List profiling error logs for a target (data plane).
|
|
9204
|
+
* @param targetId - The target UUID.
|
|
9205
|
+
* @param opts - Optional pagination/search options (the endpoint honors `limit`).
|
|
9206
|
+
* @returns The paginated list of target-profile error logs.
|
|
9207
|
+
* @example
|
|
9208
|
+
* ```ts
|
|
9209
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
9210
|
+
* const rt = new RedTeamClient();
|
|
9211
|
+
*
|
|
9212
|
+
* const logs = await rt.getTargetProfileErrorLogs('550e8400-e29b-41d4-a716-446655440000', { limit: 10 });
|
|
9213
|
+
* // logs =>
|
|
9214
|
+
* // { pagination: { total_items: 1 }, data: [{ target_id: '550e8400-...', error_type: 'PROBE', error_message: '...', created_at: '2025-01-01T00:00:00Z' }] }
|
|
9215
|
+
* ```
|
|
9216
|
+
*/
|
|
9217
|
+
async getTargetProfileErrorLogs(targetId, opts) {
|
|
9218
|
+
assertUuid(targetId, "target id");
|
|
9219
|
+
return request({
|
|
9220
|
+
method: "GET",
|
|
9221
|
+
baseUrl: this.dataEndpoint,
|
|
9222
|
+
path: `${RED_TEAM_ERROR_LOG_TARGET_PROFILE_PATH}/${targetId}`,
|
|
9223
|
+
params: serializeListing(opts),
|
|
9224
|
+
responseSchema: ErrorLogListResponseSchema,
|
|
9225
|
+
auth: this.auth,
|
|
9226
|
+
numRetries: this.numRetries
|
|
9227
|
+
});
|
|
9228
|
+
}
|
|
9229
|
+
/**
|
|
9230
|
+
* Get the tenant's allowed languages for Red Team scans (data plane).
|
|
9231
|
+
* @returns The supported-languages response.
|
|
9232
|
+
* @example
|
|
9233
|
+
* ```ts
|
|
9234
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
9235
|
+
* const rt = new RedTeamClient();
|
|
9236
|
+
*
|
|
9237
|
+
* const langs = await rt.getLanguages();
|
|
9238
|
+
* // langs =>
|
|
9239
|
+
* // { multilingual_enabled: true, supported_job_types: ['STATIC', 'DYNAMIC'],
|
|
9240
|
+
* // languages: [{ code: 'en', name: 'English' }, { code: 'es', name: 'Spanish' }] }
|
|
9241
|
+
* ```
|
|
9242
|
+
*/
|
|
9243
|
+
async getLanguages() {
|
|
9244
|
+
return request({
|
|
9245
|
+
method: "GET",
|
|
9246
|
+
baseUrl: this.dataEndpoint,
|
|
9247
|
+
path: RED_TEAM_LANGUAGES_PATH,
|
|
9248
|
+
responseSchema: TenantLanguagesResponseSchema,
|
|
9249
|
+
auth: this.auth,
|
|
9250
|
+
numRetries: this.numRetries
|
|
9251
|
+
});
|
|
9252
|
+
}
|
|
9253
|
+
/**
|
|
9254
|
+
* Get the tenant's allowed languages from the management plane.
|
|
9255
|
+
* Same response shape as {@link RedTeamClient.getLanguages}, served from the management endpoint.
|
|
9256
|
+
* @returns The supported-languages response.
|
|
9257
|
+
* @example
|
|
9258
|
+
* ```ts
|
|
9259
|
+
* import { RedTeamClient } from '@cdot65/prisma-airs-sdk';
|
|
9260
|
+
* const rt = new RedTeamClient();
|
|
9261
|
+
*
|
|
9262
|
+
* const langs = await rt.getManagementLanguages();
|
|
9263
|
+
* // langs =>
|
|
9264
|
+
* // { multilingual_enabled: true, supported_job_types: ['STATIC', 'DYNAMIC'],
|
|
9265
|
+
* // languages: [{ code: 'en', name: 'English' }] }
|
|
9266
|
+
* ```
|
|
9267
|
+
*/
|
|
9268
|
+
async getManagementLanguages() {
|
|
9269
|
+
return request({
|
|
9270
|
+
method: "GET",
|
|
9271
|
+
baseUrl: this.mgmtEndpoint,
|
|
9272
|
+
path: RED_TEAM_LANGUAGES_PATH,
|
|
9273
|
+
responseSchema: TenantLanguagesResponseSchema,
|
|
9274
|
+
auth: this.auth,
|
|
9275
|
+
numRetries: this.numRetries
|
|
9276
|
+
});
|
|
9277
|
+
}
|
|
8616
9278
|
/**
|
|
8617
9279
|
* Update sentiment for a scan report.
|
|
8618
9280
|
* @param body - The sentiment request body.
|
|
@@ -8740,6 +9402,12 @@ export {
|
|
|
8740
9402
|
CategoryModelSchema,
|
|
8741
9403
|
CategoryReportSchema,
|
|
8742
9404
|
CgReportSchema,
|
|
9405
|
+
ChannelListPaginationSchema,
|
|
9406
|
+
ChannelListResponseSchema,
|
|
9407
|
+
ChannelSchema,
|
|
9408
|
+
ChannelStatsSchema,
|
|
9409
|
+
ChannelStatus,
|
|
9410
|
+
ChannelStatusSchema,
|
|
8743
9411
|
ClientIdAndCustomerAppSchema,
|
|
8744
9412
|
CmdEntrySchema,
|
|
8745
9413
|
CmdInjectReportSchema,
|
|
@@ -8753,6 +9421,7 @@ export {
|
|
|
8753
9421
|
ContentErrorType,
|
|
8754
9422
|
CountByNameSchema,
|
|
8755
9423
|
CountedQuotaEnum,
|
|
9424
|
+
CreateChannelRequestSchema,
|
|
8756
9425
|
CreateCustomTopicRequestSchema,
|
|
8757
9426
|
CreateSecurityProfileRequestSchema,
|
|
8758
9427
|
CustomAttackOutputSchema,
|
|
@@ -8787,6 +9456,7 @@ export {
|
|
|
8787
9456
|
DEFAULT_MODEL_SEC_MGMT_ENDPOINT,
|
|
8788
9457
|
DEFAULT_RED_TEAM_DATA_ENDPOINT,
|
|
8789
9458
|
DEFAULT_RED_TEAM_MGMT_ENDPOINT,
|
|
9459
|
+
DEFAULT_RED_TEAM_NETWORK_BROKER_ENDPOINT,
|
|
8790
9460
|
DEFAULT_TOKEN_ENDPOINT,
|
|
8791
9461
|
DLP_DATA_FILTERING_PROFILES_PATH,
|
|
8792
9462
|
DLP_DATA_PATTERNS_PATH,
|
|
@@ -8928,6 +9598,7 @@ export {
|
|
|
8928
9598
|
LabelValueListSchema,
|
|
8929
9599
|
LabelsCreateRequestSchema,
|
|
8930
9600
|
LabelsResponseSchema,
|
|
9601
|
+
LanguageOptionSchema,
|
|
8931
9602
|
ListModelSecurityGroupsResponseSchema,
|
|
8932
9603
|
ListModelSecurityRuleInstancesResponseSchema,
|
|
8933
9604
|
ListModelSecurityRulesResponseSchema,
|
|
@@ -8973,6 +9644,8 @@ export {
|
|
|
8973
9644
|
MODEL_SEC_DATA_ENDPOINT,
|
|
8974
9645
|
MODEL_SEC_EVALUATIONS_PATH,
|
|
8975
9646
|
MODEL_SEC_MGMT_ENDPOINT,
|
|
9647
|
+
MODEL_SEC_MODELS_PATH,
|
|
9648
|
+
MODEL_SEC_MODEL_VERSIONS_PATH,
|
|
8976
9649
|
MODEL_SEC_PYPI_AUTH_PATH,
|
|
8977
9650
|
MODEL_SEC_SCANS_PATH,
|
|
8978
9651
|
MODEL_SEC_SECURITY_GROUPS_PATH,
|
|
@@ -8989,7 +9662,9 @@ export {
|
|
|
8989
9662
|
MetadataCriterionSchema,
|
|
8990
9663
|
MetadataSchema,
|
|
8991
9664
|
ModelConfigurationSchema,
|
|
9665
|
+
ModelListSchema,
|
|
8992
9666
|
ModelProtectionItemSchema,
|
|
9667
|
+
ModelResponseSchema,
|
|
8993
9668
|
ModelScanIssueSchema,
|
|
8994
9669
|
ModelScanStatus,
|
|
8995
9670
|
ModelSecurityClient,
|
|
@@ -8998,12 +9673,15 @@ export {
|
|
|
8998
9673
|
ModelSecurityGroupState,
|
|
8999
9674
|
ModelSecurityGroupUpdateRequestSchema,
|
|
9000
9675
|
ModelSecurityGroupsClient,
|
|
9676
|
+
ModelSecurityModelsClient,
|
|
9001
9677
|
ModelSecurityPaginationSchema,
|
|
9002
9678
|
ModelSecurityRuleInstanceResponseSchema,
|
|
9003
9679
|
ModelSecurityRuleInstanceUpdateRequestSchema,
|
|
9004
9680
|
ModelSecurityRuleResponseSchema,
|
|
9005
9681
|
ModelSecurityRulesClient,
|
|
9006
9682
|
ModelSecurityScansClient,
|
|
9683
|
+
ModelVersionListSchema,
|
|
9684
|
+
ModelVersionResponseSchema,
|
|
9007
9685
|
MultiProfileDataNodeSchema,
|
|
9008
9686
|
MultiProfileDetectionRuleSchema,
|
|
9009
9687
|
MultiTurnStatefulConfigSchema,
|
|
@@ -9048,6 +9726,8 @@ export {
|
|
|
9048
9726
|
QuotaDetailsSchema,
|
|
9049
9727
|
QuotaSummarySchema,
|
|
9050
9728
|
RED_TEAM_CATEGORIES_PATH,
|
|
9729
|
+
RED_TEAM_CHANNELS_PATH,
|
|
9730
|
+
RED_TEAM_CHANNELS_STATS_PATH,
|
|
9051
9731
|
RED_TEAM_CLIENT_ID,
|
|
9052
9732
|
RED_TEAM_CLIENT_SECRET,
|
|
9053
9733
|
RED_TEAM_CUSTOM_ATTACKS_REPORT_PATH,
|
|
@@ -9055,10 +9735,13 @@ export {
|
|
|
9055
9735
|
RED_TEAM_DASHBOARD_PATH,
|
|
9056
9736
|
RED_TEAM_DATA_ENDPOINT,
|
|
9057
9737
|
RED_TEAM_ERROR_LOG_PATH,
|
|
9738
|
+
RED_TEAM_ERROR_LOG_TARGET_PROFILE_PATH,
|
|
9058
9739
|
RED_TEAM_EULA_PATH,
|
|
9059
9740
|
RED_TEAM_INSTANCES_PATH,
|
|
9741
|
+
RED_TEAM_LANGUAGES_PATH,
|
|
9060
9742
|
RED_TEAM_MGMT_DASHBOARD_PATH,
|
|
9061
9743
|
RED_TEAM_MGMT_ENDPOINT,
|
|
9744
|
+
RED_TEAM_NETWORK_BROKER_ENDPOINT,
|
|
9062
9745
|
RED_TEAM_QUOTA_PATH,
|
|
9063
9746
|
RED_TEAM_REGISTRY_CREDENTIALS_PATH,
|
|
9064
9747
|
RED_TEAM_REPORT_DYNAMIC_PATH,
|
|
@@ -9078,6 +9761,7 @@ export {
|
|
|
9078
9761
|
RedTeamErrorType,
|
|
9079
9762
|
RedTeamEulaClient,
|
|
9080
9763
|
RedTeamInstancesClient,
|
|
9764
|
+
RedTeamNetworkBrokerClient,
|
|
9081
9765
|
RedTeamPaginationSchema,
|
|
9082
9766
|
RedTeamReportsClient,
|
|
9083
9767
|
RedTeamScansClient,
|
|
@@ -9180,6 +9864,7 @@ export {
|
|
|
9180
9864
|
TargetType,
|
|
9181
9865
|
TargetUpdateRequestSchema,
|
|
9182
9866
|
TcReportSchema,
|
|
9867
|
+
TenantLanguagesResponseSchema,
|
|
9183
9868
|
TgReportSchema,
|
|
9184
9869
|
ThreatCategory,
|
|
9185
9870
|
ThreatScanReportSchema,
|
|
@@ -9195,11 +9880,13 @@ export {
|
|
|
9195
9880
|
TopicsClient,
|
|
9196
9881
|
URLExclusionSchema,
|
|
9197
9882
|
USER_AGENT,
|
|
9883
|
+
UpdateChannelRequestSchema,
|
|
9198
9884
|
UrlCategorySchema,
|
|
9199
9885
|
UrlfEntrySchema,
|
|
9200
9886
|
ValidationErrorSchema,
|
|
9201
9887
|
Verdict,
|
|
9202
9888
|
ViolationListSchema,
|
|
9889
|
+
ViolationRemediationSchema,
|
|
9203
9890
|
ViolationResponseSchema,
|
|
9204
9891
|
ViolationSeverityCountsSchema,
|
|
9205
9892
|
WebSocketConnectionParamsSchema,
|