xploitscan-shared-rules 1.14.1 → 1.14.2

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.js CHANGED
@@ -1058,8 +1058,8 @@ var hardcodedSecrets = {
1058
1058
  if (valMatch && nameMatch) {
1059
1059
  const value = valMatch[1];
1060
1060
  const isKeySuffix = nameMatch[1].endsWith("_KEY");
1061
- const isKebabIdentifier = value.length < 40 && /^[a-z0-9]+(-[a-z0-9]+)+$/.test(value);
1062
- if (isKeySuffix && isKebabIdentifier) continue;
1061
+ const isSlotIdentifier = value.length < 40 && /^[a-z0-9]+([_-][a-z0-9]+)+$/.test(value);
1062
+ if (isKeySuffix && isSlotIdentifier) continue;
1063
1063
  }
1064
1064
  }
1065
1065
  matches.push(rm);
@@ -8554,6 +8554,7 @@ Common false positive patterns you should catch:
8554
8554
  - The comparison is a type check (typeof x === "string") not a secret comparison
8555
8555
  - The file is a test, mock, or fixture file
8556
8556
  - The "secret" is a publishable/public key (pk_test_, NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY) designed to be client-side
8557
+ - The value is a slot/name identifier, not a credential: a SCREAMING_CASE *_KEY constant assigned a short lowercase word string (e.g. INDEX_KEY = "mc_saves_index", CACHE_KEY = "user-prefs-v2") is a localStorage/cookie/cache key NAME, not a secret. Real secrets are high-entropy and mixed-case (sk_live_aBcD\u2026), not dictionary words joined by - or _
8557
8558
  - The innerHTML/dangerouslySetInnerHTML uses a static constant or JSON.stringify, not user input
8558
8559
  - The redirect URL has already been validated (isAllowedRedirect, validateRedirect)
8559
8560
  - The webhook endpoint is for a non-Stripe service but flagged as "Stripe webhook"
@@ -8647,6 +8648,8 @@ async function filterFalsePositives(findings, fileContents) {
8647
8648
  return empty;
8648
8649
  }
8649
8650
  const fpMap = /* @__PURE__ */ new Map();
8651
+ let reviewedAny = false;
8652
+ let firstError = null;
8650
8653
  for (const [file, fileFindings] of byFile) {
8651
8654
  const content = fileContents.get(file);
8652
8655
  if (!content) continue;
@@ -8662,6 +8665,7 @@ async function filterFalsePositives(findings, fileContents) {
8662
8665
  });
8663
8666
  const text = response.content.filter((b) => b.type === "text").map((b) => b.text).join("");
8664
8667
  const results = parseReviewResponse(text);
8668
+ reviewedAny = true;
8665
8669
  for (const r of results) {
8666
8670
  if (r.verdict === "fp" && r.index >= 0 && r.index < batch.length) {
8667
8671
  const globalIndex = toReview.indexOf(batch[r.index]);
@@ -8670,11 +8674,18 @@ async function filterFalsePositives(findings, fileContents) {
8670
8674
  }
8671
8675
  }
8672
8676
  }
8673
- } catch {
8677
+ } catch (err) {
8678
+ if (!firstError) firstError = err;
8674
8679
  continue;
8675
8680
  }
8676
8681
  }
8677
8682
  }
8683
+ if (!reviewedAny && firstError) {
8684
+ console.error(
8685
+ "[ai-fp-filter] AI review unavailable \u2014 every model call failed; returning unreviewed findings:",
8686
+ firstError instanceof Error ? firstError.message : String(firstError)
8687
+ );
8688
+ }
8678
8689
  const filtered = toReview.filter((_, i) => !fpMap.has(i));
8679
8690
  const filteredFindings = [];
8680
8691
  for (const [idx, reason] of fpMap) {
@@ -8683,7 +8694,7 @@ async function filterFalsePositives(findings, fileContents) {
8683
8694
  return {
8684
8695
  findings: [...filtered, ...overflow],
8685
8696
  filteredFindings,
8686
- aiReviewed: true,
8697
+ aiReviewed: reviewedAny,
8687
8698
  removedCount: fpMap.size,
8688
8699
  totalBefore
8689
8700
  };