@cdot65/prisma-airs-sdk 0.6.4 → 0.6.5
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 +353 -116
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +396 -127
- package/dist/index.d.ts +396 -127
- package/dist/index.js +353 -116
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -430,7 +430,7 @@ var MAX_NUMBER_OF_BATCH_SCAN_OBJECTS = 5;
|
|
|
430
430
|
var MAX_CONNECTION_POOL_SIZE = 100;
|
|
431
431
|
var MAX_NUMBER_OF_RETRIES = 5;
|
|
432
432
|
var HTTP_FORCE_RETRY_STATUS_CODES = [500, 502, 503, 504];
|
|
433
|
-
var SDK_VERSION = "0.6.
|
|
433
|
+
var SDK_VERSION = "0.6.5";
|
|
434
434
|
var USER_AGENT = `PAN-AIRS/${SDK_VERSION}-typescript-sdk`;
|
|
435
435
|
var DEFAULT_MGMT_ENDPOINT = "https://api.sase.paloaltonetworks.com/aisec";
|
|
436
436
|
var DEFAULT_TOKEN_ENDPOINT = "https://auth.apps.paloaltonetworks.com/oauth2/access_token";
|
|
@@ -595,7 +595,8 @@ function sleep(ms) {
|
|
|
595
595
|
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
596
596
|
}
|
|
597
597
|
function backoffDelay(attempt) {
|
|
598
|
-
|
|
598
|
+
const maxDelay = Math.pow(2, attempt) * 1e3;
|
|
599
|
+
return Math.floor(Math.random() * (maxDelay + 1));
|
|
599
600
|
}
|
|
600
601
|
function isRetryableStatus(status) {
|
|
601
602
|
return HTTP_FORCE_RETRY_STATUS_CODES.includes(status);
|
|
@@ -923,7 +924,10 @@ var Content = class _Content {
|
|
|
923
924
|
set toolEvent(value) {
|
|
924
925
|
this._toolEvent = value;
|
|
925
926
|
}
|
|
926
|
-
/**
|
|
927
|
+
/**
|
|
928
|
+
* Total byte length of all text content fields.
|
|
929
|
+
* @returns Combined byte length of all text content fields.
|
|
930
|
+
*/
|
|
927
931
|
get length() {
|
|
928
932
|
let total = 0;
|
|
929
933
|
if (this._prompt) total += Buffer.byteLength(this._prompt);
|
|
@@ -933,7 +937,10 @@ var Content = class _Content {
|
|
|
933
937
|
if (this._codeResponse) total += Buffer.byteLength(this._codeResponse);
|
|
934
938
|
return total;
|
|
935
939
|
}
|
|
936
|
-
/**
|
|
940
|
+
/**
|
|
941
|
+
* Serialize to the API request format.
|
|
942
|
+
* @returns The content as a scan request contents inner object.
|
|
943
|
+
*/
|
|
937
944
|
toJSON() {
|
|
938
945
|
const obj = {};
|
|
939
946
|
if (this._prompt !== void 0) obj.prompt = this._prompt;
|
|
@@ -1313,7 +1320,7 @@ var ErrorResponseSchema = import_zod15.z.object({
|
|
|
1313
1320
|
retry_after: import_zod15.z.object({
|
|
1314
1321
|
interval: import_zod15.z.number().optional(),
|
|
1315
1322
|
unit: import_zod15.z.string().optional()
|
|
1316
|
-
}).optional()
|
|
1323
|
+
}).passthrough().optional()
|
|
1317
1324
|
}).passthrough();
|
|
1318
1325
|
|
|
1319
1326
|
// src/models/mgmt-security-profile.ts
|
|
@@ -1477,12 +1484,12 @@ var ApiKeyCreateRequestSchema = import_zod18.z.object({
|
|
|
1477
1484
|
api_key_name: import_zod18.z.string(),
|
|
1478
1485
|
rotation_time_interval: import_zod18.z.number(),
|
|
1479
1486
|
rotation_time_unit: import_zod18.z.string()
|
|
1480
|
-
});
|
|
1487
|
+
}).passthrough();
|
|
1481
1488
|
var ApiKeyRegenerateRequestSchema = import_zod18.z.object({
|
|
1482
1489
|
rotation_time_interval: import_zod18.z.number(),
|
|
1483
1490
|
rotation_time_unit: import_zod18.z.string(),
|
|
1484
1491
|
updated_by: import_zod18.z.string().optional()
|
|
1485
|
-
});
|
|
1492
|
+
}).passthrough();
|
|
1486
1493
|
var ApiKeyListResponseSchema = import_zod18.z.object({
|
|
1487
1494
|
api_keys: import_zod18.z.array(ApiKeySchema).optional(),
|
|
1488
1495
|
next_offset: import_zod18.z.number().optional()
|
|
@@ -1651,7 +1658,7 @@ var import_zod23 = require("zod");
|
|
|
1651
1658
|
var ClientIdAndCustomerAppSchema = import_zod23.z.object({
|
|
1652
1659
|
client_id: import_zod23.z.string(),
|
|
1653
1660
|
customer_app: import_zod23.z.string()
|
|
1654
|
-
});
|
|
1661
|
+
}).passthrough();
|
|
1655
1662
|
var Oauth2TokenSchema = import_zod23.z.object({
|
|
1656
1663
|
token_type: import_zod23.z.string().optional(),
|
|
1657
1664
|
issued_at: import_zod23.z.string().optional(),
|
|
@@ -3145,12 +3152,18 @@ var OAuthClient = class {
|
|
|
3145
3152
|
});
|
|
3146
3153
|
return this.pendingFetch;
|
|
3147
3154
|
}
|
|
3148
|
-
/**
|
|
3155
|
+
/**
|
|
3156
|
+
* Clear the cached token, forcing a fresh fetch on next call.
|
|
3157
|
+
* @returns Nothing.
|
|
3158
|
+
*/
|
|
3149
3159
|
clearToken() {
|
|
3150
3160
|
this.accessToken = null;
|
|
3151
3161
|
this.expiresAt = 0;
|
|
3152
3162
|
}
|
|
3153
|
-
/**
|
|
3163
|
+
/**
|
|
3164
|
+
* Check if the current token has passed its expiry time. Returns true if no token exists.
|
|
3165
|
+
* @returns Whether the token is expired.
|
|
3166
|
+
*/
|
|
3154
3167
|
isTokenExpired() {
|
|
3155
3168
|
if (!this.accessToken) return true;
|
|
3156
3169
|
return Date.now() >= this.expiresAt;
|
|
@@ -3159,6 +3172,7 @@ var OAuthClient = class {
|
|
|
3159
3172
|
* Check if the token is within the pre-expiry buffer window.
|
|
3160
3173
|
* Returns true if no token exists.
|
|
3161
3174
|
* @param bufferMs - Custom buffer in ms. Defaults to the configured `tokenBufferMs`.
|
|
3175
|
+
* @returns Whether the token is expiring soon.
|
|
3162
3176
|
*/
|
|
3163
3177
|
isTokenExpiringSoon(bufferMs) {
|
|
3164
3178
|
if (!this.accessToken) return true;
|
|
@@ -4354,6 +4368,7 @@ var ModelSecurityGroupsClient = class {
|
|
|
4354
4368
|
/**
|
|
4355
4369
|
* Delete a security group.
|
|
4356
4370
|
* @param uuid - Security group UUID.
|
|
4371
|
+
* @returns Resolves when the security group is deleted.
|
|
4357
4372
|
*/
|
|
4358
4373
|
async delete(uuid) {
|
|
4359
4374
|
if (!isValidUuid(uuid)) {
|
|
@@ -4590,14 +4605,16 @@ var ModelSecurityClient = class {
|
|
|
4590
4605
|
}
|
|
4591
4606
|
};
|
|
4592
4607
|
|
|
4593
|
-
// src/red-team/
|
|
4594
|
-
function
|
|
4608
|
+
// src/red-team/list-params.ts
|
|
4609
|
+
function buildRedTeamListParams(opts) {
|
|
4595
4610
|
const params = {};
|
|
4596
4611
|
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
4597
4612
|
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
4598
4613
|
if (opts?.search !== void 0) params.search = opts.search;
|
|
4599
4614
|
return params;
|
|
4600
4615
|
}
|
|
4616
|
+
|
|
4617
|
+
// src/red-team/scans-client.ts
|
|
4601
4618
|
var RedTeamScansClient = class {
|
|
4602
4619
|
baseUrl;
|
|
4603
4620
|
oauthClient;
|
|
@@ -4623,9 +4640,13 @@ var RedTeamScansClient = class {
|
|
|
4623
4640
|
});
|
|
4624
4641
|
return res.data;
|
|
4625
4642
|
}
|
|
4626
|
-
/**
|
|
4643
|
+
/**
|
|
4644
|
+
* List red team scan jobs with optional filters.
|
|
4645
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
4646
|
+
* @returns The paginated list of scan jobs.
|
|
4647
|
+
*/
|
|
4627
4648
|
async list(opts) {
|
|
4628
|
-
const params =
|
|
4649
|
+
const params = buildRedTeamListParams(opts);
|
|
4629
4650
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
4630
4651
|
if (opts?.job_type !== void 0) params.job_type = opts.job_type;
|
|
4631
4652
|
if (opts?.target_id !== void 0) params.target_id = opts.target_id;
|
|
@@ -4639,7 +4660,11 @@ var RedTeamScansClient = class {
|
|
|
4639
4660
|
});
|
|
4640
4661
|
return res.data;
|
|
4641
4662
|
}
|
|
4642
|
-
/**
|
|
4663
|
+
/**
|
|
4664
|
+
* Get a single scan job by ID.
|
|
4665
|
+
* @param jobId - The job UUID.
|
|
4666
|
+
* @returns The job response.
|
|
4667
|
+
*/
|
|
4643
4668
|
async get(jobId) {
|
|
4644
4669
|
if (!isValidUuid(jobId)) {
|
|
4645
4670
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -4653,7 +4678,11 @@ var RedTeamScansClient = class {
|
|
|
4653
4678
|
});
|
|
4654
4679
|
return res.data;
|
|
4655
4680
|
}
|
|
4656
|
-
/**
|
|
4681
|
+
/**
|
|
4682
|
+
* Abort a running scan job.
|
|
4683
|
+
* @param jobId - The job UUID.
|
|
4684
|
+
* @returns The abort response.
|
|
4685
|
+
*/
|
|
4657
4686
|
async abort(jobId) {
|
|
4658
4687
|
if (!isValidUuid(jobId)) {
|
|
4659
4688
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -4667,7 +4696,10 @@ var RedTeamScansClient = class {
|
|
|
4667
4696
|
});
|
|
4668
4697
|
return res.data;
|
|
4669
4698
|
}
|
|
4670
|
-
/**
|
|
4699
|
+
/**
|
|
4700
|
+
* Get all categories with subcategories.
|
|
4701
|
+
* @returns The list of category models.
|
|
4702
|
+
*/
|
|
4671
4703
|
async getCategories() {
|
|
4672
4704
|
const res = await managementHttpRequest({
|
|
4673
4705
|
method: "GET",
|
|
@@ -4681,13 +4713,6 @@ var RedTeamScansClient = class {
|
|
|
4681
4713
|
};
|
|
4682
4714
|
|
|
4683
4715
|
// src/red-team/reports-client.ts
|
|
4684
|
-
function buildListParams2(opts) {
|
|
4685
|
-
const params = {};
|
|
4686
|
-
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
4687
|
-
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
4688
|
-
if (opts?.search !== void 0) params.search = opts.search;
|
|
4689
|
-
return params;
|
|
4690
|
-
}
|
|
4691
4716
|
function validateJobId(jobId) {
|
|
4692
4717
|
if (!isValidUuid(jobId)) {
|
|
4693
4718
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -4705,10 +4730,15 @@ var RedTeamReportsClient = class {
|
|
|
4705
4730
|
// -----------------------------------------------------------------------
|
|
4706
4731
|
// Static (attack library) report endpoints
|
|
4707
4732
|
// -----------------------------------------------------------------------
|
|
4708
|
-
/**
|
|
4733
|
+
/**
|
|
4734
|
+
* List attacks for a static scan.
|
|
4735
|
+
* @param jobId - The job UUID.
|
|
4736
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
4737
|
+
* @returns The paginated list of attacks.
|
|
4738
|
+
*/
|
|
4709
4739
|
async listAttacks(jobId, opts) {
|
|
4710
4740
|
validateJobId(jobId);
|
|
4711
|
-
const params =
|
|
4741
|
+
const params = buildRedTeamListParams(opts);
|
|
4712
4742
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
4713
4743
|
if (opts?.severity !== void 0) params.severity = opts.severity;
|
|
4714
4744
|
if (opts?.category !== void 0) params.category = opts.category;
|
|
@@ -4725,7 +4755,12 @@ var RedTeamReportsClient = class {
|
|
|
4725
4755
|
});
|
|
4726
4756
|
return res.data;
|
|
4727
4757
|
}
|
|
4728
|
-
/**
|
|
4758
|
+
/**
|
|
4759
|
+
* Get attack details for a static scan.
|
|
4760
|
+
* @param jobId - The job UUID.
|
|
4761
|
+
* @param attackId - The attack UUID.
|
|
4762
|
+
* @returns The attack detail response.
|
|
4763
|
+
*/
|
|
4729
4764
|
async getAttackDetail(jobId, attackId) {
|
|
4730
4765
|
validateJobId(jobId);
|
|
4731
4766
|
if (!isValidUuid(attackId)) {
|
|
@@ -4743,7 +4778,12 @@ var RedTeamReportsClient = class {
|
|
|
4743
4778
|
});
|
|
4744
4779
|
return res.data;
|
|
4745
4780
|
}
|
|
4746
|
-
/**
|
|
4781
|
+
/**
|
|
4782
|
+
* Get multi-turn attack details for a static scan.
|
|
4783
|
+
* @param jobId - The job UUID.
|
|
4784
|
+
* @param attackId - The attack UUID.
|
|
4785
|
+
* @returns The multi-turn attack detail response.
|
|
4786
|
+
*/
|
|
4747
4787
|
async getMultiTurnAttackDetail(jobId, attackId) {
|
|
4748
4788
|
validateJobId(jobId);
|
|
4749
4789
|
if (!isValidUuid(attackId)) {
|
|
@@ -4761,7 +4801,11 @@ var RedTeamReportsClient = class {
|
|
|
4761
4801
|
});
|
|
4762
4802
|
return res.data;
|
|
4763
4803
|
}
|
|
4764
|
-
/**
|
|
4804
|
+
/**
|
|
4805
|
+
* Get the attack library report for a static scan.
|
|
4806
|
+
* @param jobId - The job UUID.
|
|
4807
|
+
* @returns The static job report.
|
|
4808
|
+
*/
|
|
4765
4809
|
async getStaticReport(jobId) {
|
|
4766
4810
|
validateJobId(jobId);
|
|
4767
4811
|
const res = await managementHttpRequest({
|
|
@@ -4773,7 +4817,11 @@ var RedTeamReportsClient = class {
|
|
|
4773
4817
|
});
|
|
4774
4818
|
return res.data;
|
|
4775
4819
|
}
|
|
4776
|
-
/**
|
|
4820
|
+
/**
|
|
4821
|
+
* Get remediation recommendations for a static scan.
|
|
4822
|
+
* @param jobId - The job UUID.
|
|
4823
|
+
* @returns The remediation response.
|
|
4824
|
+
*/
|
|
4777
4825
|
async getStaticRemediation(jobId) {
|
|
4778
4826
|
validateJobId(jobId);
|
|
4779
4827
|
const res = await managementHttpRequest({
|
|
@@ -4785,7 +4833,11 @@ var RedTeamReportsClient = class {
|
|
|
4785
4833
|
});
|
|
4786
4834
|
return res.data;
|
|
4787
4835
|
}
|
|
4788
|
-
/**
|
|
4836
|
+
/**
|
|
4837
|
+
* Get runtime security profile config for a static scan.
|
|
4838
|
+
* @param jobId - The job UUID.
|
|
4839
|
+
* @returns The runtime security profile response.
|
|
4840
|
+
*/
|
|
4789
4841
|
async getStaticRuntimePolicy(jobId) {
|
|
4790
4842
|
validateJobId(jobId);
|
|
4791
4843
|
const res = await managementHttpRequest({
|
|
@@ -4800,7 +4852,11 @@ var RedTeamReportsClient = class {
|
|
|
4800
4852
|
// -----------------------------------------------------------------------
|
|
4801
4853
|
// Dynamic (agent) report endpoints
|
|
4802
4854
|
// -----------------------------------------------------------------------
|
|
4803
|
-
/**
|
|
4855
|
+
/**
|
|
4856
|
+
* Get the agent scan report for a dynamic scan.
|
|
4857
|
+
* @param jobId - The job UUID.
|
|
4858
|
+
* @returns The dynamic job report.
|
|
4859
|
+
*/
|
|
4804
4860
|
async getDynamicReport(jobId) {
|
|
4805
4861
|
validateJobId(jobId);
|
|
4806
4862
|
const res = await managementHttpRequest({
|
|
@@ -4812,7 +4868,11 @@ var RedTeamReportsClient = class {
|
|
|
4812
4868
|
});
|
|
4813
4869
|
return res.data;
|
|
4814
4870
|
}
|
|
4815
|
-
/**
|
|
4871
|
+
/**
|
|
4872
|
+
* Get remediation recommendations for a dynamic scan.
|
|
4873
|
+
* @param jobId - The job UUID.
|
|
4874
|
+
* @returns The remediation response.
|
|
4875
|
+
*/
|
|
4816
4876
|
async getDynamicRemediation(jobId) {
|
|
4817
4877
|
validateJobId(jobId);
|
|
4818
4878
|
const res = await managementHttpRequest({
|
|
@@ -4824,7 +4884,11 @@ var RedTeamReportsClient = class {
|
|
|
4824
4884
|
});
|
|
4825
4885
|
return res.data;
|
|
4826
4886
|
}
|
|
4827
|
-
/**
|
|
4887
|
+
/**
|
|
4888
|
+
* Get runtime security profile config for a dynamic scan.
|
|
4889
|
+
* @param jobId - The job UUID.
|
|
4890
|
+
* @returns The runtime security profile response.
|
|
4891
|
+
*/
|
|
4828
4892
|
async getDynamicRuntimePolicy(jobId) {
|
|
4829
4893
|
validateJobId(jobId);
|
|
4830
4894
|
const res = await managementHttpRequest({
|
|
@@ -4836,10 +4900,15 @@ var RedTeamReportsClient = class {
|
|
|
4836
4900
|
});
|
|
4837
4901
|
return res.data;
|
|
4838
4902
|
}
|
|
4839
|
-
/**
|
|
4903
|
+
/**
|
|
4904
|
+
* List goals for a dynamic scan.
|
|
4905
|
+
* @param jobId - The job UUID.
|
|
4906
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
4907
|
+
* @returns The paginated list of goals.
|
|
4908
|
+
*/
|
|
4840
4909
|
async listGoals(jobId, opts) {
|
|
4841
4910
|
validateJobId(jobId);
|
|
4842
|
-
const params =
|
|
4911
|
+
const params = buildRedTeamListParams(opts);
|
|
4843
4912
|
if (opts?.goal_type !== void 0) params.goal_type = opts.goal_type;
|
|
4844
4913
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
4845
4914
|
if (opts?.count !== void 0) params.count = String(opts.count);
|
|
@@ -4853,7 +4922,13 @@ var RedTeamReportsClient = class {
|
|
|
4853
4922
|
});
|
|
4854
4923
|
return res.data;
|
|
4855
4924
|
}
|
|
4856
|
-
/**
|
|
4925
|
+
/**
|
|
4926
|
+
* List streams for a goal in a dynamic scan.
|
|
4927
|
+
* @param jobId - The job UUID.
|
|
4928
|
+
* @param goalId - The goal UUID.
|
|
4929
|
+
* @param opts - Optional pagination and search options.
|
|
4930
|
+
* @returns The paginated list of streams.
|
|
4931
|
+
*/
|
|
4857
4932
|
async listGoalStreams(jobId, goalId, opts) {
|
|
4858
4933
|
validateJobId(jobId);
|
|
4859
4934
|
if (!isValidUuid(goalId)) {
|
|
@@ -4866,7 +4941,7 @@ var RedTeamReportsClient = class {
|
|
|
4866
4941
|
method: "GET",
|
|
4867
4942
|
baseUrl: this.baseUrl,
|
|
4868
4943
|
path: `${RED_TEAM_REPORT_DYNAMIC_PATH}/${jobId}/goal/${goalId}/list-streams`,
|
|
4869
|
-
params:
|
|
4944
|
+
params: buildRedTeamListParams(opts),
|
|
4870
4945
|
oauthClient: this.oauthClient,
|
|
4871
4946
|
numRetries: this.numRetries
|
|
4872
4947
|
});
|
|
@@ -4875,7 +4950,11 @@ var RedTeamReportsClient = class {
|
|
|
4875
4950
|
// -----------------------------------------------------------------------
|
|
4876
4951
|
// Common report endpoints
|
|
4877
4952
|
// -----------------------------------------------------------------------
|
|
4878
|
-
/**
|
|
4953
|
+
/**
|
|
4954
|
+
* Get stream details by stream ID.
|
|
4955
|
+
* @param streamId - The stream UUID.
|
|
4956
|
+
* @returns The stream detail response.
|
|
4957
|
+
*/
|
|
4879
4958
|
async getStreamDetail(streamId) {
|
|
4880
4959
|
if (!isValidUuid(streamId)) {
|
|
4881
4960
|
throw new AISecSDKException(
|
|
@@ -4892,7 +4971,12 @@ var RedTeamReportsClient = class {
|
|
|
4892
4971
|
});
|
|
4893
4972
|
return res.data;
|
|
4894
4973
|
}
|
|
4895
|
-
/**
|
|
4974
|
+
/**
|
|
4975
|
+
* Download a report in the specified format.
|
|
4976
|
+
* @param jobId - The job UUID.
|
|
4977
|
+
* @param format - The file format (e.g. "pdf", "csv").
|
|
4978
|
+
* @returns The downloaded report data.
|
|
4979
|
+
*/
|
|
4896
4980
|
async downloadReport(jobId, format) {
|
|
4897
4981
|
validateJobId(jobId);
|
|
4898
4982
|
const params = { file_format: format };
|
|
@@ -4906,7 +4990,11 @@ var RedTeamReportsClient = class {
|
|
|
4906
4990
|
});
|
|
4907
4991
|
return res.data;
|
|
4908
4992
|
}
|
|
4909
|
-
/**
|
|
4993
|
+
/**
|
|
4994
|
+
* Generate a partial report for a running scan.
|
|
4995
|
+
* @param jobId - The job UUID.
|
|
4996
|
+
* @returns The partial report data.
|
|
4997
|
+
*/
|
|
4910
4998
|
async generatePartialReport(jobId) {
|
|
4911
4999
|
validateJobId(jobId);
|
|
4912
5000
|
const res = await managementHttpRequest({
|
|
@@ -4921,13 +5009,6 @@ var RedTeamReportsClient = class {
|
|
|
4921
5009
|
};
|
|
4922
5010
|
|
|
4923
5011
|
// src/red-team/custom-attack-reports-client.ts
|
|
4924
|
-
function buildListParams3(opts) {
|
|
4925
|
-
const params = {};
|
|
4926
|
-
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
4927
|
-
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
4928
|
-
if (opts?.search !== void 0) params.search = opts.search;
|
|
4929
|
-
return params;
|
|
4930
|
-
}
|
|
4931
5012
|
function validateJobId2(jobId) {
|
|
4932
5013
|
if (!isValidUuid(jobId)) {
|
|
4933
5014
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -4942,7 +5023,11 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4942
5023
|
this.oauthClient = opts.oauthClient;
|
|
4943
5024
|
this.numRetries = opts.numRetries;
|
|
4944
5025
|
}
|
|
4945
|
-
/**
|
|
5026
|
+
/**
|
|
5027
|
+
* Get custom attack report for a scan.
|
|
5028
|
+
* @param jobId - The job UUID.
|
|
5029
|
+
* @returns The custom attack report response.
|
|
5030
|
+
*/
|
|
4946
5031
|
async getReport(jobId) {
|
|
4947
5032
|
validateJobId2(jobId);
|
|
4948
5033
|
const res = await managementHttpRequest({
|
|
@@ -4954,7 +5039,11 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4954
5039
|
});
|
|
4955
5040
|
return res.data;
|
|
4956
5041
|
}
|
|
4957
|
-
/**
|
|
5042
|
+
/**
|
|
5043
|
+
* Get prompt sets for a custom attack scan.
|
|
5044
|
+
* @param jobId - The job UUID.
|
|
5045
|
+
* @returns The prompt sets report response.
|
|
5046
|
+
*/
|
|
4958
5047
|
async getPromptSets(jobId) {
|
|
4959
5048
|
validateJobId2(jobId);
|
|
4960
5049
|
const res = await managementHttpRequest({
|
|
@@ -4966,7 +5055,13 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4966
5055
|
});
|
|
4967
5056
|
return res.data;
|
|
4968
5057
|
}
|
|
4969
|
-
/**
|
|
5058
|
+
/**
|
|
5059
|
+
* Get prompts for a specific prompt set in a scan.
|
|
5060
|
+
* @param jobId - The job UUID.
|
|
5061
|
+
* @param promptSetId - The prompt set UUID.
|
|
5062
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
5063
|
+
* @returns The list of prompt detail responses.
|
|
5064
|
+
*/
|
|
4970
5065
|
async getPromptsBySet(jobId, promptSetId, opts) {
|
|
4971
5066
|
validateJobId2(jobId);
|
|
4972
5067
|
if (!isValidUuid(promptSetId)) {
|
|
@@ -4975,7 +5070,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4975
5070
|
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
4976
5071
|
);
|
|
4977
5072
|
}
|
|
4978
|
-
const params =
|
|
5073
|
+
const params = buildRedTeamListParams(opts);
|
|
4979
5074
|
if (opts?.is_threat !== void 0) params.is_threat = String(opts.is_threat);
|
|
4980
5075
|
const res = await managementHttpRequest({
|
|
4981
5076
|
method: "GET",
|
|
@@ -4987,7 +5082,12 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4987
5082
|
});
|
|
4988
5083
|
return res.data;
|
|
4989
5084
|
}
|
|
4990
|
-
/**
|
|
5085
|
+
/**
|
|
5086
|
+
* Get details for a specific prompt.
|
|
5087
|
+
* @param jobId - The job UUID.
|
|
5088
|
+
* @param promptId - The prompt UUID.
|
|
5089
|
+
* @returns The prompt detail response.
|
|
5090
|
+
*/
|
|
4991
5091
|
async getPromptDetail(jobId, promptId) {
|
|
4992
5092
|
validateJobId2(jobId);
|
|
4993
5093
|
if (!isValidUuid(promptId)) {
|
|
@@ -5005,10 +5105,15 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5005
5105
|
});
|
|
5006
5106
|
return res.data;
|
|
5007
5107
|
}
|
|
5008
|
-
/**
|
|
5108
|
+
/**
|
|
5109
|
+
* List custom attacks for a scan.
|
|
5110
|
+
* @param jobId - The job UUID.
|
|
5111
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
5112
|
+
* @returns The paginated list of custom attacks.
|
|
5113
|
+
*/
|
|
5009
5114
|
async listCustomAttacks(jobId, opts) {
|
|
5010
5115
|
validateJobId2(jobId);
|
|
5011
|
-
const params =
|
|
5116
|
+
const params = buildRedTeamListParams(opts);
|
|
5012
5117
|
if (opts?.threat !== void 0) params.threat = String(opts.threat);
|
|
5013
5118
|
if (opts?.prompt_set_id !== void 0) params.prompt_set_id = opts.prompt_set_id;
|
|
5014
5119
|
if (opts?.property_value !== void 0) params.property_value = opts.property_value;
|
|
@@ -5022,7 +5127,12 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5022
5127
|
});
|
|
5023
5128
|
return res.data;
|
|
5024
5129
|
}
|
|
5025
|
-
/**
|
|
5130
|
+
/**
|
|
5131
|
+
* Get attack outputs for a custom attack.
|
|
5132
|
+
* @param jobId - The job UUID.
|
|
5133
|
+
* @param attackId - The attack UUID.
|
|
5134
|
+
* @returns The list of attack outputs.
|
|
5135
|
+
*/
|
|
5026
5136
|
async getAttackOutputs(jobId, attackId) {
|
|
5027
5137
|
validateJobId2(jobId);
|
|
5028
5138
|
if (!isValidUuid(attackId)) {
|
|
@@ -5040,7 +5150,11 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5040
5150
|
});
|
|
5041
5151
|
return res.data;
|
|
5042
5152
|
}
|
|
5043
|
-
/**
|
|
5153
|
+
/**
|
|
5154
|
+
* Get property statistics for a custom attack scan.
|
|
5155
|
+
* @param jobId - The job UUID.
|
|
5156
|
+
* @returns The list of property statistics.
|
|
5157
|
+
*/
|
|
5044
5158
|
async getPropertyStats(jobId) {
|
|
5045
5159
|
validateJobId2(jobId);
|
|
5046
5160
|
const res = await managementHttpRequest({
|
|
@@ -5055,13 +5169,6 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5055
5169
|
};
|
|
5056
5170
|
|
|
5057
5171
|
// src/red-team/targets-client.ts
|
|
5058
|
-
function buildListParams4(opts) {
|
|
5059
|
-
const params = {};
|
|
5060
|
-
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
5061
|
-
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
5062
|
-
if (opts?.search !== void 0) params.search = opts.search;
|
|
5063
|
-
return params;
|
|
5064
|
-
}
|
|
5065
5172
|
var RedTeamTargetsClient = class {
|
|
5066
5173
|
baseUrl;
|
|
5067
5174
|
oauthClient;
|
|
@@ -5091,9 +5198,13 @@ var RedTeamTargetsClient = class {
|
|
|
5091
5198
|
});
|
|
5092
5199
|
return res.data;
|
|
5093
5200
|
}
|
|
5094
|
-
/**
|
|
5201
|
+
/**
|
|
5202
|
+
* List targets with optional filters.
|
|
5203
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
5204
|
+
* @returns The paginated list of targets.
|
|
5205
|
+
*/
|
|
5095
5206
|
async list(opts) {
|
|
5096
|
-
const params =
|
|
5207
|
+
const params = buildRedTeamListParams(opts);
|
|
5097
5208
|
if (opts?.target_type !== void 0) params.target_type = opts.target_type;
|
|
5098
5209
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
5099
5210
|
const res = await managementHttpRequest({
|
|
@@ -5106,7 +5217,11 @@ var RedTeamTargetsClient = class {
|
|
|
5106
5217
|
});
|
|
5107
5218
|
return res.data;
|
|
5108
5219
|
}
|
|
5109
|
-
/**
|
|
5220
|
+
/**
|
|
5221
|
+
* Get a target by UUID.
|
|
5222
|
+
* @param uuid - The target UUID.
|
|
5223
|
+
* @returns The target response.
|
|
5224
|
+
*/
|
|
5110
5225
|
async get(uuid) {
|
|
5111
5226
|
if (!isValidUuid(uuid)) {
|
|
5112
5227
|
throw new AISecSDKException(
|
|
@@ -5123,7 +5238,13 @@ var RedTeamTargetsClient = class {
|
|
|
5123
5238
|
});
|
|
5124
5239
|
return res.data;
|
|
5125
5240
|
}
|
|
5126
|
-
/**
|
|
5241
|
+
/**
|
|
5242
|
+
* Update a target.
|
|
5243
|
+
* @param uuid - The target UUID.
|
|
5244
|
+
* @param request - Target update request body.
|
|
5245
|
+
* @param opts - Optional operation options (e.g. validate connection).
|
|
5246
|
+
* @returns The updated target response.
|
|
5247
|
+
*/
|
|
5127
5248
|
async update(uuid, request, opts) {
|
|
5128
5249
|
if (!isValidUuid(uuid)) {
|
|
5129
5250
|
throw new AISecSDKException(
|
|
@@ -5144,7 +5265,11 @@ var RedTeamTargetsClient = class {
|
|
|
5144
5265
|
});
|
|
5145
5266
|
return res.data;
|
|
5146
5267
|
}
|
|
5147
|
-
/**
|
|
5268
|
+
/**
|
|
5269
|
+
* Delete a target.
|
|
5270
|
+
* @param uuid - The target UUID.
|
|
5271
|
+
* @returns The delete response.
|
|
5272
|
+
*/
|
|
5148
5273
|
async delete(uuid) {
|
|
5149
5274
|
if (!isValidUuid(uuid)) {
|
|
5150
5275
|
throw new AISecSDKException(
|
|
@@ -5161,7 +5286,11 @@ var RedTeamTargetsClient = class {
|
|
|
5161
5286
|
});
|
|
5162
5287
|
return res.data;
|
|
5163
5288
|
}
|
|
5164
|
-
/**
|
|
5289
|
+
/**
|
|
5290
|
+
* Run profiling probes on a target.
|
|
5291
|
+
* @param request - The probe request body.
|
|
5292
|
+
* @returns The target response after probing.
|
|
5293
|
+
*/
|
|
5165
5294
|
async probe(request) {
|
|
5166
5295
|
const res = await managementHttpRequest({
|
|
5167
5296
|
method: "POST",
|
|
@@ -5173,7 +5302,11 @@ var RedTeamTargetsClient = class {
|
|
|
5173
5302
|
});
|
|
5174
5303
|
return res.data;
|
|
5175
5304
|
}
|
|
5176
|
-
/**
|
|
5305
|
+
/**
|
|
5306
|
+
* Get profiling results for a target.
|
|
5307
|
+
* @param uuid - The target UUID.
|
|
5308
|
+
* @returns The target profile response.
|
|
5309
|
+
*/
|
|
5177
5310
|
async getProfile(uuid) {
|
|
5178
5311
|
if (!isValidUuid(uuid)) {
|
|
5179
5312
|
throw new AISecSDKException(
|
|
@@ -5190,7 +5323,12 @@ var RedTeamTargetsClient = class {
|
|
|
5190
5323
|
});
|
|
5191
5324
|
return res.data;
|
|
5192
5325
|
}
|
|
5193
|
-
/**
|
|
5326
|
+
/**
|
|
5327
|
+
* Update a target profile (background + additional context).
|
|
5328
|
+
* @param uuid - The target UUID.
|
|
5329
|
+
* @param request - The context update request body.
|
|
5330
|
+
* @returns The updated target response.
|
|
5331
|
+
*/
|
|
5194
5332
|
async updateProfile(uuid, request) {
|
|
5195
5333
|
if (!isValidUuid(uuid)) {
|
|
5196
5334
|
throw new AISecSDKException(
|
|
@@ -5211,13 +5349,6 @@ var RedTeamTargetsClient = class {
|
|
|
5211
5349
|
};
|
|
5212
5350
|
|
|
5213
5351
|
// src/red-team/custom-attacks-client.ts
|
|
5214
|
-
function buildListParams5(opts) {
|
|
5215
|
-
const params = {};
|
|
5216
|
-
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
5217
|
-
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
5218
|
-
if (opts?.search !== void 0) params.search = opts.search;
|
|
5219
|
-
return params;
|
|
5220
|
-
}
|
|
5221
5352
|
function validateUuid(uuid, label) {
|
|
5222
5353
|
if (!isValidUuid(uuid)) {
|
|
5223
5354
|
throw new AISecSDKException(`Invalid ${label}: ${uuid}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -5235,7 +5366,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5235
5366
|
// -----------------------------------------------------------------------
|
|
5236
5367
|
// Prompt Set operations
|
|
5237
5368
|
// -----------------------------------------------------------------------
|
|
5238
|
-
/**
|
|
5369
|
+
/**
|
|
5370
|
+
* Create a new custom prompt set.
|
|
5371
|
+
* @param request - Prompt set creation request body.
|
|
5372
|
+
* @returns The created prompt set response.
|
|
5373
|
+
*/
|
|
5239
5374
|
async createPromptSet(request) {
|
|
5240
5375
|
const res = await managementHttpRequest({
|
|
5241
5376
|
method: "POST",
|
|
@@ -5247,9 +5382,13 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5247
5382
|
});
|
|
5248
5383
|
return res.data;
|
|
5249
5384
|
}
|
|
5250
|
-
/**
|
|
5385
|
+
/**
|
|
5386
|
+
* List custom prompt sets.
|
|
5387
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
5388
|
+
* @returns The paginated list of prompt sets.
|
|
5389
|
+
*/
|
|
5251
5390
|
async listPromptSets(opts) {
|
|
5252
|
-
const params =
|
|
5391
|
+
const params = buildRedTeamListParams(opts);
|
|
5253
5392
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
5254
5393
|
if (opts?.active !== void 0) params.active = String(opts.active);
|
|
5255
5394
|
if (opts?.archive !== void 0) params.archive = String(opts.archive);
|
|
@@ -5263,7 +5402,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5263
5402
|
});
|
|
5264
5403
|
return res.data;
|
|
5265
5404
|
}
|
|
5266
|
-
/**
|
|
5405
|
+
/**
|
|
5406
|
+
* Get a prompt set by UUID.
|
|
5407
|
+
* @param uuid - The prompt set UUID.
|
|
5408
|
+
* @returns The prompt set response.
|
|
5409
|
+
*/
|
|
5267
5410
|
async getPromptSet(uuid) {
|
|
5268
5411
|
validateUuid(uuid, "prompt set uuid");
|
|
5269
5412
|
const res = await managementHttpRequest({
|
|
@@ -5275,7 +5418,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5275
5418
|
});
|
|
5276
5419
|
return res.data;
|
|
5277
5420
|
}
|
|
5278
|
-
/**
|
|
5421
|
+
/**
|
|
5422
|
+
* Update a prompt set.
|
|
5423
|
+
* @param uuid - The prompt set UUID.
|
|
5424
|
+
* @param request - Prompt set update request body.
|
|
5425
|
+
* @returns The updated prompt set response.
|
|
5426
|
+
*/
|
|
5279
5427
|
async updatePromptSet(uuid, request) {
|
|
5280
5428
|
validateUuid(uuid, "prompt set uuid");
|
|
5281
5429
|
const res = await managementHttpRequest({
|
|
@@ -5288,7 +5436,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5288
5436
|
});
|
|
5289
5437
|
return res.data;
|
|
5290
5438
|
}
|
|
5291
|
-
/**
|
|
5439
|
+
/**
|
|
5440
|
+
* Archive or unarchive a prompt set.
|
|
5441
|
+
* @param uuid - The prompt set UUID.
|
|
5442
|
+
* @param request - Archive request body.
|
|
5443
|
+
* @returns The updated prompt set response.
|
|
5444
|
+
*/
|
|
5292
5445
|
async archivePromptSet(uuid, request) {
|
|
5293
5446
|
validateUuid(uuid, "prompt set uuid");
|
|
5294
5447
|
const res = await managementHttpRequest({
|
|
@@ -5301,7 +5454,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5301
5454
|
});
|
|
5302
5455
|
return res.data;
|
|
5303
5456
|
}
|
|
5304
|
-
/**
|
|
5457
|
+
/**
|
|
5458
|
+
* Resolve a prompt set reference for data plane consumption.
|
|
5459
|
+
* @param uuid - The prompt set UUID.
|
|
5460
|
+
* @returns The prompt set reference.
|
|
5461
|
+
*/
|
|
5305
5462
|
async getPromptSetReference(uuid) {
|
|
5306
5463
|
validateUuid(uuid, "prompt set uuid");
|
|
5307
5464
|
const res = await managementHttpRequest({
|
|
@@ -5313,7 +5470,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5313
5470
|
});
|
|
5314
5471
|
return res.data;
|
|
5315
5472
|
}
|
|
5316
|
-
/**
|
|
5473
|
+
/**
|
|
5474
|
+
* Get version information for a prompt set.
|
|
5475
|
+
* @param uuid - The prompt set UUID.
|
|
5476
|
+
* @returns The prompt set version info.
|
|
5477
|
+
*/
|
|
5317
5478
|
async getPromptSetVersionInfo(uuid) {
|
|
5318
5479
|
validateUuid(uuid, "prompt set uuid");
|
|
5319
5480
|
const res = await managementHttpRequest({
|
|
@@ -5325,7 +5486,10 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5325
5486
|
});
|
|
5326
5487
|
return res.data;
|
|
5327
5488
|
}
|
|
5328
|
-
/**
|
|
5489
|
+
/**
|
|
5490
|
+
* List active prompt sets (for data plane).
|
|
5491
|
+
* @returns The list of active prompt sets.
|
|
5492
|
+
*/
|
|
5329
5493
|
async listActivePromptSets() {
|
|
5330
5494
|
const res = await managementHttpRequest({
|
|
5331
5495
|
method: "GET",
|
|
@@ -5336,7 +5500,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5336
5500
|
});
|
|
5337
5501
|
return res.data;
|
|
5338
5502
|
}
|
|
5339
|
-
/**
|
|
5503
|
+
/**
|
|
5504
|
+
* Download CSV template for a prompt set.
|
|
5505
|
+
* @param uuid - The prompt set UUID.
|
|
5506
|
+
* @returns The CSV template data.
|
|
5507
|
+
*/
|
|
5340
5508
|
async downloadTemplate(uuid) {
|
|
5341
5509
|
validateUuid(uuid, "prompt set uuid");
|
|
5342
5510
|
const res = await managementHttpRequest({
|
|
@@ -5348,7 +5516,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5348
5516
|
});
|
|
5349
5517
|
return res.data;
|
|
5350
5518
|
}
|
|
5351
|
-
/**
|
|
5519
|
+
/**
|
|
5520
|
+
* Upload a CSV file of custom prompts for a prompt set.
|
|
5521
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5522
|
+
* @param file - The CSV file blob.
|
|
5523
|
+
* @returns The upload response.
|
|
5524
|
+
*/
|
|
5352
5525
|
async uploadPromptsCsv(promptSetUuid, file) {
|
|
5353
5526
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
5354
5527
|
const token = await this.oauthClient.getToken();
|
|
@@ -5378,7 +5551,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5378
5551
|
// -----------------------------------------------------------------------
|
|
5379
5552
|
// Prompt operations
|
|
5380
5553
|
// -----------------------------------------------------------------------
|
|
5381
|
-
/**
|
|
5554
|
+
/**
|
|
5555
|
+
* Create a new custom prompt.
|
|
5556
|
+
* @param request - Prompt creation request body.
|
|
5557
|
+
* @returns The created prompt response.
|
|
5558
|
+
*/
|
|
5382
5559
|
async createPrompt(request) {
|
|
5383
5560
|
const res = await managementHttpRequest({
|
|
5384
5561
|
method: "POST",
|
|
@@ -5390,10 +5567,15 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5390
5567
|
});
|
|
5391
5568
|
return res.data;
|
|
5392
5569
|
}
|
|
5393
|
-
/**
|
|
5570
|
+
/**
|
|
5571
|
+
* List prompts in a prompt set.
|
|
5572
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5573
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
5574
|
+
* @returns The paginated list of prompts.
|
|
5575
|
+
*/
|
|
5394
5576
|
async listPrompts(promptSetUuid, opts) {
|
|
5395
5577
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
5396
|
-
const params =
|
|
5578
|
+
const params = buildRedTeamListParams(opts);
|
|
5397
5579
|
if (opts?.active !== void 0) params.active = String(opts.active);
|
|
5398
5580
|
const res = await managementHttpRequest({
|
|
5399
5581
|
method: "GET",
|
|
@@ -5405,7 +5587,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5405
5587
|
});
|
|
5406
5588
|
return res.data;
|
|
5407
5589
|
}
|
|
5408
|
-
/**
|
|
5590
|
+
/**
|
|
5591
|
+
* Get a prompt by UUID.
|
|
5592
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5593
|
+
* @param promptUuid - The prompt UUID.
|
|
5594
|
+
* @returns The prompt response.
|
|
5595
|
+
*/
|
|
5409
5596
|
async getPrompt(promptSetUuid, promptUuid) {
|
|
5410
5597
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
5411
5598
|
validateUuid(promptUuid, "prompt uuid");
|
|
@@ -5418,7 +5605,13 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5418
5605
|
});
|
|
5419
5606
|
return res.data;
|
|
5420
5607
|
}
|
|
5421
|
-
/**
|
|
5608
|
+
/**
|
|
5609
|
+
* Update a prompt.
|
|
5610
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5611
|
+
* @param promptUuid - The prompt UUID.
|
|
5612
|
+
* @param request - Prompt update request body.
|
|
5613
|
+
* @returns The updated prompt response.
|
|
5614
|
+
*/
|
|
5422
5615
|
async updatePrompt(promptSetUuid, promptUuid, request) {
|
|
5423
5616
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
5424
5617
|
validateUuid(promptUuid, "prompt uuid");
|
|
@@ -5432,7 +5625,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5432
5625
|
});
|
|
5433
5626
|
return res.data;
|
|
5434
5627
|
}
|
|
5435
|
-
/**
|
|
5628
|
+
/**
|
|
5629
|
+
* Delete a prompt.
|
|
5630
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5631
|
+
* @param promptUuid - The prompt UUID.
|
|
5632
|
+
* @returns The delete response.
|
|
5633
|
+
*/
|
|
5436
5634
|
async deletePrompt(promptSetUuid, promptUuid) {
|
|
5437
5635
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
5438
5636
|
validateUuid(promptUuid, "prompt uuid");
|
|
@@ -5448,7 +5646,10 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5448
5646
|
// -----------------------------------------------------------------------
|
|
5449
5647
|
// Property operations
|
|
5450
5648
|
// -----------------------------------------------------------------------
|
|
5451
|
-
/**
|
|
5649
|
+
/**
|
|
5650
|
+
* Get all property names.
|
|
5651
|
+
* @returns The list of property names.
|
|
5652
|
+
*/
|
|
5452
5653
|
async getPropertyNames() {
|
|
5453
5654
|
const res = await managementHttpRequest({
|
|
5454
5655
|
method: "GET",
|
|
@@ -5459,7 +5660,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5459
5660
|
});
|
|
5460
5661
|
return res.data;
|
|
5461
5662
|
}
|
|
5462
|
-
/**
|
|
5663
|
+
/**
|
|
5664
|
+
* Create a new property name.
|
|
5665
|
+
* @param request - Property name creation request body.
|
|
5666
|
+
* @returns The creation response.
|
|
5667
|
+
*/
|
|
5463
5668
|
async createPropertyName(request) {
|
|
5464
5669
|
const res = await managementHttpRequest({
|
|
5465
5670
|
method: "POST",
|
|
@@ -5471,7 +5676,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5471
5676
|
});
|
|
5472
5677
|
return res.data;
|
|
5473
5678
|
}
|
|
5474
|
-
/**
|
|
5679
|
+
/**
|
|
5680
|
+
* Get values for a property name.
|
|
5681
|
+
* @param propertyName - The property name to look up.
|
|
5682
|
+
* @returns The property values response.
|
|
5683
|
+
*/
|
|
5475
5684
|
async getPropertyValues(propertyName) {
|
|
5476
5685
|
const res = await managementHttpRequest({
|
|
5477
5686
|
method: "GET",
|
|
@@ -5482,7 +5691,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5482
5691
|
});
|
|
5483
5692
|
return res.data;
|
|
5484
5693
|
}
|
|
5485
|
-
/**
|
|
5694
|
+
/**
|
|
5695
|
+
* Get values for multiple property names.
|
|
5696
|
+
* @param propertyNames - Array of property names to look up.
|
|
5697
|
+
* @returns The property values for all requested names.
|
|
5698
|
+
*/
|
|
5486
5699
|
async getPropertyValuesMultiple(propertyNames) {
|
|
5487
5700
|
const url = new URL(`https://placeholder${RED_TEAM_CUSTOM_ATTACK_PATH}/property-values`);
|
|
5488
5701
|
for (const name of propertyNames) {
|
|
@@ -5499,7 +5712,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5499
5712
|
});
|
|
5500
5713
|
return res.data;
|
|
5501
5714
|
}
|
|
5502
|
-
/**
|
|
5715
|
+
/**
|
|
5716
|
+
* Create a property value.
|
|
5717
|
+
* @param request - Property value creation request body.
|
|
5718
|
+
* @returns The creation response.
|
|
5719
|
+
*/
|
|
5503
5720
|
async createPropertyValue(request) {
|
|
5504
5721
|
const res = await managementHttpRequest({
|
|
5505
5722
|
method: "POST",
|
|
@@ -5514,13 +5731,6 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5514
5731
|
};
|
|
5515
5732
|
|
|
5516
5733
|
// src/red-team/client.ts
|
|
5517
|
-
function buildListParams6(opts) {
|
|
5518
|
-
const params = {};
|
|
5519
|
-
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
5520
|
-
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
5521
|
-
if (opts?.search !== void 0) params.search = opts.search;
|
|
5522
|
-
return params;
|
|
5523
|
-
}
|
|
5524
5734
|
var RedTeamClient = class {
|
|
5525
5735
|
/** Data plane scan operations. */
|
|
5526
5736
|
scans;
|
|
@@ -5598,7 +5808,11 @@ var RedTeamClient = class {
|
|
|
5598
5808
|
// -----------------------------------------------------------------------
|
|
5599
5809
|
// Data plane convenience methods
|
|
5600
5810
|
// -----------------------------------------------------------------------
|
|
5601
|
-
/**
|
|
5811
|
+
/**
|
|
5812
|
+
* Get scan statistics and risk profile (data plane dashboard).
|
|
5813
|
+
* @param params - Optional date range and target ID filters.
|
|
5814
|
+
* @returns The scan statistics response.
|
|
5815
|
+
*/
|
|
5602
5816
|
async getScanStatistics(params) {
|
|
5603
5817
|
const p = {};
|
|
5604
5818
|
if (params?.date_range !== void 0) p.date_range = params.date_range;
|
|
@@ -5613,7 +5827,11 @@ var RedTeamClient = class {
|
|
|
5613
5827
|
});
|
|
5614
5828
|
return res.data;
|
|
5615
5829
|
}
|
|
5616
|
-
/**
|
|
5830
|
+
/**
|
|
5831
|
+
* Get score trend for a target (data plane dashboard).
|
|
5832
|
+
* @param targetId - The target UUID.
|
|
5833
|
+
* @returns The score trend response.
|
|
5834
|
+
*/
|
|
5617
5835
|
async getScoreTrend(targetId) {
|
|
5618
5836
|
if (!isValidUuid(targetId)) {
|
|
5619
5837
|
throw new AISecSDKException(
|
|
@@ -5631,7 +5849,10 @@ var RedTeamClient = class {
|
|
|
5631
5849
|
});
|
|
5632
5850
|
return res.data;
|
|
5633
5851
|
}
|
|
5634
|
-
/**
|
|
5852
|
+
/**
|
|
5853
|
+
* Get quota summary.
|
|
5854
|
+
* @returns The quota summary.
|
|
5855
|
+
*/
|
|
5635
5856
|
async getQuota() {
|
|
5636
5857
|
const res = await managementHttpRequest({
|
|
5637
5858
|
method: "POST",
|
|
@@ -5642,7 +5863,12 @@ var RedTeamClient = class {
|
|
|
5642
5863
|
});
|
|
5643
5864
|
return res.data;
|
|
5644
5865
|
}
|
|
5645
|
-
/**
|
|
5866
|
+
/**
|
|
5867
|
+
* List error logs for a scan job.
|
|
5868
|
+
* @param jobId - The job UUID.
|
|
5869
|
+
* @param opts - Optional pagination and search options.
|
|
5870
|
+
* @returns The paginated list of error logs.
|
|
5871
|
+
*/
|
|
5646
5872
|
async getErrorLogs(jobId, opts) {
|
|
5647
5873
|
if (!isValidUuid(jobId)) {
|
|
5648
5874
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -5651,13 +5877,17 @@ var RedTeamClient = class {
|
|
|
5651
5877
|
method: "GET",
|
|
5652
5878
|
baseUrl: this.dataEndpoint,
|
|
5653
5879
|
path: `${RED_TEAM_ERROR_LOG_PATH}/${jobId}`,
|
|
5654
|
-
params:
|
|
5880
|
+
params: buildRedTeamListParams(opts),
|
|
5655
5881
|
oauthClient: this.oauthClient,
|
|
5656
5882
|
numRetries: this.numRetries
|
|
5657
5883
|
});
|
|
5658
5884
|
return res.data;
|
|
5659
5885
|
}
|
|
5660
|
-
/**
|
|
5886
|
+
/**
|
|
5887
|
+
* Update sentiment for a scan report.
|
|
5888
|
+
* @param request - The sentiment request body.
|
|
5889
|
+
* @returns The sentiment response.
|
|
5890
|
+
*/
|
|
5661
5891
|
async updateSentiment(request) {
|
|
5662
5892
|
const res = await managementHttpRequest({
|
|
5663
5893
|
method: "POST",
|
|
@@ -5669,7 +5899,11 @@ var RedTeamClient = class {
|
|
|
5669
5899
|
});
|
|
5670
5900
|
return res.data;
|
|
5671
5901
|
}
|
|
5672
|
-
/**
|
|
5902
|
+
/**
|
|
5903
|
+
* Get sentiment for a scan report.
|
|
5904
|
+
* @param jobId - The job UUID.
|
|
5905
|
+
* @returns The sentiment response.
|
|
5906
|
+
*/
|
|
5673
5907
|
async getSentiment(jobId) {
|
|
5674
5908
|
if (!isValidUuid(jobId)) {
|
|
5675
5909
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -5686,7 +5920,10 @@ var RedTeamClient = class {
|
|
|
5686
5920
|
// -----------------------------------------------------------------------
|
|
5687
5921
|
// Management plane convenience methods
|
|
5688
5922
|
// -----------------------------------------------------------------------
|
|
5689
|
-
/**
|
|
5923
|
+
/**
|
|
5924
|
+
* Get management dashboard overview.
|
|
5925
|
+
* @returns The dashboard overview response.
|
|
5926
|
+
*/
|
|
5690
5927
|
async getDashboardOverview() {
|
|
5691
5928
|
const res = await managementHttpRequest({
|
|
5692
5929
|
method: "GET",
|