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.d.cts
CHANGED
|
@@ -169,7 +169,7 @@ interface CustomRule {
|
|
|
169
169
|
* before a scan can be saved without enough provenance to explain a changed
|
|
170
170
|
* grade.
|
|
171
171
|
*/
|
|
172
|
-
declare const SCANNER_VERSION = "2.4.
|
|
172
|
+
declare const SCANNER_VERSION = "2.4.34";
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
175
|
* Line-oriented helpers shared by every rule. Pure string manipulation — no fs
|
package/dist/index.d.ts
CHANGED
|
@@ -169,7 +169,7 @@ interface CustomRule {
|
|
|
169
169
|
* before a scan can be saved without enough provenance to explain a changed
|
|
170
170
|
* grade.
|
|
171
171
|
*/
|
|
172
|
-
declare const SCANNER_VERSION = "2.4.
|
|
172
|
+
declare const SCANNER_VERSION = "2.4.34";
|
|
173
173
|
|
|
174
174
|
/**
|
|
175
175
|
* Line-oriented helpers shared by every rule. Pure string manipulation — no fs
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/version.ts
|
|
2
|
-
var SCANNER_VERSION = "2.4.
|
|
2
|
+
var SCANNER_VERSION = "2.4.34";
|
|
3
3
|
|
|
4
4
|
// src/snippet.ts
|
|
5
5
|
var cacheContent = null;
|
|
@@ -10216,9 +10216,8 @@ if (!(perCallTimeoutMs(AI_FILTER_BUDGET_MS) < AI_FILTER_BUDGET_MS)) {
|
|
|
10216
10216
|
throw new Error("per-call AI timeout must be strictly below the filter budget");
|
|
10217
10217
|
}
|
|
10218
10218
|
function isAbortError(err) {
|
|
10219
|
-
|
|
10220
|
-
|
|
10221
|
-
return name === "AbortError" || name === "APIUserAbortError";
|
|
10219
|
+
const { category } = classifyModelError(err);
|
|
10220
|
+
return category === "abort" || category === "timeout";
|
|
10222
10221
|
}
|
|
10223
10222
|
function isTimeoutError(err) {
|
|
10224
10223
|
if (!err || typeof err !== "object") return false;
|
|
@@ -10232,11 +10231,6 @@ function errorHttpStatus(err) {
|
|
|
10232
10231
|
const status = err.status;
|
|
10233
10232
|
return typeof status === "number" && Number.isFinite(status) ? Math.trunc(status) : null;
|
|
10234
10233
|
}
|
|
10235
|
-
function callWasAborted(err) {
|
|
10236
|
-
if (!err || typeof err !== "object") return false;
|
|
10237
|
-
const name = "name" in err ? String(err.name) : "";
|
|
10238
|
-
return name === "AbortError" || name === "APIUserAbortError";
|
|
10239
|
-
}
|
|
10240
10234
|
var SAFE_ERROR_IDENT = /^[A-Za-z][A-Za-z0-9_]{0,63}$/;
|
|
10241
10235
|
var SAFE_ERROR_CODE = /^[A-Z][A-Z0-9_]{1,47}$/;
|
|
10242
10236
|
function safeIdent(value) {
|
|
@@ -10253,9 +10247,9 @@ function errorClassChain(err) {
|
|
|
10253
10247
|
}
|
|
10254
10248
|
return names;
|
|
10255
10249
|
}
|
|
10256
|
-
function
|
|
10250
|
+
function causeInfo(err) {
|
|
10257
10251
|
const cause = err.cause;
|
|
10258
|
-
if (!cause || typeof cause !== "object") return null;
|
|
10252
|
+
if (!cause || typeof cause !== "object") return { label: null, code: null };
|
|
10259
10253
|
const chain = errorClassChain(cause);
|
|
10260
10254
|
const name = chain[0] ?? safeIdent(cause.name);
|
|
10261
10255
|
let code = null;
|
|
@@ -10265,8 +10259,8 @@ function causeLabel(err) {
|
|
|
10265
10259
|
if (typeof raw === "string" && SAFE_ERROR_CODE.test(raw)) code = raw;
|
|
10266
10260
|
node = node.cause;
|
|
10267
10261
|
}
|
|
10268
|
-
if (!name && !code) return null;
|
|
10269
|
-
return code ? `${name ?? "unknown"}/${code}` : name;
|
|
10262
|
+
if (!name && !code) return { label: null, code: null };
|
|
10263
|
+
return { label: code ? `${name ?? "unknown"}/${code}` : name, code };
|
|
10270
10264
|
}
|
|
10271
10265
|
function classifyModelError(err) {
|
|
10272
10266
|
if (!err || typeof err !== "object") {
|
|
@@ -10279,17 +10273,18 @@ function classifyModelError(err) {
|
|
|
10279
10273
|
const status = errorHttpStatus(err);
|
|
10280
10274
|
const names = new Set(chain);
|
|
10281
10275
|
if (ownName) names.add(ownName);
|
|
10276
|
+
const { label: cause, code: causeCode } = causeInfo(err);
|
|
10282
10277
|
let category = "unknown";
|
|
10283
10278
|
if (status === 401 || status === 403) category = "auth";
|
|
10284
10279
|
else if (status === 400) category = "bad_request";
|
|
10285
10280
|
else if (status === 429) category = "rate_limit";
|
|
10286
10281
|
else if (status != null && status >= 500) category = "server";
|
|
10287
10282
|
else if (status != null && status >= 400) category = "client";
|
|
10288
|
-
else if (names.has("APIConnectionTimeoutError") || names.has("TimeoutError")
|
|
10289
|
-
|
|
10283
|
+
else if (names.has("APIConnectionTimeoutError") || names.has("TimeoutError") || causeCode === "ETIMEDOUT") {
|
|
10284
|
+
category = "timeout";
|
|
10285
|
+
} else if (names.has("APIUserAbortError") || names.has("AbortError")) category = "abort";
|
|
10290
10286
|
else if (names.has("APIConnectionError")) category = "connection";
|
|
10291
|
-
|
|
10292
|
-
if (category === "unknown" && cause && cause.includes("/")) category = "connection";
|
|
10287
|
+
if (category === "unknown" && causeCode) category = "connection";
|
|
10293
10288
|
return { name, category, status, cause };
|
|
10294
10289
|
}
|
|
10295
10290
|
function isRetryableModelError(info) {
|
|
@@ -10646,7 +10641,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
|
|
|
10646
10641
|
const totalBefore = findings.length;
|
|
10647
10642
|
let client;
|
|
10648
10643
|
try {
|
|
10649
|
-
client = new Anthropic();
|
|
10644
|
+
client = retryTransient ? new Anthropic({ maxRetries: 1 }) : new Anthropic();
|
|
10650
10645
|
} catch {
|
|
10651
10646
|
if (budgetTimer) clearTimeout(budgetTimer);
|
|
10652
10647
|
return early("failed", "client_init", {
|
|
@@ -10746,6 +10741,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
|
|
|
10746
10741
|
return;
|
|
10747
10742
|
}
|
|
10748
10743
|
let active = targets;
|
|
10744
|
+
let callAborted = false;
|
|
10749
10745
|
try {
|
|
10750
10746
|
const remaining = Math.max(1, deadlineMs - Date.now());
|
|
10751
10747
|
const fences = assignFileFences(targets, fileContents);
|
|
@@ -10808,7 +10804,6 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
|
|
|
10808
10804
|
);
|
|
10809
10805
|
}
|
|
10810
10806
|
const perCall = perCallTimeoutMs(budgetMs);
|
|
10811
|
-
let callAborted = false;
|
|
10812
10807
|
const send = async (callTimeout) => {
|
|
10813
10808
|
const callAbort = new AbortController();
|
|
10814
10809
|
const onParentAbort = () => callAbort.abort();
|
|
@@ -10913,7 +10908,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
|
|
|
10913
10908
|
console.error(`[ai-fp-filter] AI review failed: auth status ${status2}`);
|
|
10914
10909
|
return;
|
|
10915
10910
|
}
|
|
10916
|
-
const callTimedOut = isAbortError(err) || isTimeoutError(err) || abortController.signal.aborted
|
|
10911
|
+
const callTimedOut = callAborted || isAbortError(err) || isTimeoutError(err) || abortController.signal.aborted;
|
|
10917
10912
|
if (callTimedOut) {
|
|
10918
10913
|
timedOutCount += active.length;
|
|
10919
10914
|
budgetExpired = true;
|