@cdot65/prisma-airs-sdk 0.6.5 → 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 +18 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +18 -23
- 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";
|
|
@@ -659,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;
|
|
|
659
659
|
function isValidUuid(value) {
|
|
660
660
|
return UUID_RE.test(value);
|
|
661
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
|
+
}
|
|
662
667
|
function generatePayloadHash(payload, secret) {
|
|
663
668
|
return (0, import_node_crypto.createHmac)("sha256", secret).update(payload).digest("hex");
|
|
664
669
|
}
|
|
@@ -968,6 +973,7 @@ var Content = class _Content {
|
|
|
968
973
|
/**
|
|
969
974
|
* Load content from a JSON file.
|
|
970
975
|
* @param filePath - Path to JSON file containing scan request contents.
|
|
976
|
+
* @returns A new Content instance populated from the JSON file.
|
|
971
977
|
*/
|
|
972
978
|
static fromJSONFile(filePath) {
|
|
973
979
|
const raw = (0, import_node_fs.readFileSync)(filePath, "utf-8");
|
|
@@ -3154,7 +3160,6 @@ var OAuthClient = class {
|
|
|
3154
3160
|
}
|
|
3155
3161
|
/**
|
|
3156
3162
|
* Clear the cached token, forcing a fresh fetch on next call.
|
|
3157
|
-
* @returns Nothing.
|
|
3158
3163
|
*/
|
|
3159
3164
|
clearToken() {
|
|
3160
3165
|
this.accessToken = null;
|
|
@@ -3501,7 +3506,7 @@ var TopicsClient = class {
|
|
|
3501
3506
|
/**
|
|
3502
3507
|
* Force-delete a custom topic, removing it from any referencing profiles.
|
|
3503
3508
|
* @param topicId - UUID of the topic to force-delete.
|
|
3504
|
-
* @param updatedBy - Email of the user performing the deletion.
|
|
3509
|
+
* @param updatedBy - Optional. Email of the user performing the deletion.
|
|
3505
3510
|
* @returns Deletion confirmation message.
|
|
3506
3511
|
*/
|
|
3507
3512
|
async forceDelete(topicId, updatedBy) {
|
|
@@ -4713,11 +4718,6 @@ var RedTeamScansClient = class {
|
|
|
4713
4718
|
};
|
|
4714
4719
|
|
|
4715
4720
|
// src/red-team/reports-client.ts
|
|
4716
|
-
function validateJobId(jobId) {
|
|
4717
|
-
if (!isValidUuid(jobId)) {
|
|
4718
|
-
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
4719
|
-
}
|
|
4720
|
-
}
|
|
4721
4721
|
var RedTeamReportsClient = class {
|
|
4722
4722
|
baseUrl;
|
|
4723
4723
|
oauthClient;
|
|
@@ -4975,7 +4975,7 @@ var RedTeamReportsClient = class {
|
|
|
4975
4975
|
* Download a report in the specified format.
|
|
4976
4976
|
* @param jobId - The job UUID.
|
|
4977
4977
|
* @param format - The file format (e.g. "pdf", "csv").
|
|
4978
|
-
* @returns The
|
|
4978
|
+
* @returns The report data in the requested format (untyped — shape depends on `format`).
|
|
4979
4979
|
*/
|
|
4980
4980
|
async downloadReport(jobId, format) {
|
|
4981
4981
|
validateJobId(jobId);
|
|
@@ -4993,7 +4993,7 @@ var RedTeamReportsClient = class {
|
|
|
4993
4993
|
/**
|
|
4994
4994
|
* Generate a partial report for a running scan.
|
|
4995
4995
|
* @param jobId - The job UUID.
|
|
4996
|
-
* @returns The partial report
|
|
4996
|
+
* @returns The partial report payload (untyped — schema not yet defined by the API).
|
|
4997
4997
|
*/
|
|
4998
4998
|
async generatePartialReport(jobId) {
|
|
4999
4999
|
validateJobId(jobId);
|
|
@@ -5009,11 +5009,6 @@ var RedTeamReportsClient = class {
|
|
|
5009
5009
|
};
|
|
5010
5010
|
|
|
5011
5011
|
// src/red-team/custom-attack-reports-client.ts
|
|
5012
|
-
function validateJobId2(jobId) {
|
|
5013
|
-
if (!isValidUuid(jobId)) {
|
|
5014
|
-
throw new AISecSDKException(`Invalid job id: ${jobId}`, "AISEC_USER_REQUEST_PAYLOAD_ERROR" /* USER_REQUEST_PAYLOAD_ERROR */);
|
|
5015
|
-
}
|
|
5016
|
-
}
|
|
5017
5012
|
var RedTeamCustomAttackReportsClient = class {
|
|
5018
5013
|
baseUrl;
|
|
5019
5014
|
oauthClient;
|
|
@@ -5029,7 +5024,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5029
5024
|
* @returns The custom attack report response.
|
|
5030
5025
|
*/
|
|
5031
5026
|
async getReport(jobId) {
|
|
5032
|
-
|
|
5027
|
+
validateJobId(jobId);
|
|
5033
5028
|
const res = await managementHttpRequest({
|
|
5034
5029
|
method: "GET",
|
|
5035
5030
|
baseUrl: this.baseUrl,
|
|
@@ -5045,7 +5040,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5045
5040
|
* @returns The prompt sets report response.
|
|
5046
5041
|
*/
|
|
5047
5042
|
async getPromptSets(jobId) {
|
|
5048
|
-
|
|
5043
|
+
validateJobId(jobId);
|
|
5049
5044
|
const res = await managementHttpRequest({
|
|
5050
5045
|
method: "GET",
|
|
5051
5046
|
baseUrl: this.baseUrl,
|
|
@@ -5063,7 +5058,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5063
5058
|
* @returns The list of prompt detail responses.
|
|
5064
5059
|
*/
|
|
5065
5060
|
async getPromptsBySet(jobId, promptSetId, opts) {
|
|
5066
|
-
|
|
5061
|
+
validateJobId(jobId);
|
|
5067
5062
|
if (!isValidUuid(promptSetId)) {
|
|
5068
5063
|
throw new AISecSDKException(
|
|
5069
5064
|
`Invalid prompt set id: ${promptSetId}`,
|
|
@@ -5089,7 +5084,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5089
5084
|
* @returns The prompt detail response.
|
|
5090
5085
|
*/
|
|
5091
5086
|
async getPromptDetail(jobId, promptId) {
|
|
5092
|
-
|
|
5087
|
+
validateJobId(jobId);
|
|
5093
5088
|
if (!isValidUuid(promptId)) {
|
|
5094
5089
|
throw new AISecSDKException(
|
|
5095
5090
|
`Invalid prompt id: ${promptId}`,
|
|
@@ -5112,7 +5107,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5112
5107
|
* @returns The paginated list of custom attacks.
|
|
5113
5108
|
*/
|
|
5114
5109
|
async listCustomAttacks(jobId, opts) {
|
|
5115
|
-
|
|
5110
|
+
validateJobId(jobId);
|
|
5116
5111
|
const params = buildRedTeamListParams(opts);
|
|
5117
5112
|
if (opts?.threat !== void 0) params.threat = String(opts.threat);
|
|
5118
5113
|
if (opts?.prompt_set_id !== void 0) params.prompt_set_id = opts.prompt_set_id;
|
|
@@ -5134,7 +5129,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5134
5129
|
* @returns The list of attack outputs.
|
|
5135
5130
|
*/
|
|
5136
5131
|
async getAttackOutputs(jobId, attackId) {
|
|
5137
|
-
|
|
5132
|
+
validateJobId(jobId);
|
|
5138
5133
|
if (!isValidUuid(attackId)) {
|
|
5139
5134
|
throw new AISecSDKException(
|
|
5140
5135
|
`Invalid attack id: ${attackId}`,
|
|
@@ -5156,7 +5151,7 @@ var RedTeamCustomAttackReportsClient = class {
|
|
|
5156
5151
|
* @returns The list of property statistics.
|
|
5157
5152
|
*/
|
|
5158
5153
|
async getPropertyStats(jobId) {
|
|
5159
|
-
|
|
5154
|
+
validateJobId(jobId);
|
|
5160
5155
|
const res = await managementHttpRequest({
|
|
5161
5156
|
method: "GET",
|
|
5162
5157
|
baseUrl: this.baseUrl,
|
|
@@ -5503,7 +5498,7 @@ var RedTeamCustomAttacksClient = class {
|
|
|
5503
5498
|
/**
|
|
5504
5499
|
* Download CSV template for a prompt set.
|
|
5505
5500
|
* @param uuid - The prompt set UUID.
|
|
5506
|
-
* @returns The CSV template
|
|
5501
|
+
* @returns The CSV template content (untyped — raw response from the API).
|
|
5507
5502
|
*/
|
|
5508
5503
|
async downloadTemplate(uuid) {
|
|
5509
5504
|
validateUuid(uuid, "prompt set uuid");
|