xploitscan-shared-rules 2.4.34 → 2.4.35

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 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.34";
239
+ var SCANNER_VERSION = "2.4.35";
240
240
 
241
241
  // src/snippet.ts
242
242
  var cacheContent = null;
@@ -10484,6 +10484,12 @@ function errorClassChain(err) {
10484
10484
  }
10485
10485
  return names;
10486
10486
  }
10487
+ var TIMEOUT_CAUSE_CODES = /* @__PURE__ */ new Set([
10488
+ "ETIMEDOUT",
10489
+ "ESOCKETTIMEDOUT",
10490
+ "UND_ERR_CONNECT_TIMEOUT",
10491
+ "UND_ERR_HEADERS_TIMEOUT"
10492
+ ]);
10487
10493
  function causeInfo(err) {
10488
10494
  const cause = err.cause;
10489
10495
  if (!cause || typeof cause !== "object") return { label: null, code: null };
@@ -10517,7 +10523,7 @@ function classifyModelError(err) {
10517
10523
  else if (status === 429) category = "rate_limit";
10518
10524
  else if (status != null && status >= 500) category = "server";
10519
10525
  else if (status != null && status >= 400) category = "client";
10520
- else if (names.has("APIConnectionTimeoutError") || names.has("TimeoutError") || causeCode === "ETIMEDOUT") {
10526
+ else if (names.has("APIConnectionTimeoutError") || names.has("TimeoutError") || causeCode !== null && TIMEOUT_CAUSE_CODES.has(causeCode)) {
10521
10527
  category = "timeout";
10522
10528
  } else if (names.has("APIUserAbortError") || names.has("AbortError")) category = "abort";
10523
10529
  else if (names.has("APIConnectionError")) category = "connection";
@@ -10894,6 +10900,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
10894
10900
  let firstErrorStatus = null;
10895
10901
  let authFailed = false;
10896
10902
  let badOutput = false;
10903
+ let exceptionFailure = false;
10897
10904
  const maskStats = { prompt_batches: 0, prompt_chars: 0, masked_count: 0, had_secret_pattern: false, raw_after_mask: 0 };
10898
10905
  let failedBatches = 0;
10899
10906
  let failedFindingCount = 0;
@@ -10979,6 +10986,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
10979
10986
  }
10980
10987
  let active = targets;
10981
10988
  let callAborted = false;
10989
+ let malformed = false;
10982
10990
  try {
10983
10991
  const remaining = Math.max(1, deadlineMs - Date.now());
10984
10992
  const fences = assignFileFences(targets, fileContents);
@@ -11092,6 +11100,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
11092
11100
  const results = parseReviewResponse(text);
11093
11101
  if (!results) {
11094
11102
  badOutput = true;
11103
+ malformed = true;
11095
11104
  throw new Error("AI review returned malformed JSON");
11096
11105
  }
11097
11106
  const multiFile = files.length > 1;
@@ -11130,6 +11139,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
11130
11139
  if (unmatched > 0) {
11131
11140
  failedFindingCount += unmatched;
11132
11141
  failedBatches++;
11142
+ exceptionFailure = true;
11133
11143
  if (!firstError) firstError = new Error("AI review returned incomplete verdicts");
11134
11144
  }
11135
11145
  } catch (err) {
@@ -11153,6 +11163,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
11153
11163
  }
11154
11164
  failedBatches++;
11155
11165
  failedFindingCount += active.length;
11166
+ if (status2 == null && !malformed) exceptionFailure = true;
11156
11167
  if (!firstError) {
11157
11168
  firstError = err;
11158
11169
  firstErrorStatus = status2;
@@ -11216,6 +11227,9 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
11216
11227
  } else if (totalBefore > 0 && reviewedCount === totalBefore) {
11217
11228
  status = "reviewed";
11218
11229
  reason = null;
11230
+ } else if (reviewedCount === 0 && exceptionFailure && (timedOut || budgetExpired && tasks.length > 0)) {
11231
+ status = "failed";
11232
+ reason = "exception";
11219
11233
  } else if (reviewedCount === 0 && (timedOut || budgetExpired && tasks.length > 0)) {
11220
11234
  status = "failed";
11221
11235
  reason = "budget_timeout";