xploitscan-shared-rules 1.25.0 → 1.25.2
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 +21 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +21 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -991,6 +991,12 @@ var ABSENCE = /\b(?:without|missing|lacks?|lacking|absent|no|not?)\b[\w\s,/-]{0,
|
|
|
991
991
|
function describesAbsence(text) {
|
|
992
992
|
return ABSENCE.test(text);
|
|
993
993
|
}
|
|
994
|
+
var EXCEPTION = /\b(?:except|excepting|other than|apart from|besides|excluding)\b\s*:?\s*\(?([^).;]{2,80})/i;
|
|
995
|
+
function exemptions(text) {
|
|
996
|
+
const m = text.match(EXCEPTION);
|
|
997
|
+
if (!m) return [];
|
|
998
|
+
return (m[1].match(/[/a-z][\w/-]{2,}/gi) ?? []).map((s) => s.toLowerCase().replace(/^\//, "")).filter((s) => s.length > 2 && !["and", "the", "for", "routes", "requests", "endpoints"].includes(s));
|
|
999
|
+
}
|
|
994
1000
|
function isGlobalClaim(text) {
|
|
995
1001
|
return /\b(all|every|any|each|no one|nobody|everything)\b/i.test(text) || /\ball (?:api )?(?:routes?|endpoints?|pages?)\b/i.test(text);
|
|
996
1002
|
}
|
|
@@ -1023,7 +1029,13 @@ function checkIntent(files, findings) {
|
|
|
1023
1029
|
unchallenged.push({ statement, expectation: exp.expectation });
|
|
1024
1030
|
continue;
|
|
1025
1031
|
}
|
|
1032
|
+
const exempt = exemptions(statement.text);
|
|
1026
1033
|
const relevant = candidates.filter((f) => {
|
|
1034
|
+
if (isVendoredFinding(f)) return false;
|
|
1035
|
+
if (exempt.length) {
|
|
1036
|
+
const hay = `${f.file} ${routes.find((r) => r.source === f.file)?.path ?? ""}`.toLowerCase();
|
|
1037
|
+
if (exempt.some((e) => hay.includes(e))) return false;
|
|
1038
|
+
}
|
|
1027
1039
|
if (global) return true;
|
|
1028
1040
|
const fileTokens = pathTokens(f.file);
|
|
1029
1041
|
const route2 = routes.find((r) => r.source === f.file);
|
|
@@ -2190,13 +2202,19 @@ var stripeWebhookUnprotected = {
|
|
|
2190
2202
|
check(content, filePath) {
|
|
2191
2203
|
if (!filePath.match(/\.(js|ts|jsx|tsx|py|rb|go|java|php)$/)) return [];
|
|
2192
2204
|
if (isTestFile(filePath)) return [];
|
|
2193
|
-
|
|
2194
|
-
|
|
2205
|
+
const pathSaysStripeWebhook = /(?:^|\/)(?:stripe[_-]?webhooks?|webhooks?[_-]?stripe)(?:\/|\.|$)/i.test(filePath) || /webhooks?\/stripe/i.test(filePath) || /stripe\/webhooks?/i.test(filePath);
|
|
2206
|
+
if (!/stripe/i.test(content) && !pathSaysStripeWebhook) return [];
|
|
2207
|
+
const hasStripeWebhookHandler = pathSaysStripeWebhook || /(?:stripe.*webhook|webhook.*stripe)/i.test(content) || /(?:checkout\.session\.completed|invoice\.paid|payment_intent|customer\.subscription)/i.test(content);
|
|
2195
2208
|
if (!hasStripeWebhookHandler) return [];
|
|
2196
|
-
if (/constructEvent|verifyHeader|stripe[_-]?signature|webhook[_-]?secret|STRIPE_WEBHOOK_SECRET/i.test(content)) return [];
|
|
2209
|
+
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
2210
|
const handlerPatterns = [
|
|
2198
2211
|
// POST handler that processes Stripe events
|
|
2199
2212
|
/export\s+(?:async\s+)?function\s+POST\s*\(/g,
|
|
2213
|
+
// The same handler written as an exported arrow or function expression:
|
|
2214
|
+
// export const POST = async (req) => { … }
|
|
2215
|
+
// Added alongside the same shape in VC003 (#648); without it an App
|
|
2216
|
+
// Router webhook written in the arrow style was invisible.
|
|
2217
|
+
/export\s+const\s+POST\s*(?::[^=]+)?=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>/g,
|
|
2200
2218
|
// Express-style Stripe webhook route
|
|
2201
2219
|
/\.(post|all)\s*\(\s*["'`][^"'`]*(?:stripe|webhook)[^"'`]*["'`]/gi,
|
|
2202
2220
|
// Event type checking without prior verification
|