xploitscan-shared-rules 1.27.2 → 1.27.3

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
@@ -2037,6 +2037,19 @@ var stripeWebhookUnprotected = {
2037
2037
  return matches;
2038
2038
  }
2039
2039
  };
2040
+ var PLACEHOLDER_IDENT_RE = /(?<![\w$])([\w$]*?)(placeholders?)(?![\w$])/gi;
2041
+ function namesPlaceholderRun(content) {
2042
+ PLACEHOLDER_IDENT_RE.lastIndex = 0;
2043
+ let m = PLACEHOLDER_IDENT_RE.exec(content);
2044
+ for (; m !== null; m = PLACEHOLDER_IDENT_RE.exec(content)) {
2045
+ const prefix = m[1];
2046
+ if (prefix === "") return true;
2047
+ const boundary = prefix[prefix.length - 1];
2048
+ if (boundary === "_" || boundary === "$") return true;
2049
+ if (/[a-z0-9]/.test(boundary) && /[A-Z]/.test(m[2][0])) return true;
2050
+ }
2051
+ return false;
2052
+ }
2040
2053
  var sqlInjection = {
2041
2054
  id: "VC006",
2042
2055
  title: "Potential SQL Injection",
@@ -2072,8 +2085,8 @@ var sqlInjection = {
2072
2085
  /["'`]\s*(?:SELECT|INSERT|UPDATE|DELETE)\b[^"'`\n]*\b(?:FROM|INTO|SET|VALUES|WHERE|JOIN|RETURNING)\b[^"'`\n]*\$\{(?!.*parameterized)/gi
2073
2086
  ];
2074
2087
  const matches = [];
2075
- const usesParams = /\?\s*,|\?[^?,;]{1,20}\?|\$\d+|:[\w]+|\bprepare\b|\bplaceholders?\b/i.test(content);
2076
- if (usesParams) return [];
2088
+ const usesParams = /\?\s*,|\?[^?,;]{1,20}\?|\$\d+|:[\w]+|\bprepare\b/i.test(content);
2089
+ if (usesParams || namesPlaceholderRun(content)) return [];
2077
2090
  for (const pattern of patterns) {
2078
2091
  const raw = findMatches(
2079
2092
  content,