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.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.34";
172
+ declare const SCANNER_VERSION = "2.4.35";
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.34";
172
+ declare const SCANNER_VERSION = "2.4.35";
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.34";
2
+ var SCANNER_VERSION = "2.4.35";
3
3
 
4
4
  // src/snippet.ts
5
5
  var cacheContent = null;
@@ -10247,6 +10247,12 @@ function errorClassChain(err) {
10247
10247
  }
10248
10248
  return names;
10249
10249
  }
10250
+ var TIMEOUT_CAUSE_CODES = /* @__PURE__ */ new Set([
10251
+ "ETIMEDOUT",
10252
+ "ESOCKETTIMEDOUT",
10253
+ "UND_ERR_CONNECT_TIMEOUT",
10254
+ "UND_ERR_HEADERS_TIMEOUT"
10255
+ ]);
10250
10256
  function causeInfo(err) {
10251
10257
  const cause = err.cause;
10252
10258
  if (!cause || typeof cause !== "object") return { label: null, code: null };
@@ -10280,7 +10286,7 @@ function classifyModelError(err) {
10280
10286
  else if (status === 429) category = "rate_limit";
10281
10287
  else if (status != null && status >= 500) category = "server";
10282
10288
  else if (status != null && status >= 400) category = "client";
10283
- else if (names.has("APIConnectionTimeoutError") || names.has("TimeoutError") || causeCode === "ETIMEDOUT") {
10289
+ else if (names.has("APIConnectionTimeoutError") || names.has("TimeoutError") || causeCode !== null && TIMEOUT_CAUSE_CODES.has(causeCode)) {
10284
10290
  category = "timeout";
10285
10291
  } else if (names.has("APIUserAbortError") || names.has("AbortError")) category = "abort";
10286
10292
  else if (names.has("APIConnectionError")) category = "connection";
@@ -10657,6 +10663,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
10657
10663
  let firstErrorStatus = null;
10658
10664
  let authFailed = false;
10659
10665
  let badOutput = false;
10666
+ let exceptionFailure = false;
10660
10667
  const maskStats = { prompt_batches: 0, prompt_chars: 0, masked_count: 0, had_secret_pattern: false, raw_after_mask: 0 };
10661
10668
  let failedBatches = 0;
10662
10669
  let failedFindingCount = 0;
@@ -10742,6 +10749,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
10742
10749
  }
10743
10750
  let active = targets;
10744
10751
  let callAborted = false;
10752
+ let malformed = false;
10745
10753
  try {
10746
10754
  const remaining = Math.max(1, deadlineMs - Date.now());
10747
10755
  const fences = assignFileFences(targets, fileContents);
@@ -10855,6 +10863,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
10855
10863
  const results = parseReviewResponse(text);
10856
10864
  if (!results) {
10857
10865
  badOutput = true;
10866
+ malformed = true;
10858
10867
  throw new Error("AI review returned malformed JSON");
10859
10868
  }
10860
10869
  const multiFile = files.length > 1;
@@ -10893,6 +10902,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
10893
10902
  if (unmatched > 0) {
10894
10903
  failedFindingCount += unmatched;
10895
10904
  failedBatches++;
10905
+ exceptionFailure = true;
10896
10906
  if (!firstError) firstError = new Error("AI review returned incomplete verdicts");
10897
10907
  }
10898
10908
  } catch (err) {
@@ -10916,6 +10926,7 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
10916
10926
  }
10917
10927
  failedBatches++;
10918
10928
  failedFindingCount += active.length;
10929
+ if (status2 == null && !malformed) exceptionFailure = true;
10919
10930
  if (!firstError) {
10920
10931
  firstError = err;
10921
10932
  firstErrorStatus = status2;
@@ -10979,6 +10990,9 @@ async function filterFalsePositives(findings, fileContents, budgetMs = AI_FILTER
10979
10990
  } else if (totalBefore > 0 && reviewedCount === totalBefore) {
10980
10991
  status = "reviewed";
10981
10992
  reason = null;
10993
+ } else if (reviewedCount === 0 && exceptionFailure && (timedOut || budgetExpired && tasks.length > 0)) {
10994
+ status = "failed";
10995
+ reason = "exception";
10982
10996
  } else if (reviewedCount === 0 && (timedOut || budgetExpired && tasks.length > 0)) {
10983
10997
  status = "failed";
10984
10998
  reason = "budget_timeout";