xploitscan-shared-rules 1.27.0 → 1.27.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 +34 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +34 -3
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -343,11 +343,17 @@ var NON_APP_PATH_PATTERNS = [
|
|
|
343
343
|
// which makes even a repo-root `.claude/` a nested segment.
|
|
344
344
|
".claude/**",
|
|
345
345
|
".agent/**",
|
|
346
|
+
// Plural too. `.agent/**` alone let `.agents/skills/**` through as app code,
|
|
347
|
+
// and agent scaffolds ship .tsx templates — so every rule fired on somebody
|
|
348
|
+
// else's boilerplate. Found 2026-09-15 while specifying the unwired-control
|
|
349
|
+
// check, which produced 4 accusations against one such template.
|
|
350
|
+
".agents/**",
|
|
346
351
|
".cursor/**",
|
|
347
352
|
".superpowers/**",
|
|
348
353
|
".windsurf/**",
|
|
349
354
|
"**/.claude/**",
|
|
350
355
|
"**/.agent/**",
|
|
356
|
+
"**/.agents/**",
|
|
351
357
|
"**/.cursor/**",
|
|
352
358
|
"**/.superpowers/**",
|
|
353
359
|
"**/.windsurf/**",
|
|
@@ -1803,6 +1809,7 @@ var missingAuthMiddleware = {
|
|
|
1803
1809
|
description: "API routes without authentication checks allow unauthorized access.",
|
|
1804
1810
|
check(content, filePath, project) {
|
|
1805
1811
|
if (!isServerSideFile(filePath, content)) return [];
|
|
1812
|
+
if (PUBLIC_BY_CONVENTION_ROUTE.test(routeSegmentName(filePath))) return [];
|
|
1806
1813
|
const routePatterns = [
|
|
1807
1814
|
// Express/Hono style
|
|
1808
1815
|
/\.(get|post|put|patch|delete)\s*\(\s*["'`][^"'`]+["'`]\s*,\s*(?:async\s+)?\(?(?:req|c|ctx)/gi,
|
|
@@ -1868,7 +1875,22 @@ var missingAuthMiddleware = {
|
|
|
1868
1875
|
/\bjwt\.verify\b/i,
|
|
1869
1876
|
/\bbearer\s/i,
|
|
1870
1877
|
/\b(?:protect|guard)\(/i,
|
|
1871
|
-
/\.use\([^)]*(?:auth|session|protect|requireAuth)/i
|
|
1878
|
+
/\.use\([^)]*(?:auth|session|protect|requireAuth)/i,
|
|
1879
|
+
// A handler that can answer HTTP 401 is, by definition, deciding whether
|
|
1880
|
+
// the caller is allowed in. This catches the whole family of
|
|
1881
|
+
// capability-token flows the named patterns above miss — magic links,
|
|
1882
|
+
// share links, unsubscribe links, invite/claim URLs — where there is no
|
|
1883
|
+
// session and no account, and the unguessable token in the request IS
|
|
1884
|
+
// the credential, checked by a bespoke lookup like
|
|
1885
|
+
// `findShareByToken(slug, token)`.
|
|
1886
|
+
//
|
|
1887
|
+
// 401 only, deliberately not 403. 401 means "I could not authenticate
|
|
1888
|
+
// you"; 403 is routinely returned by things that never identified the
|
|
1889
|
+
// caller at all — an Origin allowlist on an anonymous analytics beacon,
|
|
1890
|
+
// a feature flag, a geo block. Accepting 403 would suppress genuinely
|
|
1891
|
+
// unauthenticated routes.
|
|
1892
|
+
/\bstatus(?:Code)?\s*[:(]\s*401\b/,
|
|
1893
|
+
/\bsendStatus\s*\(\s*401\b/
|
|
1872
1894
|
];
|
|
1873
1895
|
const APP_LEVEL_AUTH = [
|
|
1874
1896
|
/\.use\([^)]*(?:auth|session|protect|requireAuth)/i,
|
|
@@ -1928,6 +1950,15 @@ var missingAuthMiddleware = {
|
|
|
1928
1950
|
return filterSilenced(unauthenticated, content, "VC003");
|
|
1929
1951
|
}
|
|
1930
1952
|
};
|
|
1953
|
+
var PUBLIC_BY_CONVENTION_ROUTE = /^(?:og|opengraph-image|twitter-image|icon|apple-icon|favicon|sitemap|robots|manifest|badge)(?:[.-]\w+)?$/i;
|
|
1954
|
+
function routeSegmentName(filePath) {
|
|
1955
|
+
const segments = filePath.split("/");
|
|
1956
|
+
const base = segments[segments.length - 1] ?? "";
|
|
1957
|
+
if (/^route\.(?:ts|tsx|js|jsx|mjs|cjs)$/i.test(base)) {
|
|
1958
|
+
return segments[segments.length - 2] ?? "";
|
|
1959
|
+
}
|
|
1960
|
+
return base.replace(/\.[^.]+$/, "");
|
|
1961
|
+
}
|
|
1931
1962
|
var supabaseNoRLS = {
|
|
1932
1963
|
id: "VC004",
|
|
1933
1964
|
title: "Supabase Client Without Row Level Security",
|
|
@@ -2461,10 +2492,10 @@ var insecureCookies = {
|
|
|
2461
2492
|
check(content, filePath) {
|
|
2462
2493
|
if (isTestFile(filePath)) return [];
|
|
2463
2494
|
if (!/cookie/i.test(content)) return [];
|
|
2464
|
-
const setCookiePattern = /(?:set-cookie|setCookie
|
|
2495
|
+
const setCookiePattern = /(?:set-cookie|setCookie|\bcookie\s*=|res\.cookie\s*\()/gi;
|
|
2465
2496
|
if (!setCookiePattern.test(content)) return [];
|
|
2466
2497
|
const hasHttpOnly = /httpOnly\s*:\s*true|httponly/i.test(content);
|
|
2467
|
-
const hasSecure = /secure\s*:\s*
|
|
2498
|
+
const hasSecure = /secure\s*:\s*(?!false\b)\S/i.test(content) || /;\s*secure/i.test(content);
|
|
2468
2499
|
const hasSameSite = /sameSite\s*:|samesite/i.test(content);
|
|
2469
2500
|
const matches = [];
|
|
2470
2501
|
if (!hasHttpOnly || !hasSecure || !hasSameSite) {
|