xploitscan-shared-rules 1.25.1 → 1.25.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
@@ -991,6 +991,12 @@ var ABSENCE = /\b(?:without|missing|lacks?|lacking|absent|no|not?)\b[\w\s,/-]{0,
991
991
  function describesAbsence(text) {
992
992
  return ABSENCE.test(text);
993
993
  }
994
+ var EXCEPTION = /\b(?:except|excepting|other than|apart from|besides|excluding)\b\s*:?\s*\(?([^).;]{2,80})/i;
995
+ function exemptions(text) {
996
+ const m = text.match(EXCEPTION);
997
+ if (!m) return [];
998
+ return (m[1].match(/[/a-z][\w/-]{2,}/gi) ?? []).map((s) => s.toLowerCase().replace(/^\//, "")).filter((s) => s.length > 2 && !["and", "the", "for", "routes", "requests", "endpoints"].includes(s));
999
+ }
994
1000
  function isGlobalClaim(text) {
995
1001
  return /\b(all|every|any|each|no one|nobody|everything)\b/i.test(text) || /\ball (?:api )?(?:routes?|endpoints?|pages?)\b/i.test(text);
996
1002
  }
@@ -1023,7 +1029,13 @@ function checkIntent(files, findings) {
1023
1029
  unchallenged.push({ statement, expectation: exp.expectation });
1024
1030
  continue;
1025
1031
  }
1032
+ const exempt = exemptions(statement.text);
1026
1033
  const relevant = candidates.filter((f) => {
1034
+ if (isVendoredFinding(f)) return false;
1035
+ if (exempt.length) {
1036
+ const hay = `${f.file} ${routes.find((r) => r.source === f.file)?.path ?? ""}`.toLowerCase();
1037
+ if (exempt.some((e) => hay.includes(e))) return false;
1038
+ }
1027
1039
  if (global) return true;
1028
1040
  const fileTokens = pathTokens(f.file);
1029
1041
  const route2 = routes.find((r) => r.source === f.file);