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.cjs CHANGED
@@ -1326,8 +1326,8 @@ var hardcodedSecrets = {
1326
1326
  if (valMatch && nameMatch) {
1327
1327
  const value = valMatch[1];
1328
1328
  const isKeySuffix = nameMatch[1].endsWith("_KEY");
1329
- const isKebabIdentifier = value.length < 40 && /^[a-z0-9]+(-[a-z0-9]+)+$/.test(value);
1330
- if (isKeySuffix && isKebabIdentifier) continue;
1329
+ const isSlotIdentifier = value.length < 40 && /^[a-z0-9]+([_-][a-z0-9]+)+$/.test(value);
1330
+ if (isKeySuffix && isSlotIdentifier) continue;
1331
1331
  }
1332
1332
  }
1333
1333
  matches.push(rm);
@@ -8822,6 +8822,7 @@ Common false positive patterns you should catch:
8822
8822
  - The comparison is a type check (typeof x === "string") not a secret comparison
8823
8823
  - The file is a test, mock, or fixture file
8824
8824
  - The "secret" is a publishable/public key (pk_test_, NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY) designed to be client-side
8825
+ - 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 _
8825
8826
  - The innerHTML/dangerouslySetInnerHTML uses a static constant or JSON.stringify, not user input
8826
8827
  - The redirect URL has already been validated (isAllowedRedirect, validateRedirect)
8827
8828
  - The webhook endpoint is for a non-Stripe service but flagged as "Stripe webhook"
@@ -8915,6 +8916,8 @@ async function filterFalsePositives(findings, fileContents) {
8915
8916
  return empty;
8916
8917
  }
8917
8918
  const fpMap = /* @__PURE__ */ new Map();
8919
+ let reviewedAny = false;
8920
+ let firstError = null;
8918
8921
  for (const [file, fileFindings] of byFile) {
8919
8922
  const content = fileContents.get(file);
8920
8923
  if (!content) continue;
@@ -8930,6 +8933,7 @@ async function filterFalsePositives(findings, fileContents) {
8930
8933
  });
8931
8934
  const text = response.content.filter((b) => b.type === "text").map((b) => b.text).join("");
8932
8935
  const results = parseReviewResponse(text);
8936
+ reviewedAny = true;
8933
8937
  for (const r of results) {
8934
8938
  if (r.verdict === "fp" && r.index >= 0 && r.index < batch.length) {
8935
8939
  const globalIndex = toReview.indexOf(batch[r.index]);
@@ -8938,11 +8942,18 @@ async function filterFalsePositives(findings, fileContents) {
8938
8942
  }
8939
8943
  }
8940
8944
  }
8941
- } catch {
8945
+ } catch (err) {
8946
+ if (!firstError) firstError = err;
8942
8947
  continue;
8943
8948
  }
8944
8949
  }
8945
8950
  }
8951
+ if (!reviewedAny && firstError) {
8952
+ console.error(
8953
+ "[ai-fp-filter] AI review unavailable \u2014 every model call failed; returning unreviewed findings:",
8954
+ firstError instanceof Error ? firstError.message : String(firstError)
8955
+ );
8956
+ }
8946
8957
  const filtered = toReview.filter((_, i) => !fpMap.has(i));
8947
8958
  const filteredFindings = [];
8948
8959
  for (const [idx, reason] of fpMap) {
@@ -8951,7 +8962,7 @@ async function filterFalsePositives(findings, fileContents) {
8951
8962
  return {
8952
8963
  findings: [...filtered, ...overflow],
8953
8964
  filteredFindings,
8954
- aiReviewed: true,
8965
+ aiReviewed: reviewedAny,
8955
8966
  removedCount: fpMap.size,
8956
8967
  totalBefore
8957
8968
  };