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.cjs CHANGED
@@ -2190,13 +2190,19 @@ var stripeWebhookUnprotected = {
2190
2190
  check(content, filePath) {
2191
2191
  if (!filePath.match(/\.(js|ts|jsx|tsx|py|rb|go|java|php)$/)) return [];
2192
2192
  if (isTestFile(filePath)) return [];
2193
- if (!/stripe/i.test(content)) return [];
2194
- const hasStripeWebhookHandler = /(?:stripe.*webhook|webhook.*stripe)/i.test(content) || /(?:checkout\.session\.completed|invoice\.paid|payment_intent|customer\.subscription)/i.test(content);
2193
+ const pathSaysStripeWebhook = /(?:^|\/)(?:stripe[_-]?webhooks?|webhooks?[_-]?stripe)(?:\/|\.|$)/i.test(filePath) || /webhooks?\/stripe/i.test(filePath) || /stripe\/webhooks?/i.test(filePath);
2194
+ if (!/stripe/i.test(content) && !pathSaysStripeWebhook) return [];
2195
+ const hasStripeWebhookHandler = pathSaysStripeWebhook || /(?:stripe.*webhook|webhook.*stripe)/i.test(content) || /(?:checkout\.session\.completed|invoice\.paid|payment_intent|customer\.subscription)/i.test(content);
2195
2196
  if (!hasStripeWebhookHandler) return [];
2196
- if (/constructEvent|verifyHeader|stripe[_-]?signature|webhook[_-]?secret|STRIPE_WEBHOOK_SECRET/i.test(content)) return [];
2197
+ 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 [];
2197
2198
  const handlerPatterns = [
2198
2199
  // POST handler that processes Stripe events
2199
2200
  /export\s+(?:async\s+)?function\s+POST\s*\(/g,
2201
+ // The same handler written as an exported arrow or function expression:
2202
+ // export const POST = async (req) => { … }
2203
+ // Added alongside the same shape in VC003 (#648); without it an App
2204
+ // Router webhook written in the arrow style was invisible.
2205
+ /export\s+const\s+POST\s*(?::[^=]+)?=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>/g,
2200
2206
  // Express-style Stripe webhook route
2201
2207
  /\.(post|all)\s*\(\s*["'`][^"'`]*(?:stripe|webhook)[^"'`]*["'`]/gi,
2202
2208
  // Event type checking without prior verification