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.js
CHANGED
|
@@ -2004,11 +2004,12 @@ var stripeWebhookUnprotected = {
|
|
|
2004
2004
|
check(content, filePath) {
|
|
2005
2005
|
if (!filePath.match(/\.(js|ts|jsx|tsx|py|rb|go|java|php)$/)) return [];
|
|
2006
2006
|
if (isTestFile(filePath)) return [];
|
|
2007
|
+
const code = maskComments(content);
|
|
2007
2008
|
const pathSaysStripeWebhook = /(?:^|\/)(?:stripe[_-]?webhooks?|webhooks?[_-]?stripe)(?:\/|\.|$)/i.test(filePath) || /webhooks?\/stripe/i.test(filePath) || /stripe\/webhooks?/i.test(filePath);
|
|
2008
|
-
if (!/stripe/i.test(
|
|
2009
|
-
const hasStripeWebhookHandler = pathSaysStripeWebhook || /(?:stripe.*webhook|webhook.*stripe)/i.test(
|
|
2009
|
+
if (!/stripe/i.test(code) && !pathSaysStripeWebhook) return [];
|
|
2010
|
+
const hasStripeWebhookHandler = pathSaysStripeWebhook || /(?:stripe.*webhook|webhook.*stripe)/i.test(code) || /(?:checkout\.session\.completed|invoice\.paid|payment_intent|customer\.subscription)/i.test(code);
|
|
2010
2011
|
if (!hasStripeWebhookHandler) return [];
|
|
2011
|
-
if (/constructEvent|verifyHeader|stripe[_-]?signature|webhook[_-]?secret|STRIPE_WEBHOOK_SECRET/i.test(
|
|
2012
|
+
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 [];
|
|
2012
2013
|
const handlerPatterns = [
|
|
2013
2014
|
// POST handler that processes Stripe events
|
|
2014
2015
|
/export\s+(?:async\s+)?function\s+POST\s*\(/g,
|
|
@@ -2026,7 +2027,7 @@ var stripeWebhookUnprotected = {
|
|
|
2026
2027
|
for (const pattern of handlerPatterns) {
|
|
2027
2028
|
matches.push(
|
|
2028
2029
|
...findMatches(
|
|
2029
|
-
|
|
2030
|
+
code,
|
|
2030
2031
|
pattern,
|
|
2031
2032
|
stripeWebhookUnprotected,
|
|
2032
2033
|
filePath,
|