@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.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.6";
|
|
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);
|
|
@@ -658,6 +659,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;
|
|
|
658
659
|
function isValidUuid(value) {
|
|
659
660
|
return UUID_RE.test(value);
|
|
660
661
|
}
|
|
662
|
+
function validateJobId(jobId) {
|
|
663
|
+
if (!isValidUuid(jobId)) {
|
|
664
|
+
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
661
667
|
function generatePayloadHash(payload, secret) {
|
|
662
668
|
return (0, import_node_crypto.createHmac)("sha256", secret).update(payload).digest("hex");
|
|
663
669
|
}
|
|
@@ -923,7 +929,10 @@ var Content = class _Content {
|
|
|
923
929
|
set toolEvent(value) {
|
|
924
930
|
this._toolEvent = value;
|
|
925
931
|
}
|
|
926
|
-
/**
|
|
932
|
+
/**
|
|
933
|
+
* Total byte length of all text content fields.
|
|
934
|
+
* @returns Combined byte length of all text content fields.
|
|
935
|
+
*/
|
|
927
936
|
get length() {
|
|
928
937
|
let total = 0;
|
|
929
938
|
if (this._prompt) total += Buffer.byteLength(this._prompt);
|
|
@@ -933,7 +942,10 @@ var Content = class _Content {
|
|
|
933
942
|
if (this._codeResponse) total += Buffer.byteLength(this._codeResponse);
|
|
934
943
|
return total;
|
|
935
944
|
}
|
|
936
|
-
/**
|
|
945
|
+
/**
|
|
946
|
+
* Serialize to the API request format.
|
|
947
|
+
* @returns The content as a scan request contents inner object.
|
|
948
|
+
*/
|
|
937
949
|
toJSON() {
|
|
938
950
|
const obj = {};
|
|
939
951
|
if (this._prompt !== void 0) obj.prompt = this._prompt;
|
|
@@ -961,6 +973,7 @@ var Content = class _Content {
|
|
|
961
973
|
/**
|
|
962
974
|
* Load content from a JSON file.
|
|
963
975
|
* @param filePath - Path to JSON file containing scan request contents.
|
|
976
|
+
* @returns A new Content instance populated from the JSON file.
|
|
964
977
|
*/
|
|
965
978
|
static fromJSONFile(filePath) {
|
|
966
979
|
const raw = (0, import_node_fs.readFileSync)(filePath, "utf-8");
|
|
@@ -1313,7 +1326,7 @@ var ErrorResponseSchema = import_zod15.z.object({
|
|
|
1313
1326
|
retry_after: import_zod15.z.object({
|
|
1314
1327
|
interval: import_zod15.z.number().optional(),
|
|
1315
1328
|
unit: import_zod15.z.string().optional()
|
|
1316
|
-
}).optional()
|
|
1329
|
+
}).passthrough().optional()
|
|
1317
1330
|
}).passthrough();
|
|
1318
1331
|
|
|
1319
1332
|
// src/models/mgmt-security-profile.ts
|
|
@@ -1477,12 +1490,12 @@ var ApiKeyCreateRequestSchema = import_zod18.z.object({
|
|
|
1477
1490
|
api_key_name: import_zod18.z.string(),
|
|
1478
1491
|
rotation_time_interval: import_zod18.z.number(),
|
|
1479
1492
|
rotation_time_unit: import_zod18.z.string()
|
|
1480
|
-
});
|
|
1493
|
+
}).passthrough();
|
|
1481
1494
|
var ApiKeyRegenerateRequestSchema = import_zod18.z.object({
|
|
1482
1495
|
rotation_time_interval: import_zod18.z.number(),
|
|
1483
1496
|
rotation_time_unit: import_zod18.z.string(),
|
|
1484
1497
|
updated_by: import_zod18.z.string().optional()
|
|
1485
|
-
});
|
|
1498
|
+
}).passthrough();
|
|
1486
1499
|
var ApiKeyListResponseSchema = import_zod18.z.object({
|
|
1487
1500
|
api_keys: import_zod18.z.array(ApiKeySchema).optional(),
|
|
1488
1501
|
next_offset: import_zod18.z.number().optional()
|
|
@@ -1651,7 +1664,7 @@ var import_zod23 = require("zod");
|
|
|
1651
1664
|
var ClientIdAndCustomerAppSchema = import_zod23.z.object({
|
|
1652
1665
|
client_id: import_zod23.z.string(),
|
|
1653
1666
|
customer_app: import_zod23.z.string()
|
|
1654
|
-
});
|
|
1667
|
+
}).passthrough();
|
|
1655
1668
|
var Oauth2TokenSchema = import_zod23.z.object({
|
|
1656
1669
|
token_type: import_zod23.z.string().optional(),
|
|
1657
1670
|
issued_at: import_zod23.z.string().optional(),
|
|
@@ -3145,12 +3158,17 @@ var OAuthClient = class {
|
|
|
3145
3158
|
});
|
|
3146
3159
|
return this.pendingFetch;
|
|
3147
3160
|
}
|
|
3148
|
-
/**
|
|
3161
|
+
/**
|
|
3162
|
+
* Clear the cached token, forcing a fresh fetch on next call.
|
|
3163
|
+
*/
|
|
3149
3164
|
clearToken() {
|
|
3150
3165
|
this.accessToken = null;
|
|
3151
3166
|
this.expiresAt = 0;
|
|
3152
3167
|
}
|
|
3153
|
-
/**
|
|
3168
|
+
/**
|
|
3169
|
+
* Check if the current token has passed its expiry time. Returns true if no token exists.
|
|
3170
|
+
* @returns Whether the token is expired.
|
|
3171
|
+
*/
|
|
3154
3172
|
isTokenExpired() {
|
|
3155
3173
|
if (!this.accessToken) return true;
|
|
3156
3174
|
return Date.now() >= this.expiresAt;
|
|
@@ -3159,6 +3177,7 @@ var OAuthClient = class {
|
|
|
3159
3177
|
* Check if the token is within the pre-expiry buffer window.
|
|
3160
3178
|
* Returns true if no token exists.
|
|
3161
3179
|
* @param bufferMs - Custom buffer in ms. Defaults to the configured `tokenBufferMs`.
|
|
3180
|
+
* @returns Whether the token is expiring soon.
|
|
3162
3181
|
*/
|
|
3163
3182
|
isTokenExpiringSoon(bufferMs) {
|
|
3164
3183
|
if (!this.accessToken) return true;
|
|
@@ -3487,7 +3506,7 @@ var TopicsClient = class {
|
|
|
3487
3506
|
/**
|
|
3488
3507
|
* Force-delete a custom topic, removing it from any referencing profiles.
|
|
3489
3508
|
* @param topicId - UUID of the topic to force-delete.
|
|
3490
|
-
* @param updatedBy - Email of the user performing the deletion.
|
|
3509
|
+
* @param updatedBy - Optional. Email of the user performing the deletion.
|
|
3491
3510
|
* @returns Deletion confirmation message.
|
|
3492
3511
|
*/
|
|
3493
3512
|
async forceDelete(topicId, updatedBy) {
|
|
@@ -4354,6 +4373,7 @@ var ModelSecurityGroupsClient = class {
|
|
|
4354
4373
|
/**
|
|
4355
4374
|
* Delete a security group.
|
|
4356
4375
|
* @param uuid - Security group UUID.
|
|
4376
|
+
* @returns Resolves when the security group is deleted.
|
|
4357
4377
|
*/
|
|
4358
4378
|
async delete(uuid) {
|
|
4359
4379
|
if (!isValidUuid(uuid)) {
|
|
@@ -4590,14 +4610,16 @@ var ModelSecurityClient = class {
|
|
|
4590
4610
|
}
|
|
4591
4611
|
};
|
|
4592
4612
|
|
|
4593
|
-
// src/red-team/
|
|
4594
|
-
function
|
|
4613
|
+
// src/red-team/list-params.ts
|
|
4614
|
+
function buildRedTeamListParams(opts) {
|
|
4595
4615
|
const params = {};
|
|
4596
4616
|
if (opts?.skip !== void 0) params.skip = String(opts.skip);
|
|
4597
4617
|
if (opts?.limit !== void 0) params.limit = String(opts.limit);
|
|
4598
4618
|
if (opts?.search !== void 0) params.search = opts.search;
|
|
4599
4619
|
return params;
|
|
4600
4620
|
}
|
|
4621
|
+
|
|
4622
|
+
// src/red-team/scans-client.ts
|
|
4601
4623
|
var RedTeamScansClient = class {
|
|
4602
4624
|
baseUrl;
|
|
4603
4625
|
oauthClient;
|
|
@@ -4623,9 +4645,13 @@ var RedTeamScansClient = class {
|
|
|
4623
4645
|
});
|
|
4624
4646
|
return res.data;
|
|
4625
4647
|
}
|
|
4626
|
-
/**
|
|
4648
|
+
/**
|
|
4649
|
+
* List red team scan jobs with optional filters.
|
|
4650
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
4651
|
+
* @returns The paginated list of scan jobs.
|
|
4652
|
+
*/
|
|
4627
4653
|
async list(opts) {
|
|
4628
|
-
const params =
|
|
4654
|
+
const params = buildRedTeamListParams(opts);
|
|
4629
4655
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
4630
4656
|
if (opts?.job_type !== void 0) params.job_type = opts.job_type;
|
|
4631
4657
|
if (opts?.target_id !== void 0) params.target_id = opts.target_id;
|
|
@@ -4639,7 +4665,11 @@ var RedTeamScansClient = class {
|
|
|
4639
4665
|
});
|
|
4640
4666
|
return res.data;
|
|
4641
4667
|
}
|
|
4642
|
-
/**
|
|
4668
|
+
/**
|
|
4669
|
+
* Get a single scan job by ID.
|
|
4670
|
+
* @param jobId - The job UUID.
|
|
4671
|
+
* @returns The job response.
|
|
4672
|
+
*/
|
|
4643
4673
|
async get(jobId) {
|
|
4644
4674
|
if (!isValidUuid(jobId)) {
|
|
4645
4675
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -4653,7 +4683,11 @@ var RedTeamScansClient = class {
|
|
|
4653
4683
|
});
|
|
4654
4684
|
return res.data;
|
|
4655
4685
|
}
|
|
4656
|
-
/**
|
|
4686
|
+
/**
|
|
4687
|
+
* Abort a running scan job.
|
|
4688
|
+
* @param jobId - The job UUID.
|
|
4689
|
+
* @returns The abort response.
|
|
4690
|
+
*/
|
|
4657
4691
|
async abort(jobId) {
|
|
4658
4692
|
if (!isValidUuid(jobId)) {
|
|
4659
4693
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -4667,7 +4701,10 @@ var RedTeamScansClient = class {
|
|
|
4667
4701
|
});
|
|
4668
4702
|
return res.data;
|
|
4669
4703
|
}
|
|
4670
|
-
/**
|
|
4704
|
+
/**
|
|
4705
|
+
* Get all categories with subcategories.
|
|
4706
|
+
* @returns The list of category models.
|
|
4707
|
+
*/
|
|
4671
4708
|
async getCategories() {
|
|
4672
4709
|
const res = await managementHttpRequest({
|
|
4673
4710
|
method: "GET",
|
|
@@ -4681,18 +4718,6 @@ var RedTeamScansClient = class {
|
|
|
4681
4718
|
};
|
|
4682
4719
|
|
|
4683
4720
|
// 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
|
-
function validateJobId(jobId) {
|
|
4692
|
-
if (!isValidUuid(jobId)) {
|
|
4693
|
-
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
4694
|
-
}
|
|
4695
|
-
}
|
|
4696
4721
|
var RedTeamReportsClient = class {
|
|
4697
4722
|
baseUrl;
|
|
4698
4723
|
oauthClient;
|
|
@@ -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 report data in the requested format (untyped — shape depends on `format`).
|
|
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 payload (untyped — schema not yet defined by the API).
|
|
4997
|
+
*/
|
|
4910
4998
|
async generatePartialReport(jobId) {
|
|
4911
4999
|
validateJobId(jobId);
|
|
4912
5000
|
const res = await managementHttpRequest({
|
|
@@ -4921,18 +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
|
-
function validateJobId2(jobId) {
|
|
4932
|
-
if (!isValidUuid(jobId)) {
|
|
4933
|
-
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
4934
|
-
}
|
|
4935
|
-
}
|
|
4936
5012
|
var RedTeamCustomAttackReportsClient = class {
|
|
4937
5013
|
baseUrl;
|
|
4938
5014
|
oauthClient;
|
|
@@ -4942,9 +5018,13 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4942
5018
|
this.oauthClient = opts.oauthClient;
|
|
4943
5019
|
this.numRetries = opts.numRetries;
|
|
4944
5020
|
}
|
|
4945
|
-
/**
|
|
5021
|
+
/**
|
|
5022
|
+
* Get custom attack report for a scan.
|
|
5023
|
+
* @param jobId - The job UUID.
|
|
5024
|
+
* @returns The custom attack report response.
|
|
5025
|
+
*/
|
|
4946
5026
|
async getReport(jobId) {
|
|
4947
|
-
|
|
5027
|
+
validateJobId(jobId);
|
|
4948
5028
|
const res = await managementHttpRequest({
|
|
4949
5029
|
method: "GET",
|
|
4950
5030
|
baseUrl: this.baseUrl,
|
|
@@ -4954,9 +5034,13 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4954
5034
|
});
|
|
4955
5035
|
return res.data;
|
|
4956
5036
|
}
|
|
4957
|
-
/**
|
|
5037
|
+
/**
|
|
5038
|
+
* Get prompt sets for a custom attack scan.
|
|
5039
|
+
* @param jobId - The job UUID.
|
|
5040
|
+
* @returns The prompt sets report response.
|
|
5041
|
+
*/
|
|
4958
5042
|
async getPromptSets(jobId) {
|
|
4959
|
-
|
|
5043
|
+
validateJobId(jobId);
|
|
4960
5044
|
const res = await managementHttpRequest({
|
|
4961
5045
|
method: "GET",
|
|
4962
5046
|
baseUrl: this.baseUrl,
|
|
@@ -4966,16 +5050,22 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4966
5050
|
});
|
|
4967
5051
|
return res.data;
|
|
4968
5052
|
}
|
|
4969
|
-
/**
|
|
5053
|
+
/**
|
|
5054
|
+
* Get prompts for a specific prompt set in a scan.
|
|
5055
|
+
* @param jobId - The job UUID.
|
|
5056
|
+
* @param promptSetId - The prompt set UUID.
|
|
5057
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
5058
|
+
* @returns The list of prompt detail responses.
|
|
5059
|
+
*/
|
|
4970
5060
|
async getPromptsBySet(jobId, promptSetId, opts) {
|
|
4971
|
-
|
|
5061
|
+
validateJobId(jobId);
|
|
4972
5062
|
if (!isValidUuid(promptSetId)) {
|
|
4973
5063
|
throw new AISecSDKException(
|
|
4974
5064
|
`Invalid prompt set id: ${promptSetId}`,
|
|
4975
5065
|
"AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */
|
|
4976
5066
|
);
|
|
4977
5067
|
}
|
|
4978
|
-
const params =
|
|
5068
|
+
const params = buildRedTeamListParams(opts);
|
|
4979
5069
|
if (opts?.is_threat !== void 0) params.is_threat = String(opts.is_threat);
|
|
4980
5070
|
const res = await managementHttpRequest({
|
|
4981
5071
|
method: "GET",
|
|
@@ -4987,9 +5077,14 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
4987
5077
|
});
|
|
4988
5078
|
return res.data;
|
|
4989
5079
|
}
|
|
4990
|
-
/**
|
|
5080
|
+
/**
|
|
5081
|
+
* Get details for a specific prompt.
|
|
5082
|
+
* @param jobId - The job UUID.
|
|
5083
|
+
* @param promptId - The prompt UUID.
|
|
5084
|
+
* @returns The prompt detail response.
|
|
5085
|
+
*/
|
|
4991
5086
|
async getPromptDetail(jobId, promptId) {
|
|
4992
|
-
|
|
5087
|
+
validateJobId(jobId);
|
|
4993
5088
|
if (!isValidUuid(promptId)) {
|
|
4994
5089
|
throw new AISecSDKException(
|
|
4995
5090
|
`Invalid prompt id: ${promptId}`,
|
|
@@ -5005,10 +5100,15 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5005
5100
|
});
|
|
5006
5101
|
return res.data;
|
|
5007
5102
|
}
|
|
5008
|
-
/**
|
|
5103
|
+
/**
|
|
5104
|
+
* List custom attacks for a scan.
|
|
5105
|
+
* @param jobId - The job UUID.
|
|
5106
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
5107
|
+
* @returns The paginated list of custom attacks.
|
|
5108
|
+
*/
|
|
5009
5109
|
async listCustomAttacks(jobId, opts) {
|
|
5010
|
-
|
|
5011
|
-
const params =
|
|
5110
|
+
validateJobId(jobId);
|
|
5111
|
+
const params = buildRedTeamListParams(opts);
|
|
5012
5112
|
if (opts?.threat !== void 0) params.threat = String(opts.threat);
|
|
5013
5113
|
if (opts?.prompt_set_id !== void 0) params.prompt_set_id = opts.prompt_set_id;
|
|
5014
5114
|
if (opts?.property_value !== void 0) params.property_value = opts.property_value;
|
|
@@ -5022,9 +5122,14 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5022
5122
|
});
|
|
5023
5123
|
return res.data;
|
|
5024
5124
|
}
|
|
5025
|
-
/**
|
|
5125
|
+
/**
|
|
5126
|
+
* Get attack outputs for a custom attack.
|
|
5127
|
+
* @param jobId - The job UUID.
|
|
5128
|
+
* @param attackId - The attack UUID.
|
|
5129
|
+
* @returns The list of attack outputs.
|
|
5130
|
+
*/
|
|
5026
5131
|
async getAttackOutputs(jobId, attackId) {
|
|
5027
|
-
|
|
5132
|
+
validateJobId(jobId);
|
|
5028
5133
|
if (!isValidUuid(attackId)) {
|
|
5029
5134
|
throw new AISecSDKException(
|
|
5030
5135
|
`Invalid attack id: ${attackId}`,
|
|
@@ -5040,9 +5145,13 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5040
5145
|
});
|
|
5041
5146
|
return res.data;
|
|
5042
5147
|
}
|
|
5043
|
-
/**
|
|
5148
|
+
/**
|
|
5149
|
+
* Get property statistics for a custom attack scan.
|
|
5150
|
+
* @param jobId - The job UUID.
|
|
5151
|
+
* @returns The list of property statistics.
|
|
5152
|
+
*/
|
|
5044
5153
|
async getPropertyStats(jobId) {
|
|
5045
|
-
|
|
5154
|
+
validateJobId(jobId);
|
|
5046
5155
|
const res = await managementHttpRequest({
|
|
5047
5156
|
method: "GET",
|
|
5048
5157
|
baseUrl: this.baseUrl,
|
|
@@ -5055,13 +5164,6 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5055
5164
|
};
|
|
5056
5165
|
|
|
5057
5166
|
// 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
5167
|
var RedTeamTargetsClient = class {
|
|
5066
5168
|
baseUrl;
|
|
5067
5169
|
oauthClient;
|
|
@@ -5091,9 +5193,13 @@ var RedTeamTargetsClient = class {
|
|
|
5091
5193
|
});
|
|
5092
5194
|
return res.data;
|
|
5093
5195
|
}
|
|
5094
|
-
/**
|
|
5196
|
+
/**
|
|
5197
|
+
* List targets with optional filters.
|
|
5198
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
5199
|
+
* @returns The paginated list of targets.
|
|
5200
|
+
*/
|
|
5095
5201
|
async list(opts) {
|
|
5096
|
-
const params =
|
|
5202
|
+
const params = buildRedTeamListParams(opts);
|
|
5097
5203
|
if (opts?.target_type !== void 0) params.target_type = opts.target_type;
|
|
5098
5204
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
5099
5205
|
const res = await managementHttpRequest({
|
|
@@ -5106,7 +5212,11 @@ var RedTeamTargetsClient = class {
|
|
|
5106
5212
|
});
|
|
5107
5213
|
return res.data;
|
|
5108
5214
|
}
|
|
5109
|
-
/**
|
|
5215
|
+
/**
|
|
5216
|
+
* Get a target by UUID.
|
|
5217
|
+
* @param uuid - The target UUID.
|
|
5218
|
+
* @returns The target response.
|
|
5219
|
+
*/
|
|
5110
5220
|
async get(uuid) {
|
|
5111
5221
|
if (!isValidUuid(uuid)) {
|
|
5112
5222
|
throw new AISecSDKException(
|
|
@@ -5123,7 +5233,13 @@ var RedTeamTargetsClient = class {
|
|
|
5123
5233
|
});
|
|
5124
5234
|
return res.data;
|
|
5125
5235
|
}
|
|
5126
|
-
/**
|
|
5236
|
+
/**
|
|
5237
|
+
* Update a target.
|
|
5238
|
+
* @param uuid - The target UUID.
|
|
5239
|
+
* @param request - Target update request body.
|
|
5240
|
+
* @param opts - Optional operation options (e.g. validate connection).
|
|
5241
|
+
* @returns The updated target response.
|
|
5242
|
+
*/
|
|
5127
5243
|
async update(uuid, request, opts) {
|
|
5128
5244
|
if (!isValidUuid(uuid)) {
|
|
5129
5245
|
throw new AISecSDKException(
|
|
@@ -5144,7 +5260,11 @@ var RedTeamTargetsClient = class {
|
|
|
5144
5260
|
});
|
|
5145
5261
|
return res.data;
|
|
5146
5262
|
}
|
|
5147
|
-
/**
|
|
5263
|
+
/**
|
|
5264
|
+
* Delete a target.
|
|
5265
|
+
* @param uuid - The target UUID.
|
|
5266
|
+
* @returns The delete response.
|
|
5267
|
+
*/
|
|
5148
5268
|
async delete(uuid) {
|
|
5149
5269
|
if (!isValidUuid(uuid)) {
|
|
5150
5270
|
throw new AISecSDKException(
|
|
@@ -5161,7 +5281,11 @@ var RedTeamTargetsClient = class {
|
|
|
5161
5281
|
});
|
|
5162
5282
|
return res.data;
|
|
5163
5283
|
}
|
|
5164
|
-
/**
|
|
5284
|
+
/**
|
|
5285
|
+
* Run profiling probes on a target.
|
|
5286
|
+
* @param request - The probe request body.
|
|
5287
|
+
* @returns The target response after probing.
|
|
5288
|
+
*/
|
|
5165
5289
|
async probe(request) {
|
|
5166
5290
|
const res = await managementHttpRequest({
|
|
5167
5291
|
method: "POST",
|
|
@@ -5173,7 +5297,11 @@ var RedTeamTargetsClient = class {
|
|
|
5173
5297
|
});
|
|
5174
5298
|
return res.data;
|
|
5175
5299
|
}
|
|
5176
|
-
/**
|
|
5300
|
+
/**
|
|
5301
|
+
* Get profiling results for a target.
|
|
5302
|
+
* @param uuid - The target UUID.
|
|
5303
|
+
* @returns The target profile response.
|
|
5304
|
+
*/
|
|
5177
5305
|
async getProfile(uuid) {
|
|
5178
5306
|
if (!isValidUuid(uuid)) {
|
|
5179
5307
|
throw new AISecSDKException(
|
|
@@ -5190,7 +5318,12 @@ var RedTeamTargetsClient = class {
|
|
|
5190
5318
|
});
|
|
5191
5319
|
return res.data;
|
|
5192
5320
|
}
|
|
5193
|
-
/**
|
|
5321
|
+
/**
|
|
5322
|
+
* Update a target profile (background + additional context).
|
|
5323
|
+
* @param uuid - The target UUID.
|
|
5324
|
+
* @param request - The context update request body.
|
|
5325
|
+
* @returns The updated target response.
|
|
5326
|
+
*/
|
|
5194
5327
|
async updateProfile(uuid, request) {
|
|
5195
5328
|
if (!isValidUuid(uuid)) {
|
|
5196
5329
|
throw new AISecSDKException(
|
|
@@ -5211,13 +5344,6 @@ var RedTeamTargetsClient = class {
|
|
|
5211
5344
|
};
|
|
5212
5345
|
|
|
5213
5346
|
// 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
5347
|
function validateUuid(uuid, label) {
|
|
5222
5348
|
if (!isValidUuid(uuid)) {
|
|
5223
5349
|
throw new AISecSDKException(`Invalid ${label}: ${uuid}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -5235,7 +5361,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5235
5361
|
// -----------------------------------------------------------------------
|
|
5236
5362
|
// Prompt Set operations
|
|
5237
5363
|
// -----------------------------------------------------------------------
|
|
5238
|
-
/**
|
|
5364
|
+
/**
|
|
5365
|
+
* Create a new custom prompt set.
|
|
5366
|
+
* @param request - Prompt set creation request body.
|
|
5367
|
+
* @returns The created prompt set response.
|
|
5368
|
+
*/
|
|
5239
5369
|
async createPromptSet(request) {
|
|
5240
5370
|
const res = await managementHttpRequest({
|
|
5241
5371
|
method: "POST",
|
|
@@ -5247,9 +5377,13 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5247
5377
|
});
|
|
5248
5378
|
return res.data;
|
|
5249
5379
|
}
|
|
5250
|
-
/**
|
|
5380
|
+
/**
|
|
5381
|
+
* List custom prompt sets.
|
|
5382
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
5383
|
+
* @returns The paginated list of prompt sets.
|
|
5384
|
+
*/
|
|
5251
5385
|
async listPromptSets(opts) {
|
|
5252
|
-
const params =
|
|
5386
|
+
const params = buildRedTeamListParams(opts);
|
|
5253
5387
|
if (opts?.status !== void 0) params.status = opts.status;
|
|
5254
5388
|
if (opts?.active !== void 0) params.active = String(opts.active);
|
|
5255
5389
|
if (opts?.archive !== void 0) params.archive = String(opts.archive);
|
|
@@ -5263,7 +5397,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5263
5397
|
});
|
|
5264
5398
|
return res.data;
|
|
5265
5399
|
}
|
|
5266
|
-
/**
|
|
5400
|
+
/**
|
|
5401
|
+
* Get a prompt set by UUID.
|
|
5402
|
+
* @param uuid - The prompt set UUID.
|
|
5403
|
+
* @returns The prompt set response.
|
|
5404
|
+
*/
|
|
5267
5405
|
async getPromptSet(uuid) {
|
|
5268
5406
|
validateUuid(uuid, "prompt set uuid");
|
|
5269
5407
|
const res = await managementHttpRequest({
|
|
@@ -5275,7 +5413,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5275
5413
|
});
|
|
5276
5414
|
return res.data;
|
|
5277
5415
|
}
|
|
5278
|
-
/**
|
|
5416
|
+
/**
|
|
5417
|
+
* Update a prompt set.
|
|
5418
|
+
* @param uuid - The prompt set UUID.
|
|
5419
|
+
* @param request - Prompt set update request body.
|
|
5420
|
+
* @returns The updated prompt set response.
|
|
5421
|
+
*/
|
|
5279
5422
|
async updatePromptSet(uuid, request) {
|
|
5280
5423
|
validateUuid(uuid, "prompt set uuid");
|
|
5281
5424
|
const res = await managementHttpRequest({
|
|
@@ -5288,7 +5431,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5288
5431
|
});
|
|
5289
5432
|
return res.data;
|
|
5290
5433
|
}
|
|
5291
|
-
/**
|
|
5434
|
+
/**
|
|
5435
|
+
* Archive or unarchive a prompt set.
|
|
5436
|
+
* @param uuid - The prompt set UUID.
|
|
5437
|
+
* @param request - Archive request body.
|
|
5438
|
+
* @returns The updated prompt set response.
|
|
5439
|
+
*/
|
|
5292
5440
|
async archivePromptSet(uuid, request) {
|
|
5293
5441
|
validateUuid(uuid, "prompt set uuid");
|
|
5294
5442
|
const res = await managementHttpRequest({
|
|
@@ -5301,7 +5449,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5301
5449
|
});
|
|
5302
5450
|
return res.data;
|
|
5303
5451
|
}
|
|
5304
|
-
/**
|
|
5452
|
+
/**
|
|
5453
|
+
* Resolve a prompt set reference for data plane consumption.
|
|
5454
|
+
* @param uuid - The prompt set UUID.
|
|
5455
|
+
* @returns The prompt set reference.
|
|
5456
|
+
*/
|
|
5305
5457
|
async getPromptSetReference(uuid) {
|
|
5306
5458
|
validateUuid(uuid, "prompt set uuid");
|
|
5307
5459
|
const res = await managementHttpRequest({
|
|
@@ -5313,7 +5465,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5313
5465
|
});
|
|
5314
5466
|
return res.data;
|
|
5315
5467
|
}
|
|
5316
|
-
/**
|
|
5468
|
+
/**
|
|
5469
|
+
* Get version information for a prompt set.
|
|
5470
|
+
* @param uuid - The prompt set UUID.
|
|
5471
|
+
* @returns The prompt set version info.
|
|
5472
|
+
*/
|
|
5317
5473
|
async getPromptSetVersionInfo(uuid) {
|
|
5318
5474
|
validateUuid(uuid, "prompt set uuid");
|
|
5319
5475
|
const res = await managementHttpRequest({
|
|
@@ -5325,7 +5481,10 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5325
5481
|
});
|
|
5326
5482
|
return res.data;
|
|
5327
5483
|
}
|
|
5328
|
-
/**
|
|
5484
|
+
/**
|
|
5485
|
+
* List active prompt sets (for data plane).
|
|
5486
|
+
* @returns The list of active prompt sets.
|
|
5487
|
+
*/
|
|
5329
5488
|
async listActivePromptSets() {
|
|
5330
5489
|
const res = await managementHttpRequest({
|
|
5331
5490
|
method: "GET",
|
|
@@ -5336,7 +5495,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5336
5495
|
});
|
|
5337
5496
|
return res.data;
|
|
5338
5497
|
}
|
|
5339
|
-
/**
|
|
5498
|
+
/**
|
|
5499
|
+
* Download CSV template for a prompt set.
|
|
5500
|
+
* @param uuid - The prompt set UUID.
|
|
5501
|
+
* @returns The CSV template content (untyped — raw response from the API).
|
|
5502
|
+
*/
|
|
5340
5503
|
async downloadTemplate(uuid) {
|
|
5341
5504
|
validateUuid(uuid, "prompt set uuid");
|
|
5342
5505
|
const res = await managementHttpRequest({
|
|
@@ -5348,7 +5511,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5348
5511
|
});
|
|
5349
5512
|
return res.data;
|
|
5350
5513
|
}
|
|
5351
|
-
/**
|
|
5514
|
+
/**
|
|
5515
|
+
* Upload a CSV file of custom prompts for a prompt set.
|
|
5516
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5517
|
+
* @param file - The CSV file blob.
|
|
5518
|
+
* @returns The upload response.
|
|
5519
|
+
*/
|
|
5352
5520
|
async uploadPromptsCsv(promptSetUuid, file) {
|
|
5353
5521
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
5354
5522
|
const token = await this.oauthClient.getToken();
|
|
@@ -5378,7 +5546,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5378
5546
|
// -----------------------------------------------------------------------
|
|
5379
5547
|
// Prompt operations
|
|
5380
5548
|
// -----------------------------------------------------------------------
|
|
5381
|
-
/**
|
|
5549
|
+
/**
|
|
5550
|
+
* Create a new custom prompt.
|
|
5551
|
+
* @param request - Prompt creation request body.
|
|
5552
|
+
* @returns The created prompt response.
|
|
5553
|
+
*/
|
|
5382
5554
|
async createPrompt(request) {
|
|
5383
5555
|
const res = await managementHttpRequest({
|
|
5384
5556
|
method: "POST",
|
|
@@ -5390,10 +5562,15 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5390
5562
|
});
|
|
5391
5563
|
return res.data;
|
|
5392
5564
|
}
|
|
5393
|
-
/**
|
|
5565
|
+
/**
|
|
5566
|
+
* List prompts in a prompt set.
|
|
5567
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5568
|
+
* @param opts - Optional pagination, search, and filter options.
|
|
5569
|
+
* @returns The paginated list of prompts.
|
|
5570
|
+
*/
|
|
5394
5571
|
async listPrompts(promptSetUuid, opts) {
|
|
5395
5572
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
5396
|
-
const params =
|
|
5573
|
+
const params = buildRedTeamListParams(opts);
|
|
5397
5574
|
if (opts?.active !== void 0) params.active = String(opts.active);
|
|
5398
5575
|
const res = await managementHttpRequest({
|
|
5399
5576
|
method: "GET",
|
|
@@ -5405,7 +5582,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5405
5582
|
});
|
|
5406
5583
|
return res.data;
|
|
5407
5584
|
}
|
|
5408
|
-
/**
|
|
5585
|
+
/**
|
|
5586
|
+
* Get a prompt by UUID.
|
|
5587
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5588
|
+
* @param promptUuid - The prompt UUID.
|
|
5589
|
+
* @returns The prompt response.
|
|
5590
|
+
*/
|
|
5409
5591
|
async getPrompt(promptSetUuid, promptUuid) {
|
|
5410
5592
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
5411
5593
|
validateUuid(promptUuid, "prompt uuid");
|
|
@@ -5418,7 +5600,13 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5418
5600
|
});
|
|
5419
5601
|
return res.data;
|
|
5420
5602
|
}
|
|
5421
|
-
/**
|
|
5603
|
+
/**
|
|
5604
|
+
* Update a prompt.
|
|
5605
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5606
|
+
* @param promptUuid - The prompt UUID.
|
|
5607
|
+
* @param request - Prompt update request body.
|
|
5608
|
+
* @returns The updated prompt response.
|
|
5609
|
+
*/
|
|
5422
5610
|
async updatePrompt(promptSetUuid, promptUuid, request) {
|
|
5423
5611
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
5424
5612
|
validateUuid(promptUuid, "prompt uuid");
|
|
@@ -5432,7 +5620,12 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5432
5620
|
});
|
|
5433
5621
|
return res.data;
|
|
5434
5622
|
}
|
|
5435
|
-
/**
|
|
5623
|
+
/**
|
|
5624
|
+
* Delete a prompt.
|
|
5625
|
+
* @param promptSetUuid - The prompt set UUID.
|
|
5626
|
+
* @param promptUuid - The prompt UUID.
|
|
5627
|
+
* @returns The delete response.
|
|
5628
|
+
*/
|
|
5436
5629
|
async deletePrompt(promptSetUuid, promptUuid) {
|
|
5437
5630
|
validateUuid(promptSetUuid, "prompt set uuid");
|
|
5438
5631
|
validateUuid(promptUuid, "prompt uuid");
|
|
@@ -5448,7 +5641,10 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5448
5641
|
// -----------------------------------------------------------------------
|
|
5449
5642
|
// Property operations
|
|
5450
5643
|
// -----------------------------------------------------------------------
|
|
5451
|
-
/**
|
|
5644
|
+
/**
|
|
5645
|
+
* Get all property names.
|
|
5646
|
+
* @returns The list of property names.
|
|
5647
|
+
*/
|
|
5452
5648
|
async getPropertyNames() {
|
|
5453
5649
|
const res = await managementHttpRequest({
|
|
5454
5650
|
method: "GET",
|
|
@@ -5459,7 +5655,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5459
5655
|
});
|
|
5460
5656
|
return res.data;
|
|
5461
5657
|
}
|
|
5462
|
-
/**
|
|
5658
|
+
/**
|
|
5659
|
+
* Create a new property name.
|
|
5660
|
+
* @param request - Property name creation request body.
|
|
5661
|
+
* @returns The creation response.
|
|
5662
|
+
*/
|
|
5463
5663
|
async createPropertyName(request) {
|
|
5464
5664
|
const res = await managementHttpRequest({
|
|
5465
5665
|
method: "POST",
|
|
@@ -5471,7 +5671,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5471
5671
|
});
|
|
5472
5672
|
return res.data;
|
|
5473
5673
|
}
|
|
5474
|
-
/**
|
|
5674
|
+
/**
|
|
5675
|
+
* Get values for a property name.
|
|
5676
|
+
* @param propertyName - The property name to look up.
|
|
5677
|
+
* @returns The property values response.
|
|
5678
|
+
*/
|
|
5475
5679
|
async getPropertyValues(propertyName) {
|
|
5476
5680
|
const res = await managementHttpRequest({
|
|
5477
5681
|
method: "GET",
|
|
@@ -5482,7 +5686,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5482
5686
|
});
|
|
5483
5687
|
return res.data;
|
|
5484
5688
|
}
|
|
5485
|
-
/**
|
|
5689
|
+
/**
|
|
5690
|
+
* Get values for multiple property names.
|
|
5691
|
+
* @param propertyNames - Array of property names to look up.
|
|
5692
|
+
* @returns The property values for all requested names.
|
|
5693
|
+
*/
|
|
5486
5694
|
async getPropertyValuesMultiple(propertyNames) {
|
|
5487
5695
|
const url = new URL(`https://placeholder${RED_TEAM_CUSTOM_ATTACK_PATH}/property-values`);
|
|
5488
5696
|
for (const name of propertyNames) {
|
|
@@ -5499,7 +5707,11 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5499
5707
|
});
|
|
5500
5708
|
return res.data;
|
|
5501
5709
|
}
|
|
5502
|
-
/**
|
|
5710
|
+
/**
|
|
5711
|
+
* Create a property value.
|
|
5712
|
+
* @param request - Property value creation request body.
|
|
5713
|
+
* @returns The creation response.
|
|
5714
|
+
*/
|
|
5503
5715
|
async createPropertyValue(request) {
|
|
5504
5716
|
const res = await managementHttpRequest({
|
|
5505
5717
|
method: "POST",
|
|
@@ -5514,13 +5726,6 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5514
5726
|
};
|
|
5515
5727
|
|
|
5516
5728
|
// 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
5729
|
var RedTeamClient = class {
|
|
5525
5730
|
/** Data plane scan operations. */
|
|
5526
5731
|
scans;
|
|
@@ -5598,7 +5803,11 @@ var RedTeamClient = class {
|
|
|
5598
5803
|
// -----------------------------------------------------------------------
|
|
5599
5804
|
// Data plane convenience methods
|
|
5600
5805
|
// -----------------------------------------------------------------------
|
|
5601
|
-
/**
|
|
5806
|
+
/**
|
|
5807
|
+
* Get scan statistics and risk profile (data plane dashboard).
|
|
5808
|
+
* @param params - Optional date range and target ID filters.
|
|
5809
|
+
* @returns The scan statistics response.
|
|
5810
|
+
*/
|
|
5602
5811
|
async getScanStatistics(params) {
|
|
5603
5812
|
const p = {};
|
|
5604
5813
|
if (params?.date_range !== void 0) p.date_range = params.date_range;
|
|
@@ -5613,7 +5822,11 @@ var RedTeamClient = class {
|
|
|
5613
5822
|
});
|
|
5614
5823
|
return res.data;
|
|
5615
5824
|
}
|
|
5616
|
-
/**
|
|
5825
|
+
/**
|
|
5826
|
+
* Get score trend for a target (data plane dashboard).
|
|
5827
|
+
* @param targetId - The target UUID.
|
|
5828
|
+
* @returns The score trend response.
|
|
5829
|
+
*/
|
|
5617
5830
|
async getScoreTrend(targetId) {
|
|
5618
5831
|
if (!isValidUuid(targetId)) {
|
|
5619
5832
|
throw new AISecSDKException(
|
|
@@ -5631,7 +5844,10 @@ var RedTeamClient = class {
|
|
|
5631
5844
|
});
|
|
5632
5845
|
return res.data;
|
|
5633
5846
|
}
|
|
5634
|
-
/**
|
|
5847
|
+
/**
|
|
5848
|
+
* Get quota summary.
|
|
5849
|
+
* @returns The quota summary.
|
|
5850
|
+
*/
|
|
5635
5851
|
async getQuota() {
|
|
5636
5852
|
const res = await managementHttpRequest({
|
|
5637
5853
|
method: "POST",
|
|
@@ -5642,7 +5858,12 @@ var RedTeamClient = class {
|
|
|
5642
5858
|
});
|
|
5643
5859
|
return res.data;
|
|
5644
5860
|
}
|
|
5645
|
-
/**
|
|
5861
|
+
/**
|
|
5862
|
+
* List error logs for a scan job.
|
|
5863
|
+
* @param jobId - The job UUID.
|
|
5864
|
+
* @param opts - Optional pagination and search options.
|
|
5865
|
+
* @returns The paginated list of error logs.
|
|
5866
|
+
*/
|
|
5646
5867
|
async getErrorLogs(jobId, opts) {
|
|
5647
5868
|
if (!isValidUuid(jobId)) {
|
|
5648
5869
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -5651,13 +5872,17 @@ var RedTeamClient = class {
|
|
|
5651
5872
|
method: "GET",
|
|
5652
5873
|
baseUrl: this.dataEndpoint,
|
|
5653
5874
|
path: `${RED_TEAM_ERROR_LOG_PATH}/${jobId}`,
|
|
5654
|
-
params:
|
|
5875
|
+
params: buildRedTeamListParams(opts),
|
|
5655
5876
|
oauthClient: this.oauthClient,
|
|
5656
5877
|
numRetries: this.numRetries
|
|
5657
5878
|
});
|
|
5658
5879
|
return res.data;
|
|
5659
5880
|
}
|
|
5660
|
-
/**
|
|
5881
|
+
/**
|
|
5882
|
+
* Update sentiment for a scan report.
|
|
5883
|
+
* @param request - The sentiment request body.
|
|
5884
|
+
* @returns The sentiment response.
|
|
5885
|
+
*/
|
|
5661
5886
|
async updateSentiment(request) {
|
|
5662
5887
|
const res = await managementHttpRequest({
|
|
5663
5888
|
method: "POST",
|
|
@@ -5669,7 +5894,11 @@ var RedTeamClient = class {
|
|
|
5669
5894
|
});
|
|
5670
5895
|
return res.data;
|
|
5671
5896
|
}
|
|
5672
|
-
/**
|
|
5897
|
+
/**
|
|
5898
|
+
* Get sentiment for a scan report.
|
|
5899
|
+
* @param jobId - The job UUID.
|
|
5900
|
+
* @returns The sentiment response.
|
|
5901
|
+
*/
|
|
5673
5902
|
async getSentiment(jobId) {
|
|
5674
5903
|
if (!isValidUuid(jobId)) {
|
|
5675
5904
|
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
@@ -5686,7 +5915,10 @@ var RedTeamClient = class {
|
|
|
5686
5915
|
// -----------------------------------------------------------------------
|
|
5687
5916
|
// Management plane convenience methods
|
|
5688
5917
|
// -----------------------------------------------------------------------
|
|
5689
|
-
/**
|
|
5918
|
+
/**
|
|
5919
|
+
* Get management dashboard overview.
|
|
5920
|
+
* @returns The dashboard overview response.
|
|
5921
|
+
*/
|
|
5690
5922
|
async getDashboardOverview() {
|
|
5691
5923
|
const res = await managementHttpRequest({
|
|
5692
5924
|
method: "GET",
|