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.js CHANGED
@@ -692,6 +692,12 @@ var ABSENCE = /\b(?:without|missing|lacks?|lacking|absent|no|not?)\b[\w\s,/-]{0,
692
692
  function describesAbsence(text) {
693
693
  return ABSENCE.test(text);
694
694
  }
695
+ var EXCEPTION = /\b(?:except|excepting|other than|apart from|besides|excluding)\b\s*:?\s*\(?([^).;]{2,80})/i;
696
+ function exemptions(text) {
697
+ const m = text.match(EXCEPTION);
698
+ if (!m) return [];
699
+ 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));
700
+ }
695
701
  function isGlobalClaim(text) {
696
702
  return /\b(all|every|any|each|no one|nobody|everything)\b/i.test(text) || /\ball (?:api )?(?:routes?|endpoints?|pages?)\b/i.test(text);
697
703
  }
@@ -724,7 +730,13 @@ function checkIntent(files, findings) {
724
730
  unchallenged.push({ statement, expectation: exp.expectation });
725
731
  continue;
726
732
  }
733
+ const exempt = exemptions(statement.text);
727
734
  const relevant = candidates.filter((f) => {
735
+ if (isVendoredFinding(f)) return false;
736
+ if (exempt.length) {
737
+ const hay = `${f.file} ${routes.find((r) => r.source === f.file)?.path ?? ""}`.toLowerCase();
738
+ if (exempt.some((e) => hay.includes(e))) return false;
739
+ }
728
740
  if (global) return true;
729
741
  const fileTokens = pathTokens(f.file);
730
742
  const route2 = routes.find((r) => r.source === f.file);