@cdot65/prisma-airs-sdk 0.6.4 → 0.6.6
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/dist/index.cjs +366 -134
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +397 -128
- package/dist/index.d.ts +397 -128
- package/dist/index.js +366 -134
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
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.6.
|
|
32
|
+
var SDK_VERSION = "0.6.6";
|
|
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";
|
|
@@ -194,7 +194,8 @@ function sleep(ms) {
|
|
|
194
194
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
195
195
|
}
|
|
196
196
|
function backoffDelay(attempt) {
|
|
197
|
-
|
|
197
|
+
const maxDelay = Math.pow(2, attempt) * 1e3;
|
|
198
|
+
return Math.floor(Math.random() * (maxDelay + 1));
|
|
198
199
|
}
|
|
199
200
|
function isRetryableStatus(status) {
|
|
200
201
|
return HTTP_FORCE_RETRY_STATUS_CODES.includes(status);
|
|
@@ -257,6 +258,11 @@ var UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
|
257
258
|
function isValidUuid(value) {
|
|
258
259
|
return UUID_RE.test(value);
|
|
259
260
|
}
|
|
261
|
+
function validateJobId(jobId) {
|
|
262
|
+
if (!isValidUuid(jobId)) {
|
|
263
|
+
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
260
266
|
function generatePayloadHash(payload, secret) {
|
|
261
267
|
return createHmac("sha256", secret).update(payload).digest("hex");
|
|
262
268
|
}
|
|
@@ -522,7 +528,10 @@ var Content = class _Content {
|
|
|
522
528
|
set toolEvent(value) {
|
|
523
529
|
this._toolEvent = value;
|
|
524
530
|
}
|
|
525
|
-
/**
|
|
531
|
+
/**
|
|
532
|
+
* Total byte length of all text content fields.
|
|
533
|
+
* @returns Combined byte length of all text content fields.
|
|
534
|
+
*/
|
|
526
535
|
get length() {
|
|
527
536
|
let total = 0;
|
|
528
537
|
if (this._prompt) total += Buffer.byteLength(this._prompt);
|
|
@@ -532,7 +541,10 @@ var Content = class _Content {
|
|
|
532
541
|
if (this._codeResponse) total += Buffer.byteLength(this._codeResponse);
|
|
533
542
|
return total;
|
|
534
543
|
}
|
|
535
|
-
/**
|
|
544
|
+
/**
|
|
545
|
+
* Serialize to the API request format.
|
|
546
|
+
* @returns The content as a scan request contents inner object.
|
|
547
|
+
*/
|
|
536
548
|
toJSON() {
|
|
537
549
|
const obj = {};
|
|
538
550
|
if (this._prompt !== void 0) obj.prompt = this._prompt;
|
|
@@ -560,6 +572,7 @@ var Content = class _Content {
|
|
|
560
572
|
/**
|
|
561
573
|
* Load content from a JSON file.
|
|
562
574
|
* @param filePath - Path to JSON file containing scan request contents.
|
|
575
|
+
* @returns A new Content instance populated from the JSON file.
|
|
563
576
|
*/
|
|
564
577
|
static fromJSONFile(filePath) {
|
|
565
578
|
const raw = readFileSync(filePath, "utf-8");
|
|
@@ -912,7 +925,7 @@ var ErrorResponseSchema = z15.object({
|
|
|
912
925
|
retry_after: z15.object({
|
|
913
926
|
interval: z15.number().optional(),
|
|
914
927
|
unit: z15.string().optional()
|
|
915
|
-
}).optional()
|
|
928
|
+
}).passthrough().optional()
|
|
916
929
|
}).passthrough();
|
|
917
930
|
|
|
918
931
|
// src/models/mgmt-security-profile.ts
|
|
@@ -1076,12 +1089,12 @@ var ApiKeyCreateRequestSchema = z18.object({
|
|
|
1076
1089
|
api_key_name: z18.string(),
|
|
1077
1090
|
rotation_time_interval: z18.number(),
|
|
1078
1091
|
rotation_time_unit: z18.string()
|
|
1079
|
-
});
|
|
1092
|
+
}).passthrough();
|
|
1080
1093
|
var ApiKeyRegenerateRequestSchema = z18.object({
|
|
1081
1094
|
rotation_time_interval: z18.number(),
|
|
1082
1095
|
rotation_time_unit: z18.string(),
|
|
1083
1096
|
updated_by: z18.string().optional()
|
|
1084
|
-
});
|
|
1097
|
+
}).passthrough();
|
|
1085
1098
|
var ApiKeyListResponseSchema = z18.object({
|
|
1086
1099
|
api_keys: z18.array(ApiKeySchema).optional(),
|
|
1087
1100
|
next_offset: z18.number().optional()
|
|
@@ -1250,7 +1263,7 @@ import { z as z23 } from "zod";
|
|
|
1250
1263
|
var ClientIdAndCustomerAppSchema = z23.object({
|
|
1251
1264
|
client_id: z23.string(),
|
|
1252
1265
|
customer_app: z23.string()
|
|
1253
|
-
});
|
|
1266
|
+
}).passthrough();
|
|
1254
1267
|
var Oauth2TokenSchema = z23.object({
|
|
1255
1268
|
token_type: z23.string().optional(),
|
|
1256
1269
|
issued_at: z23.string().optional(),
|
|
@@ -2744,12 +2757,17 @@ var OAuthClient = class {
|
|
|
2744
2757
|
});
|
|
2745
2758
|
return this.pendingFetch;
|
|
2746
2759
|
}
|
|
2747
|
-
/**
|
|
2760
|
+
/**
|
|
2761
|
+
* Clear the cached token, forcing a fresh fetch on next call.
|
|
2762
|
+
*/
|
|
2748
2763
|
clearToken() {
|
|
2749
2764
|
this.accessToken = null;
|
|
2750
2765
|
this.expiresAt = 0;
|
|
2751
2766
|
}
|
|
2752
|
-
/**
|
|
2767
|
+
/**
|
|
2768
|
+
* Check if the current token has passed its expiry time. Returns true if no token exists.
|
|
2769
|
+
* @returns Whether the token is expired.
|
|
2770
|
+
*/
|
|
2753
2771
|
isTokenExpired() {
|
|
2754
2772
|
if (!this.accessToken) return true;
|
|
2755
2773
|
return Date.now() >= this.expiresAt;
|
|
@@ -2758,6 +2776,7 @@ var OAuthClient = class {
|
|
|
2758
2776
|
* Check if the token is within the pre-expiry buffer window.
|
|
2759
2777
|
* Returns true if no token exists.
|
|
2760
2778
|
* @param bufferMs - Custom buffer in ms. Defaults to the configured `tokenBufferMs`.
|
|
2779
|
+
* @returns Whether the token is expiring soon.
|
|
2761
2780
|
*/
|
|
2762
2781
|
isTokenExpiringSoon(bufferMs) {
|
|
2763
2782
|
if (!this.accessToken) return true;
|
|
@@ -3086,7 +3105,7 @@ var TopicsClient = class {
|
|
|
3086
3105
|
/**
|
|
3087
3106
|
* Force-delete a custom topic, removing it from any referencing profiles.
|
|
3088
3107
|
* @param topicId - UUID of the topic to force-delete.
|
|
3089
|
-
* @param updatedBy - Email of the user performing the deletion.
|
|
3108
|
+
* @param updatedBy - Optional. Email of the user performing the deletion.
|
|
3090
3109
|
* @returns Deletion confirmation message.
|
|
3091
3110
|
*/
|
|
3092
3111
|
async forceDelete(topicId, updatedBy) {
|
|
@@ -3953,6 +3972,7 @@ var ModelSecurityGroupsClient = class {
|
|
|
3953
3972
|
/**
|
|
3954
3973
|
* Delete a security group.
|
|
3955
3974
|
* @param uuid - Security group UUID.
|
|
3975
|
+
* @returns Resolves when the security group is deleted.
|
|
3956
3976
|
*/
|
|
3957
3977
|
async delete(uuid) {
|
|
3958
3978
|
if (!isValidUuid(uuid)) {
|
|
@@ -4189,14 +4209,16 @@ var ModelSecurityClient = class {
|
|
|
4189
4209
|
}
|
|
4190
4210
|
};
|
|
4191
4211
|
|
|
4192
|
-
// src/red-team/
|
|
4193
|
-
function
|
|
4212
|
+
// src/red-team/list-params.ts
|
|
4213
|
+
function buildRedTeamListParams(opts) {
|
|
4194
4214
|
const params = {};
|
|
4195
4215
|
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
4196
4216
|
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
4197
4217
|
if (opts?.search !== void 0) params.search = opts.search;
|
|
4198
4218
|
return params;
|
|
4199
4219
|
}
|
|
4220
|
+
|
|
4221
|
+
// src/red-team/scans-client.ts
|
|
4200
4222
|
var RedTeamScansClient = class {
|
|
4201
4223
|
baseUrl;
|
|
4202
4224
|
oauthClient;
|
|
@@ -4222,9 +4244,13 @@ var RedTeamScansClient = class {
|
|
|
4222
4244
|
});
|
|
4223
4245
|
return res.data;
|
|
4224
4246
|
}
|
|
4225
|
-
/**
|
|
4247
|
+
/**
|
|
4248
|
+
* List red team scan jobs with optional filters.
|
|
4249
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
4250
|
+
* @returns The paginated list of scan jobs.
|
|
4251
|
+
*/
|
|
4226
4252
|
async list(opts) {
|
|
4227
|
-
const params =
|
|
4253
|
+
const params = buildRedTeamListParams(opts);
|
|
4228
4254
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
4229
4255
|
if (opts?.job_type !== void 0) params.job_type = opts.job_type;
|
|
4230
4256
|
if (opts?.target_id !== void 0) params.target_id = opts.target_id;
|
|
@@ -4238,7 +4264,11 @@ var RedTeamScansClient = class {
|
|
|
4238
4264
|
});
|
|
4239
4265
|
return res.data;
|
|
4240
4266
|
}
|
|
4241
|
-
/**
|
|
4267
|
+
/**
|
|
4268
|
+
* Get a single scan job by ID.
|
|
4269
|
+
* @param jobId - The job UUID.
|
|
4270
|
+
* @returns The job response.
|
|
4271
|
+
*/
|
|
4242
4272
|
async get(jobId) {
|
|
4243
4273
|
if (!isValidUuid(jobId)) {
|
|
4244
4274
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -4252,7 +4282,11 @@ var RedTeamScansClient = class {
|
|
|
4252
4282
|
});
|
|
4253
4283
|
return res.data;
|
|
4254
4284
|
}
|
|
4255
|
-
/**
|
|
4285
|
+
/**
|
|
4286
|
+
* Abort a running scan job.
|
|
4287
|
+
* @param jobId - The job UUID.
|
|
4288
|
+
* @returns The abort response.
|
|
4289
|
+
*/
|
|
4256
4290
|
async abort(jobId) {
|
|
4257
4291
|
if (!isValidUuid(jobId)) {
|
|
4258
4292
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -4266,7 +4300,10 @@ var RedTeamScansClient = class {
|
|
|
4266
4300
|
});
|
|
4267
4301
|
return res.data;
|
|
4268
4302
|
}
|
|
4269
|
-
/**
|
|
4303
|
+
/**
|
|
4304
|
+
* Get all categories with subcategories.
|
|
4305
|
+
* @returns The list of category models.
|
|
4306
|
+
*/
|
|
4270
4307
|
async getCategories() {
|
|
4271
4308
|
const res = await managementHttpRequest({
|
|
4272
4309
|
method: "GET",
|
|
@@ -4280,18 +4317,6 @@ var RedTeamScansClient = class {
|
|
|
4280
4317
|
};
|
|
4281
4318
|
|
|
4282
4319
|
// src/red-team/reports-client.ts
|
|
4283
|
-
function buildListParams2(opts) {
|
|
4284
|
-
const params = {};
|
|
4285
|
-
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
4286
|
-
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
4287
|
-
if (opts?.search !== void 0) params.search = opts.search;
|
|
4288
|
-
return params;
|
|
4289
|
-
}
|
|
4290
|
-
function validateJobId(jobId) {
|
|
4291
|
-
if (!isValidUuid(jobId)) {
|
|
4292
|
-
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
4293
|
-
}
|
|
4294
|
-
}
|
|
4295
4320
|
var RedTeamReportsClient = class {
|
|
4296
4321
|
baseUrl;
|
|
4297
4322
|
oauthClient;
|
|
@@ -4304,10 +4329,15 @@ var RedTeamReportsClient = class {
|
|
|
4304
4329
|
// -----------------------------------------------------------------------
|
|
4305
4330
|
// Static (attack library) report endpoints
|
|
4306
4331
|
// -----------------------------------------------------------------------
|
|
4307
|
-
/**
|
|
4332
|
+
/**
|
|
4333
|
+
* List attacks for a static scan.
|
|
4334
|
+
* @param jobId - The job UUID.
|
|
4335
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
4336
|
+
* @returns The paginated list of attacks.
|
|
4337
|
+
*/
|
|
4308
4338
|
async listAttacks(jobId, opts) {
|
|
4309
4339
|
validateJobId(jobId);
|
|
4310
|
-
const params =
|
|
4340
|
+
const params = buildRedTeamListParams(opts);
|
|
4311
4341
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
4312
4342
|
if (opts?.severity !== void 0) params.severity = opts.severity;
|
|
4313
4343
|
if (opts?.category !== void 0) params.category = opts.category;
|
|
@@ -4324,7 +4354,12 @@ var RedTeamReportsClient = class {
|
|
|
4324
4354
|
});
|
|
4325
4355
|
return res.data;
|
|
4326
4356
|
}
|
|
4327
|
-
/**
|
|
4357
|
+
/**
|
|
4358
|
+
* Get attack details for a static scan.
|
|
4359
|
+
* @param jobId - The job UUID.
|
|
4360
|
+
* @param attackId - The attack UUID.
|
|
4361
|
+
* @returns The attack detail response.
|
|
4362
|
+
*/
|
|
4328
4363
|
async getAttackDetail(jobId, attackId) {
|
|
4329
4364
|
validateJobId(jobId);
|
|
4330
4365
|
if (!isValidUuid(attackId)) {
|
|
@@ -4342,7 +4377,12 @@ var RedTeamReportsClient = class {
|
|
|
4342
4377
|
});
|
|
4343
4378
|
return res.data;
|
|
4344
4379
|
}
|
|
4345
|
-
/**
|
|
4380
|
+
/**
|
|
4381
|
+
* Get multi-turn attack details for a static scan.
|
|
4382
|
+
* @param jobId - The job UUID.
|
|
4383
|
+
* @param attackId - The attack UUID.
|
|
4384
|
+
* @returns The multi-turn attack detail response.
|
|
4385
|
+
*/
|
|
4346
4386
|
async getMultiTurnAttackDetail(jobId, attackId) {
|
|
4347
4387
|
validateJobId(jobId);
|
|
4348
4388
|
if (!isValidUuid(attackId)) {
|
|
@@ -4360,7 +4400,11 @@ var RedTeamReportsClient = class {
|
|
|
4360
4400
|
});
|
|
4361
4401
|
return res.data;
|
|
4362
4402
|
}
|
|
4363
|
-
/**
|
|
4403
|
+
/**
|
|
4404
|
+
* Get the attack library report for a static scan.
|
|
4405
|
+
* @param jobId - The job UUID.
|
|
4406
|
+
* @returns The static job report.
|
|
4407
|
+
*/
|
|
4364
4408
|
async getStaticReport(jobId) {
|
|
4365
4409
|
validateJobId(jobId);
|
|
4366
4410
|
const res = await managementHttpRequest({
|
|
@@ -4372,7 +4416,11 @@ var RedTeamReportsClient = class {
|
|
|
4372
4416
|
});
|
|
4373
4417
|
return res.data;
|
|
4374
4418
|
}
|
|
4375
|
-
/**
|
|
4419
|
+
/**
|
|
4420
|
+
* Get remediation recommendations for a static scan.
|
|
4421
|
+
* @param jobId - The job UUID.
|
|
4422
|
+
* @returns The remediation response.
|
|
4423
|
+
*/
|
|
4376
4424
|
async getStaticRemediation(jobId) {
|
|
4377
4425
|
validateJobId(jobId);
|
|
4378
4426
|
const res = await managementHttpRequest({
|
|
@@ -4384,7 +4432,11 @@ var RedTeamReportsClient = class {
|
|
|
4384
4432
|
});
|
|
4385
4433
|
return res.data;
|
|
4386
4434
|
}
|
|
4387
|
-
/**
|
|
4435
|
+
/**
|
|
4436
|
+
* Get runtime security profile config for a static scan.
|
|
4437
|
+
* @param jobId - The job UUID.
|
|
4438
|
+
* @returns The runtime security profile response.
|
|
4439
|
+
*/
|
|
4388
4440
|
async getStaticRuntimePolicy(jobId) {
|
|
4389
4441
|
validateJobId(jobId);
|
|
4390
4442
|
const res = await managementHttpRequest({
|
|
@@ -4399,7 +4451,11 @@ var RedTeamReportsClient = class {
|
|
|
4399
4451
|
// -----------------------------------------------------------------------
|
|
4400
4452
|
// Dynamic (agent) report endpoints
|
|
4401
4453
|
// -----------------------------------------------------------------------
|
|
4402
|
-
/**
|
|
4454
|
+
/**
|
|
4455
|
+
* Get the agent scan report for a dynamic scan.
|
|
4456
|
+
* @param jobId - The job UUID.
|
|
4457
|
+
* @returns The dynamic job report.
|
|
4458
|
+
*/
|
|
4403
4459
|
async getDynamicReport(jobId) {
|
|
4404
4460
|
validateJobId(jobId);
|
|
4405
4461
|
const res = await managementHttpRequest({
|
|
@@ -4411,7 +4467,11 @@ var RedTeamReportsClient = class {
|
|
|
4411
4467
|
});
|
|
4412
4468
|
return res.data;
|
|
4413
4469
|
}
|
|
4414
|
-
/**
|
|
4470
|
+
/**
|
|
4471
|
+
* Get remediation recommendations for a dynamic scan.
|
|
4472
|
+
* @param jobId - The job UUID.
|
|
4473
|
+
* @returns The remediation response.
|
|
4474
|
+
*/
|
|
4415
4475
|
async getDynamicRemediation(jobId) {
|
|
4416
4476
|
validateJobId(jobId);
|
|
4417
4477
|
const res = await managementHttpRequest({
|
|
@@ -4423,7 +4483,11 @@ var RedTeamReportsClient = class {
|
|
|
4423
4483
|
});
|
|
4424
4484
|
return res.data;
|
|
4425
4485
|
}
|
|
4426
|
-
/**
|
|
4486
|
+
/**
|
|
4487
|
+
* Get runtime security profile config for a dynamic scan.
|
|
4488
|
+
* @param jobId - The job UUID.
|
|
4489
|
+
* @returns The runtime security profile response.
|
|
4490
|
+
*/
|
|
4427
4491
|
async getDynamicRuntimePolicy(jobId) {
|
|
4428
4492
|
validateJobId(jobId);
|
|
4429
4493
|
const res = await managementHttpRequest({
|
|
@@ -4435,10 +4499,15 @@ var RedTeamReportsClient = class {
|
|
|
4435
4499
|
});
|
|
4436
4500
|
return res.data;
|
|
4437
4501
|
}
|
|
4438
|
-
/**
|
|
4502
|
+
/**
|
|
4503
|
+
* List goals for a dynamic scan.
|
|
4504
|
+
* @param jobId - The job UUID.
|
|
4505
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
4506
|
+
* @returns The paginated list of goals.
|
|
4507
|
+
*/
|
|
4439
4508
|
async listGoals(jobId, opts) {
|
|
4440
4509
|
validateJobId(jobId);
|
|
4441
|
-
const params =
|
|
4510
|
+
const params = buildRedTeamListParams(opts);
|
|
4442
4511
|
if (opts?.goal_type !== void 0) params.goal_type = opts.goal_type;
|
|
4443
4512
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
4444
4513
|
if (opts?.count !== void 0) params.count = String(opts.count);
|
|
@@ -4452,7 +4521,13 @@ var RedTeamReportsClient = class {
|
|
|
4452
4521
|
});
|
|
4453
4522
|
return res.data;
|
|
4454
4523
|
}
|
|
4455
|
-
/**
|
|
4524
|
+
/**
|
|
4525
|
+
* List streams for a goal in a dynamic scan.
|
|
4526
|
+
* @param jobId - The job UUID.
|
|
4527
|
+
* @param goalId - The goal UUID.
|
|
4528
|
+
* @param opts - Optional pagination and search options.
|
|
4529
|
+
* @returns The paginated list of streams.
|
|
4530
|
+
*/
|
|
4456
4531
|
async listGoalStreams(jobId, goalId, opts) {
|
|
4457
4532
|
validateJobId(jobId);
|
|
4458
4533
|
if (!isValidUuid(goalId)) {
|
|
@@ -4465,7 +4540,7 @@ var RedTeamReportsClient = class {
|
|
|
4465
4540
|
method: "GET",
|
|
4466
4541
|
baseUrl: this.baseUrl,
|
|
4467
4542
|
path: `${RED_TEAM_REPORT_DYNAMIC_PATH}/${jobId}/goal/${goalId}/list-streams`,
|
|
4468
|
-
params:
|
|
4543
|
+
params: buildRedTeamListParams(opts),
|
|
4469
4544
|
oauthClient: this.oauthClient,
|
|
4470
4545
|
numRetries: this.numRetries
|
|
4471
4546
|
});
|
|
@@ -4474,7 +4549,11 @@ var RedTeamReportsClient = class {
|
|
|
4474
4549
|
// -----------------------------------------------------------------------
|
|
4475
4550
|
// Common report endpoints
|
|
4476
4551
|
// -----------------------------------------------------------------------
|
|
4477
|
-
/**
|
|
4552
|
+
/**
|
|
4553
|
+
* Get stream details by stream ID.
|
|
4554
|
+
* @param streamId - The stream UUID.
|
|
4555
|
+
* @returns The stream detail response.
|
|
4556
|
+
*/
|
|
4478
4557
|
async getStreamDetail(streamId) {
|
|
4479
4558
|
if (!isValidUuid(streamId)) {
|
|
4480
4559
|
throw new AISecSDKException(
|
|
@@ -4491,7 +4570,12 @@ var RedTeamReportsClient = class {
|
|
|
4491
4570
|
});
|
|
4492
4571
|
return res.data;
|
|
4493
4572
|
}
|
|
4494
|
-
/**
|
|
4573
|
+
/**
|
|
4574
|
+
* Download a report in the specified format.
|
|
4575
|
+
* @param jobId - The job UUID.
|
|
4576
|
+
* @param format - The file format (e.g. "pdf", "csv").
|
|
4577
|
+
* @returns The report data in the requested format (untyped — shape depends on `format`).
|
|
4578
|
+
*/
|
|
4495
4579
|
async downloadReport(jobId, format) {
|
|
4496
4580
|
validateJobId(jobId);
|
|
4497
4581
|
const params = { file_format: format };
|
|
@@ -4505,7 +4589,11 @@ var RedTeamReportsClient = class {
|
|
|
4505
4589
|
});
|
|
4506
4590
|
return res.data;
|
|
4507
4591
|
}
|
|
4508
|
-
/**
|
|
4592
|
+
/**
|
|
4593
|
+
* Generate a partial report for a running scan.
|
|
4594
|
+
* @param jobId - The job UUID.
|
|
4595
|
+
* @returns The partial report payload (untyped — schema not yet defined by the API).
|
|
4596
|
+
*/
|
|
4509
4597
|
async generatePartialReport(jobId) {
|
|
4510
4598
|
validateJobId(jobId);
|
|
4511
4599
|
const res = await managementHttpRequest({
|
|
@@ -4520,18 +4608,6 @@ var RedTeamReportsClient = class {
|
|
|
4520
4608
|
};
|
|
4521
4609
|
|
|
4522
4610
|
// src/red-team/custom-attack-reports-client.ts
|
|
4523
|
-
function buildListParams3(opts) {
|
|
4524
|
-
const params = {};
|
|
4525
|
-
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
4526
|
-
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
4527
|
-
if (opts?.search !== void 0) params.search = opts.search;
|
|
4528
|
-
return params;
|
|
4529
|
-
}
|
|
4530
|
-
function validateJobId2(jobId) {
|
|
4531
|
-
if (!isValidUuid(jobId)) {
|
|
4532
|
-
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
4533
|
-
}
|
|
4534
|
-
}
|
|
4535
4611
|
var RedTeamCustomAttackReportsClient = class {
|
|
4536
4612
|
baseUrl;
|
|
4537
4613
|
oauthClient;
|
|
@@ -4541,9 +4617,13 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4541
4617
|
this.oauthClient = opts.oauthClient;
|
|
4542
4618
|
this.numRetries = opts.numRetries;
|
|
4543
4619
|
}
|
|
4544
|
-
/**
|
|
4620
|
+
/**
|
|
4621
|
+
* Get custom attack report for a scan.
|
|
4622
|
+
* @param jobId - The job UUID.
|
|
4623
|
+
* @returns The custom attack report response.
|
|
4624
|
+
*/
|
|
4545
4625
|
async getReport(jobId) {
|
|
4546
|
-
|
|
4626
|
+
validateJobId(jobId);
|
|
4547
4627
|
const res = await managementHttpRequest({
|
|
4548
4628
|
method: "GET",
|
|
4549
4629
|
baseUrl: this.baseUrl,
|
|
@@ -4553,9 +4633,13 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4553
4633
|
});
|
|
4554
4634
|
return res.data;
|
|
4555
4635
|
}
|
|
4556
|
-
/**
|
|
4636
|
+
/**
|
|
4637
|
+
* Get prompt sets for a custom attack scan.
|
|
4638
|
+
* @param jobId - The job UUID.
|
|
4639
|
+
* @returns The prompt sets report response.
|
|
4640
|
+
*/
|
|
4557
4641
|
async getPromptSets(jobId) {
|
|
4558
|
-
|
|
4642
|
+
validateJobId(jobId);
|
|
4559
4643
|
const res = await managementHttpRequest({
|
|
4560
4644
|
method: "GET",
|
|
4561
4645
|
baseUrl: this.baseUrl,
|
|
@@ -4565,16 +4649,22 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4565
4649
|
});
|
|
4566
4650
|
return res.data;
|
|
4567
4651
|
}
|
|
4568
|
-
/**
|
|
4652
|
+
/**
|
|
4653
|
+
* Get prompts for a specific prompt set in a scan.
|
|
4654
|
+
* @param jobId - The job UUID.
|
|
4655
|
+
* @param promptSetId - The prompt set UUID.
|
|
4656
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
4657
|
+
* @returns The list of prompt detail responses.
|
|
4658
|
+
*/
|
|
4569
4659
|
async getPromptsBySet(jobId, promptSetId, opts) {
|
|
4570
|
-
|
|
4660
|
+
validateJobId(jobId);
|
|
4571
4661
|
if (!isValidUuid(promptSetId)) {
|
|
4572
4662
|
throw new AISecSDKException(
|
|
4573
4663
|
`Invalid prompt set id: ${promptSetId}`,
|
|
4574
4664
|
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
4575
4665
|
);
|
|
4576
4666
|
}
|
|
4577
|
-
const params =
|
|
4667
|
+
const params = buildRedTeamListParams(opts);
|
|
4578
4668
|
if (opts?.is_threat !== void 0) params.is_threat = String(opts.is_threat);
|
|
4579
4669
|
const res = await managementHttpRequest({
|
|
4580
4670
|
method: "GET",
|
|
@@ -4586,9 +4676,14 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4586
4676
|
});
|
|
4587
4677
|
return res.data;
|
|
4588
4678
|
}
|
|
4589
|
-
/**
|
|
4679
|
+
/**
|
|
4680
|
+
* Get details for a specific prompt.
|
|
4681
|
+
* @param jobId - The job UUID.
|
|
4682
|
+
* @param promptId - The prompt UUID.
|
|
4683
|
+
* @returns The prompt detail response.
|
|
4684
|
+
*/
|
|
4590
4685
|
async getPromptDetail(jobId, promptId) {
|
|
4591
|
-
|
|
4686
|
+
validateJobId(jobId);
|
|
4592
4687
|
if (!isValidUuid(promptId)) {
|
|
4593
4688
|
throw new AISecSDKException(
|
|
4594
4689
|
`Invalid prompt id: ${promptId}`,
|
|
@@ -4604,10 +4699,15 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4604
4699
|
});
|
|
4605
4700
|
return res.data;
|
|
4606
4701
|
}
|
|
4607
|
-
/**
|
|
4702
|
+
/**
|
|
4703
|
+
* List custom attacks for a scan.
|
|
4704
|
+
* @param jobId - The job UUID.
|
|
4705
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
4706
|
+
* @returns The paginated list of custom attacks.
|
|
4707
|
+
*/
|
|
4608
4708
|
async listCustomAttacks(jobId, opts) {
|
|
4609
|
-
|
|
4610
|
-
const params =
|
|
4709
|
+
validateJobId(jobId);
|
|
4710
|
+
const params = buildRedTeamListParams(opts);
|
|
4611
4711
|
if (opts?.threat !== void 0) params.threat = String(opts.threat);
|
|
4612
4712
|
if (opts?.prompt_set_id !== void 0) params.prompt_set_id = opts.prompt_set_id;
|
|
4613
4713
|
if (opts?.property_value !== void 0) params.property_value = opts.property_value;
|
|
@@ -4621,9 +4721,14 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4621
4721
|
});
|
|
4622
4722
|
return res.data;
|
|
4623
4723
|
}
|
|
4624
|
-
/**
|
|
4724
|
+
/**
|
|
4725
|
+
* Get attack outputs for a custom attack.
|
|
4726
|
+
* @param jobId - The job UUID.
|
|
4727
|
+
* @param attackId - The attack UUID.
|
|
4728
|
+
* @returns The list of attack outputs.
|
|
4729
|
+
*/
|
|
4625
4730
|
async getAttackOutputs(jobId, attackId) {
|
|
4626
|
-
|
|
4731
|
+
validateJobId(jobId);
|
|
4627
4732
|
if (!isValidUuid(attackId)) {
|
|
4628
4733
|
throw new AISecSDKException(
|
|
4629
4734
|
`Invalid attack id: ${attackId}`,
|
|
@@ -4639,9 +4744,13 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4639
4744
|
});
|
|
4640
4745
|
return res.data;
|
|
4641
4746
|
}
|
|
4642
|
-
/**
|
|
4747
|
+
/**
|
|
4748
|
+
* Get property statistics for a custom attack scan.
|
|
4749
|
+
* @param jobId - The job UUID.
|
|
4750
|
+
* @returns The list of property statistics.
|
|
4751
|
+
*/
|
|
4643
4752
|
async getPropertyStats(jobId) {
|
|
4644
|
-
|
|
4753
|
+
validateJobId(jobId);
|
|
4645
4754
|
const res = await managementHttpRequest({
|
|
4646
4755
|
method: "GET",
|
|
4647
4756
|
baseUrl: this.baseUrl,
|
|
@@ -4654,13 +4763,6 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4654
4763
|
};
|
|
4655
4764
|
|
|
4656
4765
|
// src/red-team/targets-client.ts
|
|
4657
|
-
function buildListParams4(opts) {
|
|
4658
|
-
const params = {};
|
|
4659
|
-
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
4660
|
-
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
4661
|
-
if (opts?.search !== void 0) params.search = opts.search;
|
|
4662
|
-
return params;
|
|
4663
|
-
}
|
|
4664
4766
|
var RedTeamTargetsClient = class {
|
|
4665
4767
|
baseUrl;
|
|
4666
4768
|
oauthClient;
|
|
@@ -4690,9 +4792,13 @@ var RedTeamTargetsClient = class {
|
|
|
4690
4792
|
});
|
|
4691
4793
|
return res.data;
|
|
4692
4794
|
}
|
|
4693
|
-
/**
|
|
4795
|
+
/**
|
|
4796
|
+
* List targets with optional filters.
|
|
4797
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
4798
|
+
* @returns The paginated list of targets.
|
|
4799
|
+
*/
|
|
4694
4800
|
async list(opts) {
|
|
4695
|
-
const params =
|
|
4801
|
+
const params = buildRedTeamListParams(opts);
|
|
4696
4802
|
if (opts?.target_type !== void 0) params.target_type = opts.target_type;
|
|
4697
4803
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
4698
4804
|
const res = await managementHttpRequest({
|
|
@@ -4705,7 +4811,11 @@ var RedTeamTargetsClient = class {
|
|
|
4705
4811
|
});
|
|
4706
4812
|
return res.data;
|
|
4707
4813
|
}
|
|
4708
|
-
/**
|
|
4814
|
+
/**
|
|
4815
|
+
* Get a target by UUID.
|
|
4816
|
+
* @param uuid - The target UUID.
|
|
4817
|
+
* @returns The target response.
|
|
4818
|
+
*/
|
|
4709
4819
|
async get(uuid) {
|
|
4710
4820
|
if (!isValidUuid(uuid)) {
|
|
4711
4821
|
throw new AISecSDKException(
|
|
@@ -4722,7 +4832,13 @@ var RedTeamTargetsClient = class {
|
|
|
4722
4832
|
});
|
|
4723
4833
|
return res.data;
|
|
4724
4834
|
}
|
|
4725
|
-
/**
|
|
4835
|
+
/**
|
|
4836
|
+
* Update a target.
|
|
4837
|
+
* @param uuid - The target UUID.
|
|
4838
|
+
* @param request - Target update request body.
|
|
4839
|
+
* @param opts - Optional operation options (e.g. validate connection).
|
|
4840
|
+
* @returns The updated target response.
|
|
4841
|
+
*/
|
|
4726
4842
|
async update(uuid, request, opts) {
|
|
4727
4843
|
if (!isValidUuid(uuid)) {
|
|
4728
4844
|
throw new AISecSDKException(
|
|
@@ -4743,7 +4859,11 @@ var RedTeamTargetsClient = class {
|
|
|
4743
4859
|
});
|
|
4744
4860
|
return res.data;
|
|
4745
4861
|
}
|
|
4746
|
-
/**
|
|
4862
|
+
/**
|
|
4863
|
+
* Delete a target.
|
|
4864
|
+
* @param uuid - The target UUID.
|
|
4865
|
+
* @returns The delete response.
|
|
4866
|
+
*/
|
|
4747
4867
|
async delete(uuid) {
|
|
4748
4868
|
if (!isValidUuid(uuid)) {
|
|
4749
4869
|
throw new AISecSDKException(
|
|
@@ -4760,7 +4880,11 @@ var RedTeamTargetsClient = class {
|
|
|
4760
4880
|
});
|
|
4761
4881
|
return res.data;
|
|
4762
4882
|
}
|
|
4763
|
-
/**
|
|
4883
|
+
/**
|
|
4884
|
+
* Run profiling probes on a target.
|
|
4885
|
+
* @param request - The probe request body.
|
|
4886
|
+
* @returns The target response after probing.
|
|
4887
|
+
*/
|
|
4764
4888
|
async probe(request) {
|
|
4765
4889
|
const res = await managementHttpRequest({
|
|
4766
4890
|
method: "POST",
|
|
@@ -4772,7 +4896,11 @@ var RedTeamTargetsClient = class {
|
|
|
4772
4896
|
});
|
|
4773
4897
|
return res.data;
|
|
4774
4898
|
}
|
|
4775
|
-
/**
|
|
4899
|
+
/**
|
|
4900
|
+
* Get profiling results for a target.
|
|
4901
|
+
* @param uuid - The target UUID.
|
|
4902
|
+
* @returns The target profile response.
|
|
4903
|
+
*/
|
|
4776
4904
|
async getProfile(uuid) {
|
|
4777
4905
|
if (!isValidUuid(uuid)) {
|
|
4778
4906
|
throw new AISecSDKException(
|
|
@@ -4789,7 +4917,12 @@ var RedTeamTargetsClient = class {
|
|
|
4789
4917
|
});
|
|
4790
4918
|
return res.data;
|
|
4791
4919
|
}
|
|
4792
|
-
/**
|
|
4920
|
+
/**
|
|
4921
|
+
* Update a target profile (background + additional context).
|
|
4922
|
+
* @param uuid - The target UUID.
|
|
4923
|
+
* @param request - The context update request body.
|
|
4924
|
+
* @returns The updated target response.
|
|
4925
|
+
*/
|
|
4793
4926
|
async updateProfile(uuid, request) {
|
|
4794
4927
|
if (!isValidUuid(uuid)) {
|
|
4795
4928
|
throw new AISecSDKException(
|
|
@@ -4810,13 +4943,6 @@ var RedTeamTargetsClient = class {
|
|
|
4810
4943
|
};
|
|
4811
4944
|
|
|
4812
4945
|
// src/red-team/custom-attacks-client.ts
|
|
4813
|
-
function buildListParams5(opts) {
|
|
4814
|
-
const params = {};
|
|
4815
|
-
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
4816
|
-
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
4817
|
-
if (opts?.search !== void 0) params.search = opts.search;
|
|
4818
|
-
return params;
|
|
4819
|
-
}
|
|
4820
4946
|
function validateUuid(uuid, label) {
|
|
4821
4947
|
if (!isValidUuid(uuid)) {
|
|
4822
4948
|
throw new AISecSDKException(`Invalid ${label}: ${uuid}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -4834,7 +4960,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4834
4960
|
// -----------------------------------------------------------------------
|
|
4835
4961
|
// Prompt Set operations
|
|
4836
4962
|
// -----------------------------------------------------------------------
|
|
4837
|
-
/**
|
|
4963
|
+
/**
|
|
4964
|
+
* Create a new custom prompt set.
|
|
4965
|
+
* @param request - Prompt set creation request body.
|
|
4966
|
+
* @returns The created prompt set response.
|
|
4967
|
+
*/
|
|
4838
4968
|
async createPromptSet(request) {
|
|
4839
4969
|
const res = await managementHttpRequest({
|
|
4840
4970
|
method: "POST",
|
|
@@ -4846,9 +4976,13 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4846
4976
|
});
|
|
4847
4977
|
return res.data;
|
|
4848
4978
|
}
|
|
4849
|
-
/**
|
|
4979
|
+
/**
|
|
4980
|
+
* List custom prompt sets.
|
|
4981
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
4982
|
+
* @returns The paginated list of prompt sets.
|
|
4983
|
+
*/
|
|
4850
4984
|
async listPromptSets(opts) {
|
|
4851
|
-
const params =
|
|
4985
|
+
const params = buildRedTeamListParams(opts);
|
|
4852
4986
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
4853
4987
|
if (opts?.active !== void 0) params.active = String(opts.active);
|
|
4854
4988
|
if (opts?.archive !== void 0) params.archive = String(opts.archive);
|
|
@@ -4862,7 +4996,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4862
4996
|
});
|
|
4863
4997
|
return res.data;
|
|
4864
4998
|
}
|
|
4865
|
-
/**
|
|
4999
|
+
/**
|
|
5000
|
+
* Get a prompt set by UUID.
|
|
5001
|
+
* @param uuid - The prompt set UUID.
|
|
5002
|
+
* @returns The prompt set response.
|
|
5003
|
+
*/
|
|
4866
5004
|
async getPromptSet(uuid) {
|
|
4867
5005
|
validateUuid(uuid, "prompt set uuid");
|
|
4868
5006
|
const res = await managementHttpRequest({
|
|
@@ -4874,7 +5012,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4874
5012
|
});
|
|
4875
5013
|
return res.data;
|
|
4876
5014
|
}
|
|
4877
|
-
/**
|
|
5015
|
+
/**
|
|
5016
|
+
* Update a prompt set.
|
|
5017
|
+
* @param uuid - The prompt set UUID.
|
|
5018
|
+
* @param request - Prompt set update request body.
|
|
5019
|
+
* @returns The updated prompt set response.
|
|
5020
|
+
*/
|
|
4878
5021
|
async updatePromptSet(uuid, request) {
|
|
4879
5022
|
validateUuid(uuid, "prompt set uuid");
|
|
4880
5023
|
const res = await managementHttpRequest({
|
|
@@ -4887,7 +5030,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4887
5030
|
});
|
|
4888
5031
|
return res.data;
|
|
4889
5032
|
}
|
|
4890
|
-
/**
|
|
5033
|
+
/**
|
|
5034
|
+
* Archive or unarchive a prompt set.
|
|
5035
|
+
* @param uuid - The prompt set UUID.
|
|
5036
|
+
* @param request - Archive request body.
|
|
5037
|
+
* @returns The updated prompt set response.
|
|
5038
|
+
*/
|
|
4891
5039
|
async archivePromptSet(uuid, request) {
|
|
4892
5040
|
validateUuid(uuid, "prompt set uuid");
|
|
4893
5041
|
const res = await managementHttpRequest({
|
|
@@ -4900,7 +5048,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4900
5048
|
});
|
|
4901
5049
|
return res.data;
|
|
4902
5050
|
}
|
|
4903
|
-
/**
|
|
5051
|
+
/**
|
|
5052
|
+
* Resolve a prompt set reference for data plane consumption.
|
|
5053
|
+
* @param uuid - The prompt set UUID.
|
|
5054
|
+
* @returns The prompt set reference.
|
|
5055
|
+
*/
|
|
4904
5056
|
async getPromptSetReference(uuid) {
|
|
4905
5057
|
validateUuid(uuid, "prompt set uuid");
|
|
4906
5058
|
const res = await managementHttpRequest({
|
|
@@ -4912,7 +5064,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4912
5064
|
});
|
|
4913
5065
|
return res.data;
|
|
4914
5066
|
}
|
|
4915
|
-
/**
|
|
5067
|
+
/**
|
|
5068
|
+
* Get version information for a prompt set.
|
|
5069
|
+
* @param uuid - The prompt set UUID.
|
|
5070
|
+
* @returns The prompt set version info.
|
|
5071
|
+
*/
|
|
4916
5072
|
async getPromptSetVersionInfo(uuid) {
|
|
4917
5073
|
validateUuid(uuid, "prompt set uuid");
|
|
4918
5074
|
const res = await managementHttpRequest({
|
|
@@ -4924,7 +5080,10 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4924
5080
|
});
|
|
4925
5081
|
return res.data;
|
|
4926
5082
|
}
|
|
4927
|
-
/**
|
|
5083
|
+
/**
|
|
5084
|
+
* List active prompt sets (for data plane).
|
|
5085
|
+
* @returns The list of active prompt sets.
|
|
5086
|
+
*/
|
|
4928
5087
|
async listActivePromptSets() {
|
|
4929
5088
|
const res = await managementHttpRequest({
|
|
4930
5089
|
method: "GET",
|
|
@@ -4935,7 +5094,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4935
5094
|
});
|
|
4936
5095
|
return res.data;
|
|
4937
5096
|
}
|
|
4938
|
-
/**
|
|
5097
|
+
/**
|
|
5098
|
+
* Download CSV template for a prompt set.
|
|
5099
|
+
* @param uuid - The prompt set UUID.
|
|
5100
|
+
* @returns The CSV template content (untyped — raw response from the API).
|
|
5101
|
+
*/
|
|
4939
5102
|
async downloadTemplate(uuid) {
|
|
4940
5103
|
validateUuid(uuid, "prompt set uuid");
|
|
4941
5104
|
const res = await managementHttpRequest({
|
|
@@ -4947,7 +5110,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4947
5110
|
});
|
|
4948
5111
|
return res.data;
|
|
4949
5112
|
}
|
|
4950
|
-
/**
|
|
5113
|
+
/**
|
|
5114
|
+
* Upload a CSV file of custom prompts for a prompt set.
|
|
5115
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5116
|
+
* @param file - The CSV file blob.
|
|
5117
|
+
* @returns The upload response.
|
|
5118
|
+
*/
|
|
4951
5119
|
async uploadPromptsCsv(promptSetUuid, file) {
|
|
4952
5120
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
4953
5121
|
const token = await this.oauthClient.getToken();
|
|
@@ -4977,7 +5145,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4977
5145
|
// -----------------------------------------------------------------------
|
|
4978
5146
|
// Prompt operations
|
|
4979
5147
|
// -----------------------------------------------------------------------
|
|
4980
|
-
/**
|
|
5148
|
+
/**
|
|
5149
|
+
* Create a new custom prompt.
|
|
5150
|
+
* @param request - Prompt creation request body.
|
|
5151
|
+
* @returns The created prompt response.
|
|
5152
|
+
*/
|
|
4981
5153
|
async createPrompt(request) {
|
|
4982
5154
|
const res = await managementHttpRequest({
|
|
4983
5155
|
method: "POST",
|
|
@@ -4989,10 +5161,15 @@ var RedTeamCustomAttacksClient = class {
|
|
|
4989
5161
|
});
|
|
4990
5162
|
return res.data;
|
|
4991
5163
|
}
|
|
4992
|
-
/**
|
|
5164
|
+
/**
|
|
5165
|
+
* List prompts in a prompt set.
|
|
5166
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5167
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
5168
|
+
* @returns The paginated list of prompts.
|
|
5169
|
+
*/
|
|
4993
5170
|
async listPrompts(promptSetUuid, opts) {
|
|
4994
5171
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
4995
|
-
const params =
|
|
5172
|
+
const params = buildRedTeamListParams(opts);
|
|
4996
5173
|
if (opts?.active !== void 0) params.active = String(opts.active);
|
|
4997
5174
|
const res = await managementHttpRequest({
|
|
4998
5175
|
method: "GET",
|
|
@@ -5004,7 +5181,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5004
5181
|
});
|
|
5005
5182
|
return res.data;
|
|
5006
5183
|
}
|
|
5007
|
-
/**
|
|
5184
|
+
/**
|
|
5185
|
+
* Get a prompt by UUID.
|
|
5186
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5187
|
+
* @param promptUuid - The prompt UUID.
|
|
5188
|
+
* @returns The prompt response.
|
|
5189
|
+
*/
|
|
5008
5190
|
async getPrompt(promptSetUuid, promptUuid) {
|
|
5009
5191
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
5010
5192
|
validateUuid(promptUuid, "prompt uuid");
|
|
@@ -5017,7 +5199,13 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5017
5199
|
});
|
|
5018
5200
|
return res.data;
|
|
5019
5201
|
}
|
|
5020
|
-
/**
|
|
5202
|
+
/**
|
|
5203
|
+
* Update a prompt.
|
|
5204
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5205
|
+
* @param promptUuid - The prompt UUID.
|
|
5206
|
+
* @param request - Prompt update request body.
|
|
5207
|
+
* @returns The updated prompt response.
|
|
5208
|
+
*/
|
|
5021
5209
|
async updatePrompt(promptSetUuid, promptUuid, request) {
|
|
5022
5210
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
5023
5211
|
validateUuid(promptUuid, "prompt uuid");
|
|
@@ -5031,7 +5219,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5031
5219
|
});
|
|
5032
5220
|
return res.data;
|
|
5033
5221
|
}
|
|
5034
|
-
/**
|
|
5222
|
+
/**
|
|
5223
|
+
* Delete a prompt.
|
|
5224
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5225
|
+
* @param promptUuid - The prompt UUID.
|
|
5226
|
+
* @returns The delete response.
|
|
5227
|
+
*/
|
|
5035
5228
|
async deletePrompt(promptSetUuid, promptUuid) {
|
|
5036
5229
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
5037
5230
|
validateUuid(promptUuid, "prompt uuid");
|
|
@@ -5047,7 +5240,10 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5047
5240
|
// -----------------------------------------------------------------------
|
|
5048
5241
|
// Property operations
|
|
5049
5242
|
// -----------------------------------------------------------------------
|
|
5050
|
-
/**
|
|
5243
|
+
/**
|
|
5244
|
+
* Get all property names.
|
|
5245
|
+
* @returns The list of property names.
|
|
5246
|
+
*/
|
|
5051
5247
|
async getPropertyNames() {
|
|
5052
5248
|
const res = await managementHttpRequest({
|
|
5053
5249
|
method: "GET",
|
|
@@ -5058,7 +5254,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5058
5254
|
});
|
|
5059
5255
|
return res.data;
|
|
5060
5256
|
}
|
|
5061
|
-
/**
|
|
5257
|
+
/**
|
|
5258
|
+
* Create a new property name.
|
|
5259
|
+
* @param request - Property name creation request body.
|
|
5260
|
+
* @returns The creation response.
|
|
5261
|
+
*/
|
|
5062
5262
|
async createPropertyName(request) {
|
|
5063
5263
|
const res = await managementHttpRequest({
|
|
5064
5264
|
method: "POST",
|
|
@@ -5070,7 +5270,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5070
5270
|
});
|
|
5071
5271
|
return res.data;
|
|
5072
5272
|
}
|
|
5073
|
-
/**
|
|
5273
|
+
/**
|
|
5274
|
+
* Get values for a property name.
|
|
5275
|
+
* @param propertyName - The property name to look up.
|
|
5276
|
+
* @returns The property values response.
|
|
5277
|
+
*/
|
|
5074
5278
|
async getPropertyValues(propertyName) {
|
|
5075
5279
|
const res = await managementHttpRequest({
|
|
5076
5280
|
method: "GET",
|
|
@@ -5081,7 +5285,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5081
5285
|
});
|
|
5082
5286
|
return res.data;
|
|
5083
5287
|
}
|
|
5084
|
-
/**
|
|
5288
|
+
/**
|
|
5289
|
+
* Get values for multiple property names.
|
|
5290
|
+
* @param propertyNames - Array of property names to look up.
|
|
5291
|
+
* @returns The property values for all requested names.
|
|
5292
|
+
*/
|
|
5085
5293
|
async getPropertyValuesMultiple(propertyNames) {
|
|
5086
5294
|
const url = new URL(`https://placeholder${RED_TEAM_CUSTOM_ATTACK_PATH}/property-values`);
|
|
5087
5295
|
for (const name of propertyNames) {
|
|
@@ -5098,7 +5306,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5098
5306
|
});
|
|
5099
5307
|
return res.data;
|
|
5100
5308
|
}
|
|
5101
|
-
/**
|
|
5309
|
+
/**
|
|
5310
|
+
* Create a property value.
|
|
5311
|
+
* @param request - Property value creation request body.
|
|
5312
|
+
* @returns The creation response.
|
|
5313
|
+
*/
|
|
5102
5314
|
async createPropertyValue(request) {
|
|
5103
5315
|
const res = await managementHttpRequest({
|
|
5104
5316
|
method: "POST",
|
|
@@ -5113,13 +5325,6 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5113
5325
|
};
|
|
5114
5326
|
|
|
5115
5327
|
// src/red-team/client.ts
|
|
5116
|
-
function buildListParams6(opts) {
|
|
5117
|
-
const params = {};
|
|
5118
|
-
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
5119
|
-
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
5120
|
-
if (opts?.search !== void 0) params.search = opts.search;
|
|
5121
|
-
return params;
|
|
5122
|
-
}
|
|
5123
5328
|
var RedTeamClient = class {
|
|
5124
5329
|
/** Data plane scan operations. */
|
|
5125
5330
|
scans;
|
|
@@ -5197,7 +5402,11 @@ var RedTeamClient = class {
|
|
|
5197
5402
|
// -----------------------------------------------------------------------
|
|
5198
5403
|
// Data plane convenience methods
|
|
5199
5404
|
// -----------------------------------------------------------------------
|
|
5200
|
-
/**
|
|
5405
|
+
/**
|
|
5406
|
+
* Get scan statistics and risk profile (data plane dashboard).
|
|
5407
|
+
* @param params - Optional date range and target ID filters.
|
|
5408
|
+
* @returns The scan statistics response.
|
|
5409
|
+
*/
|
|
5201
5410
|
async getScanStatistics(params) {
|
|
5202
5411
|
const p = {};
|
|
5203
5412
|
if (params?.date_range !== void 0) p.date_range = params.date_range;
|
|
@@ -5212,7 +5421,11 @@ var RedTeamClient = class {
|
|
|
5212
5421
|
});
|
|
5213
5422
|
return res.data;
|
|
5214
5423
|
}
|
|
5215
|
-
/**
|
|
5424
|
+
/**
|
|
5425
|
+
* Get score trend for a target (data plane dashboard).
|
|
5426
|
+
* @param targetId - The target UUID.
|
|
5427
|
+
* @returns The score trend response.
|
|
5428
|
+
*/
|
|
5216
5429
|
async getScoreTrend(targetId) {
|
|
5217
5430
|
if (!isValidUuid(targetId)) {
|
|
5218
5431
|
throw new AISecSDKException(
|
|
@@ -5230,7 +5443,10 @@ var RedTeamClient = class {
|
|
|
5230
5443
|
});
|
|
5231
5444
|
return res.data;
|
|
5232
5445
|
}
|
|
5233
|
-
/**
|
|
5446
|
+
/**
|
|
5447
|
+
* Get quota summary.
|
|
5448
|
+
* @returns The quota summary.
|
|
5449
|
+
*/
|
|
5234
5450
|
async getQuota() {
|
|
5235
5451
|
const res = await managementHttpRequest({
|
|
5236
5452
|
method: "POST",
|
|
@@ -5241,7 +5457,12 @@ var RedTeamClient = class {
|
|
|
5241
5457
|
});
|
|
5242
5458
|
return res.data;
|
|
5243
5459
|
}
|
|
5244
|
-
/**
|
|
5460
|
+
/**
|
|
5461
|
+
* List error logs for a scan job.
|
|
5462
|
+
* @param jobId - The job UUID.
|
|
5463
|
+
* @param opts - Optional pagination and search options.
|
|
5464
|
+
* @returns The paginated list of error logs.
|
|
5465
|
+
*/
|
|
5245
5466
|
async getErrorLogs(jobId, opts) {
|
|
5246
5467
|
if (!isValidUuid(jobId)) {
|
|
5247
5468
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -5250,13 +5471,17 @@ var RedTeamClient = class {
|
|
|
5250
5471
|
method: "GET",
|
|
5251
5472
|
baseUrl: this.dataEndpoint,
|
|
5252
5473
|
path: `${RED_TEAM_ERROR_LOG_PATH}/${jobId}`,
|
|
5253
|
-
params:
|
|
5474
|
+
params: buildRedTeamListParams(opts),
|
|
5254
5475
|
oauthClient: this.oauthClient,
|
|
5255
5476
|
numRetries: this.numRetries
|
|
5256
5477
|
});
|
|
5257
5478
|
return res.data;
|
|
5258
5479
|
}
|
|
5259
|
-
/**
|
|
5480
|
+
/**
|
|
5481
|
+
* Update sentiment for a scan report.
|
|
5482
|
+
* @param request - The sentiment request body.
|
|
5483
|
+
* @returns The sentiment response.
|
|
5484
|
+
*/
|
|
5260
5485
|
async updateSentiment(request) {
|
|
5261
5486
|
const res = await managementHttpRequest({
|
|
5262
5487
|
method: "POST",
|
|
@@ -5268,7 +5493,11 @@ var RedTeamClient = class {
|
|
|
5268
5493
|
});
|
|
5269
5494
|
return res.data;
|
|
5270
5495
|
}
|
|
5271
|
-
/**
|
|
5496
|
+
/**
|
|
5497
|
+
* Get sentiment for a scan report.
|
|
5498
|
+
* @param jobId - The job UUID.
|
|
5499
|
+
* @returns The sentiment response.
|
|
5500
|
+
*/
|
|
5272
5501
|
async getSentiment(jobId) {
|
|
5273
5502
|
if (!isValidUuid(jobId)) {
|
|
5274
5503
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -5285,7 +5514,10 @@ var RedTeamClient = class {
|
|
|
5285
5514
|
// -----------------------------------------------------------------------
|
|
5286
5515
|
// Management plane convenience methods
|
|
5287
5516
|
// -----------------------------------------------------------------------
|
|
5288
|
-
/**
|
|
5517
|
+
/**
|
|
5518
|
+
* Get management dashboard overview.
|
|
5519
|
+
* @returns The dashboard overview response.
|
|
5520
|
+
*/
|
|
5289
5521
|
async getDashboardOverview() {
|
|
5290
5522
|
const res = await managementHttpRequest({
|
|
5291
5523
|
method: "GET",
|