xploitscan-shared-rules 1.25.0 → 1.25.1

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
@@ -1891,13 +1891,19 @@ var stripeWebhookUnprotected = {
1891
1891
  check(content, filePath) {
1892
1892
  if (!filePath.match(/\.(js|ts|jsx|tsx|py|rb|go|java|php)$/)) return [];
1893
1893
  if (isTestFile(filePath)) return [];
1894
- if (!/stripe/i.test(content)) return [];
1895
- const hasStripeWebhookHandler = /(?:stripe.*webhook|webhook.*stripe)/i.test(content) || /(?:checkout\.session\.completed|invoice\.paid|payment_intent|customer\.subscription)/i.test(content);
1894
+ const pathSaysStripeWebhook = /(?:^|\/)(?:stripe[_-]?webhooks?|webhooks?[_-]?stripe)(?:\/|\.|$)/i.test(filePath) || /webhooks?\/stripe/i.test(filePath) || /stripe\/webhooks?/i.test(filePath);
1895
+ if (!/stripe/i.test(content) && !pathSaysStripeWebhook) return [];
1896
+ const hasStripeWebhookHandler = pathSaysStripeWebhook || /(?:stripe.*webhook|webhook.*stripe)/i.test(content) || /(?:checkout\.session\.completed|invoice\.paid|payment_intent|customer\.subscription)/i.test(content);
1896
1897
  if (!hasStripeWebhookHandler) return [];
1897
- if (/constructEvent|verifyHeader|stripe[_-]?signature|webhook[_-]?secret|STRIPE_WEBHOOK_SECRET/i.test(content)) return [];
1898
+ if (/constructEvent|verifyHeader|stripe[_-]?signature|webhook[_-]?secret|STRIPE_WEBHOOK_SECRET/i.test(content) || /\b\w*verif\w*\s*\(/i.test(content) && /\bverif\w*(?:stripe|webhook|signature|sig)\w*\s*\(/i.test(content)) return [];
1898
1899
  const handlerPatterns = [
1899
1900
  // POST handler that processes Stripe events
1900
1901
  /export\s+(?:async\s+)?function\s+POST\s*\(/g,
1902
+ // The same handler written as an exported arrow or function expression:
1903
+ // export const POST = async (req) => { … }
1904
+ // Added alongside the same shape in VC003 (#648); without it an App
1905
+ // Router webhook written in the arrow style was invisible.
1906
+ /export\s+const\s+POST\s*(?::[^=]+)?=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>/g,
1901
1907
  // Express-style Stripe webhook route
1902
1908
  /\.(post|all)\s*\(\s*["'`][^"'`]*(?:stripe|webhook)[^"'`]*["'`]/gi,
1903
1909
  // Event type checking without prior verification