xploitscan-shared-rules 2.4.33 → 2.4.34
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 +15 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -20
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -236,7 +236,7 @@ __export(index_exports, {
|
|
|
236
236
|
module.exports = __toCommonJS(index_exports);
|
|
237
237
|
|
|
238
238
|
// src/version.ts
|
|
239
|
-
var SCANNER_VERSION = "2.4.
|
|
239
|
+
var SCANNER_VERSION = "2.4.34";
|
|
240
240
|
|
|
241
241
|
// src/snippet.ts
|
|
242
242
|
var cacheContent = null;
|
|
@@ -10453,9 +10453,8 @@ if (!(perCallTimeoutMs(AI_FILTER_BUDGET_MS) < AI_FILTER_BUDGET_MS)) {
|
|
|
10453
10453
|
throw new Error("per-call AI timeout must be strictly below the filter budget");
|
|
10454
10454
|
}
|
|
10455
10455
|
function isAbortError(err) {
|
|
10456
|
-
|
|
10457
|
-
|
|
10458
|
-
return name === "AbortError" || name === "APIUserAbortError";
|
|
10456
|
+
const { category } = classifyModelError(err);
|
|
10457
|
+
return category === "abort" || category === "timeout";
|
|
10459
10458
|
}
|
|
10460
10459
|
function isTimeoutError(err) {
|
|
10461
10460
|
if (!err || typeof err !== "object") return false;
|
|
@@ -10469,11 +10468,6 @@ function errorHttpStatus(err) {
|
|
|
10469
10468
|
const status = err.status;
|
|
10470
10469
|
return typeof status === "number" && Number.isFinite(status) ? Math.trunc(status) : null;
|
|
10471
10470
|
}
|
|
10472
|
-
function callWasAborted(err) {
|
|
10473
|
-
if (!err || typeof err !== "object") return false;
|
|
10474
|
-
const name = "name" in err ? String(err.name) : "";
|
|
10475
|
-
return name === "AbortError" || name === "APIUserAbortError";
|
|
10476
|
-
}
|
|
10477
10471
|
var SAFE_ERROR_IDENT = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
|
|
10478
10472
|
var SAFE_ERROR_CODE = /^[A-Z][A-Z0-9_]{1,47}$/;
|
|
10479
10473
|
function safeIdent(value) {
|
|
@@ -10490,9 +10484,9 @@ function errorClassChain(err) {
|
|
|
10490
10484
|
}
|
|
10491
10485
|
return names;
|
|
10492
10486
|
}
|
|
10493
|
-
function
|
|
10487
|
+
function causeInfo(err) {
|
|
10494
10488
|
const cause = err.cause;
|
|
10495
|
-
if (!cause || typeof cause !== "object") return null;
|
|
10489
|
+
if (!cause || typeof cause !== "object") return { label: null, code: null };
|
|
10496
10490
|
const chain = errorClassChain(cause);
|
|
10497
10491
|
const name = chain[0] ?? safeIdent(cause.name);
|
|
10498
10492
|
let code = null;
|
|
@@ -10502,8 +10496,8 @@ function causeLabel(err) {
|
|
|
10502
10496
|
if (typeof raw === "string" && SAFE_ERROR_CODE.test(raw)) code = raw;
|
|
10503
10497
|
node = node.cause;
|
|
10504
10498
|
}
|
|
10505
|
-
if (!name && !code) return null;
|
|
10506
|
-
return code ? `${name ?? "unknown"}/${code}` : name;
|
|
10499
|
+
if (!name && !code) return { label: null, code: null };
|
|
10500
|
+
return { label: code ? `${name ?? "unknown"}/${code}` : name, code };
|
|
10507
10501
|
}
|
|
10508
10502
|
function classifyModelError(err) {
|
|
10509
10503
|
if (!err || typeof err !== "object") {
|
|
@@ -10516,17 +10510,18 @@ function classifyModelError(err) {
|
|
|
10516
10510
|
const status = errorHttpStatus(err);
|
|
10517
10511
|
const names = new Set(chain);
|
|
10518
10512
|
if (ownName) names.add(ownName);
|
|
10513
|
+
const { label: cause, code: causeCode } = causeInfo(err);
|
|
10519
10514
|
let category = "unknown";
|
|
10520
10515
|
if (status === 401 || status === 403) category = "auth";
|
|
10521
10516
|
else if (status === 400) category = "bad_request";
|
|
10522
10517
|
else if (status === 429) category = "rate_limit";
|
|
10523
10518
|
else if (status != null && status >= 500) category = "server";
|
|
10524
10519
|
else if (status != null && status >= 400) category = "client";
|
|
10525
|
-
else if (names.has("APIConnectionTimeoutError") || names.has("TimeoutError")
|
|
10526
|
-
|
|
10520
|
+
else if (names.has("APIConnectionTimeoutError") || names.has("TimeoutError") || causeCode === "ETIMEDOUT") {
|
|
10521
|
+
category = "timeout";
|
|
10522
|
+
} else if (names.has("APIUserAbortError") || names.has("AbortError")) category = "abort";
|
|
10527
10523
|
else if (names.has("APIConnectionError")) category = "connection";
|
|
10528
|
-
|
|
10529
|
-
if (category === "unknown" && cause && cause.includes("/")) category = "connection";
|
|
10524
|
+
if (category === "unknown" && causeCode) category = "connection";
|
|
10530
10525
|
return { name, category, status, cause };
|
|
10531
10526
|
}
|
|
10532
10527
|
function isRetryableModelError(info) {
|
|
@@ -10883,7 +10878,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
|
|
|
10883
10878
|
const totalBefore = findings.length;
|
|
10884
10879
|
let client;
|
|
10885
10880
|
try {
|
|
10886
|
-
client = new import_sdk.default();
|
|
10881
|
+
client = retryTransient ? new import_sdk.default({ maxRetries: 1 }) : new import_sdk.default();
|
|
10887
10882
|
} catch {
|
|
10888
10883
|
if (budgetTimer) clearTimeout(budgetTimer);
|
|
10889
10884
|
return early("failed", "client_init", {
|
|
@@ -10983,6 +10978,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
|
|
|
10983
10978
|
return;
|
|
10984
10979
|
}
|
|
10985
10980
|
let active = targets;
|
|
10981
|
+
let callAborted = false;
|
|
10986
10982
|
try {
|
|
10987
10983
|
const remaining = Math.max(1, deadlineMs - Date.now());
|
|
10988
10984
|
const fences = assignFileFences(targets, fileContents);
|
|
@@ -11045,7 +11041,6 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
|
|
|
11045
11041
|
);
|
|
11046
11042
|
}
|
|
11047
11043
|
const perCall = perCallTimeoutMs(budgetMs);
|
|
11048
|
-
let callAborted = false;
|
|
11049
11044
|
const send = async (callTimeout) => {
|
|
11050
11045
|
const callAbort = new AbortController();
|
|
11051
11046
|
const onParentAbort = () => callAbort.abort();
|
|
@@ -11150,7 +11145,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
|
|
|
11150
11145
|
console.error(`[ai-fp-filter] AI review failed: auth status ${status2}`);
|
|
11151
11146
|
return;
|
|
11152
11147
|
}
|
|
11153
|
-
const callTimedOut = isAbortError(err) || isTimeoutError(err) || abortController.signal.aborted
|
|
11148
|
+
const callTimedOut = callAborted || isAbortError(err) || isTimeoutError(err) || abortController.signal.aborted;
|
|
11154
11149
|
if (callTimedOut) {
|
|
11155
11150
|
timedOutCount += active.length;
|
|
11156
11151
|
budgetExpired = true;
|