xploitscan-shared-rules 1.14.0 → 1.14.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/README.md +2 -2
- package/dist/index.cjs +37 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +17 -1
- package/dist/index.d.ts +17 -1
- package/dist/index.js +36 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Shared XploitScan rule definitions, helpers, compliance mappings, the AI false-positive filter, and the entropy-based secret scanner.
|
|
4
4
|
|
|
5
|
-
This package is the source of truth for XploitScan's detection logic. It's consumed by the [XploitScan CLI](https://www.npmjs.com/package/xploitscan), the [XploitScan MCP server](https://www.npmjs.com/package/xploitscan-mcp), the web scan API at [xploitscan.com](https://xploitscan.com), and the [XploitScan GitHub Action](https://github.com/marketplace/actions/xploitscan-security-scanner) — so detection behavior can't drift between surfaces.
|
|
5
|
+
This package is the source of truth for XploitScan's detection logic. It's consumed by the [XploitScan CLI](https://www.npmjs.com/package/xploitscan), the [XploitScan MCP server](https://www.npmjs.com/package/xploitscan-mcp), the [VS Code extension](https://marketplace.visualstudio.com/items?itemName=XploitScan.xploitscan-vscode), the web scan API at [xploitscan.com](https://xploitscan.com), and the [XploitScan GitHub Action](https://github.com/marketplace/actions/xploitscan-security-scanner) — so detection behavior can't drift between surfaces.
|
|
6
6
|
|
|
7
7
|
## What's in here
|
|
8
8
|
|
|
9
|
-
- **210 security rules** — pattern + AST-based detection for hardcoded secrets, SQL injection, XSS, SSRF, prototype pollution, crypto misuse, deserialization, JWT alg confusion, and more.
|
|
9
|
+
- **210+ security rules** — pattern + AST-based detection for hardcoded secrets, SQL injection, XSS, SSRF, prototype pollution, crypto misuse, deserialization, JWT alg confusion, and more.
|
|
10
10
|
- **Compliance mappings** — each rule tagged with the SOC2, ISO 27001, and OWASP Top 10 controls it covers.
|
|
11
11
|
- **AI false-positive filter** — optional Claude Haiku integration that re-evaluates findings to suppress benign matches before reporting.
|
|
12
12
|
- **Entropy-based secret scanner** — detects high-entropy strings that look like credentials but don't match a known service-key pattern.
|
package/dist/index.cjs
CHANGED
|
@@ -52,6 +52,7 @@ __export(index_exports, {
|
|
|
52
52
|
dangerousInnerHTML: () => dangerousInnerHTML,
|
|
53
53
|
deprecatedTLS: () => deprecatedTLS,
|
|
54
54
|
detectFramework: () => detectFramework,
|
|
55
|
+
detectPlatform: () => detectPlatform,
|
|
55
56
|
disabledTLSVerification: () => disabledTLSVerification,
|
|
56
57
|
djangoDebug: () => djangoDebug,
|
|
57
58
|
dockerCopySensitive: () => dockerCopySensitive,
|
|
@@ -4134,6 +4135,31 @@ function detectFramework(files) {
|
|
|
4134
4135
|
if (frameworks.size === 0) frameworks.add("unknown");
|
|
4135
4136
|
return [...frameworks];
|
|
4136
4137
|
}
|
|
4138
|
+
function detectPlatform(files) {
|
|
4139
|
+
const platforms = /* @__PURE__ */ new Set();
|
|
4140
|
+
for (const { path, content } of files) {
|
|
4141
|
+
const p = path.toLowerCase();
|
|
4142
|
+
if (/(^|\/)lovable\.config\./.test(p) || /lovable-tagger/i.test(content) || /lovable\.dev/i.test(content)) {
|
|
4143
|
+
platforms.add("lovable");
|
|
4144
|
+
}
|
|
4145
|
+
if (/(^|\/)\.bolt\//.test(p) || /(^|\/)\.stackblitzrc$/.test(p) || /bolt\.new/i.test(content)) {
|
|
4146
|
+
platforms.add("bolt");
|
|
4147
|
+
}
|
|
4148
|
+
if (/(^|\/)\.replit$/.test(p) || /(^|\/)replit\.nix$/.test(p)) {
|
|
4149
|
+
platforms.add("replit");
|
|
4150
|
+
}
|
|
4151
|
+
if (/(^|\/)\.cursorrules$/.test(p) || /(^|\/)\.cursor\//.test(p)) {
|
|
4152
|
+
platforms.add("cursor");
|
|
4153
|
+
}
|
|
4154
|
+
if (/(^|\/)claude\.md$/.test(p) || /(^|\/)\.claude\//.test(p)) {
|
|
4155
|
+
platforms.add("claude-code");
|
|
4156
|
+
}
|
|
4157
|
+
if (/v0\.dev/i.test(content) || /generated by v0\b/i.test(content)) {
|
|
4158
|
+
platforms.add("v0");
|
|
4159
|
+
}
|
|
4160
|
+
}
|
|
4161
|
+
return [...platforms];
|
|
4162
|
+
}
|
|
4137
4163
|
function calculateGrade(findings, _totalFiles) {
|
|
4138
4164
|
if (findings.length === 0) {
|
|
4139
4165
|
return { grade: "A+", score: 100, summary: "No security issues detected. Excellent." };
|
|
@@ -8425,14 +8451,16 @@ var insecureDirectObjectReference = {
|
|
|
8425
8451
|
check(content, filePath) {
|
|
8426
8452
|
if (!filePath.match(/\.(js|ts|jsx|tsx)$/)) return [];
|
|
8427
8453
|
if (isTestFile(filePath)) return [];
|
|
8428
|
-
if (!/\/api\//i.test(filePath)) return [];
|
|
8429
|
-
if (!/export\s+(?:async\s+)?function\s+(?:GET|PUT|PATCH|DELETE)/i.test(content)) return [];
|
|
8430
|
-
if (!/params\.id|params\.(?:slug|uuid)|req\.params\./i.test(content)) return [];
|
|
8431
|
-
if (!/findUnique|findFirst|findById|\.findOne|WHERE.*=.*params|\.get\(.*params/i.test(content)) return [];
|
|
8432
|
-
if (/userId|ownerId|createdBy|user_id|owner_id|AND.*user|where.*user|authorize|canAccess|checkPermission|isOwner|belongsTo/i.test(content)) return [];
|
|
8433
8454
|
if (/admin/i.test(filePath)) return [];
|
|
8434
|
-
if (/
|
|
8435
|
-
|
|
8455
|
+
if (/userId|ownerId|createdBy|user_id|owner_id|AND.*user|where.*user|authorize|canAccess|checkPermission|isOwner|belongsTo/i.test(content)) return [];
|
|
8456
|
+
if (/requireUser|requireUserForApi|requireAuth|withAuth|getServerSession|auth\(\)|req\.user\b|passport|session\.user|isAuthenticated/i.test(content)) return [];
|
|
8457
|
+
if (!/findUnique|findFirst|findById|\.findOne|WHERE.*=.*(?:params|req\.(?:body|query))|\.get\(.*(?:params|req\.(?:body|query))/i.test(content)) return [];
|
|
8458
|
+
const isNextApiIdor = /\/api\//i.test(filePath) && /export\s+(?:async\s+)?function\s+(?:GET|PUT|PATCH|DELETE)/i.test(content) && /params\.id|params\.(?:slug|uuid)|req\.params\./i.test(content);
|
|
8459
|
+
const hasExpressHandler = /\.(get|post|put|patch|delete)\s*\(\s*["'`][^"'`]*["'`]\s*,/i.test(content);
|
|
8460
|
+
const readsObjectRef = /req\.params\b|req\.(?:body|query)\.\w*id\b/i.test(content);
|
|
8461
|
+
const isExpressIdor = hasExpressHandler && readsObjectRef;
|
|
8462
|
+
if (!isNextApiIdor && !isExpressIdor) return [];
|
|
8463
|
+
const m = content.match(/params\.id|params\.(?:slug|uuid)|req\.params\.\w+|req\.params\b|req\.(?:body|query)\.\w*id/i);
|
|
8436
8464
|
if (!m || m.index === void 0) return [];
|
|
8437
8465
|
const lineNum = lineNumberAt(content, m.index);
|
|
8438
8466
|
return [{
|
|
@@ -8443,7 +8471,7 @@ var insecureDirectObjectReference = {
|
|
|
8443
8471
|
file: filePath,
|
|
8444
8472
|
line: lineNum,
|
|
8445
8473
|
snippet: getSnippet(content, lineNum),
|
|
8446
|
-
fix: "Add an ownership check: verify the requesting user owns the record before returning it. Example: WHERE id = params.id AND userId =
|
|
8474
|
+
fix: "Add an ownership check: verify the requesting user owns the record before returning it. Example: WHERE id = req.params.id AND userId = req.user.id"
|
|
8447
8475
|
}];
|
|
8448
8476
|
}
|
|
8449
8477
|
};
|
|
@@ -9119,6 +9147,7 @@ function scanEntropy(files) {
|
|
|
9119
9147
|
dangerousInnerHTML,
|
|
9120
9148
|
deprecatedTLS,
|
|
9121
9149
|
detectFramework,
|
|
9150
|
+
detectPlatform,
|
|
9122
9151
|
disabledTLSVerification,
|
|
9123
9152
|
djangoDebug,
|
|
9124
9153
|
dockerCopySensitive,
|