xploitscan-shared-rules 1.27.4 → 1.27.5
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 +5 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2305,11 +2305,12 @@ var stripeWebhookUnprotected = {
|
|
|
2305
2305
|
check(content, filePath) {
|
|
2306
2306
|
if (!filePath.match(/\.(js|ts|jsx|tsx|py|rb|go|java|php)$/)) return [];
|
|
2307
2307
|
if (isTestFile(filePath)) return [];
|
|
2308
|
+
const code = maskComments(content);
|
|
2308
2309
|
const pathSaysStripeWebhook = /(?:^|\/)(?:stripe[_-]?webhooks?|webhooks?[_-]?stripe)(?:\/|\.|$)/i.test(filePath) || /webhooks?\/stripe/i.test(filePath) || /stripe\/webhooks?/i.test(filePath);
|
|
2309
|
-
if (!/stripe/i.test(
|
|
2310
|
-
const hasStripeWebhookHandler = pathSaysStripeWebhook || /(?:stripe.*webhook|webhook.*stripe)/i.test(
|
|
2310
|
+
if (!/stripe/i.test(code) && !pathSaysStripeWebhook) return [];
|
|
2311
|
+
const hasStripeWebhookHandler = pathSaysStripeWebhook || /(?:stripe.*webhook|webhook.*stripe)/i.test(code) || /(?:checkout\.session\.completed|invoice\.paid|payment_intent|customer\.subscription)/i.test(code);
|
|
2311
2312
|
if (!hasStripeWebhookHandler) return [];
|
|
2312
|
-
if (/constructEvent|verifyHeader|stripe[_-]?signature|webhook[_-]?secret|STRIPE_WEBHOOK_SECRET/i.test(
|
|
2313
|
+
if (/constructEvent|verifyHeader|stripe[_-]?signature|webhook[_-]?secret|STRIPE_WEBHOOK_SECRET/i.test(code) || /\b\w*verif\w*\s*\(/i.test(code) && /\bverif\w*(?:stripe|webhook|signature|sig)\w*\s*\(/i.test(code)) return [];
|
|
2313
2314
|
const handlerPatterns = [
|
|
2314
2315
|
// POST handler that processes Stripe events
|
|
2315
2316
|
/export\s+(?:async\s+)?function\s+POST\s*\(/g,
|
|
@@ -2327,7 +2328,7 @@ var stripeWebhookUnprotected = {
|
|
|
2327
2328
|
for (const pattern of handlerPatterns) {
|
|
2328
2329
|
matches.push(
|
|
2329
2330
|
...findMatches(
|
|
2330
|
-
|
|
2331
|
+
code,
|
|
2331
2332
|
pattern,
|
|
2332
2333
|
stripeWebhookUnprotected,
|
|
2333
2334
|
filePath,
|