@homenshum/convex-mcp-nodebench 0.9.6 → 0.9.7
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.js
CHANGED
|
@@ -41,6 +41,27 @@ function auditAuthorization(convexDir) {
|
|
|
41
41
|
const content = readFileSync(filePath, "utf-8");
|
|
42
42
|
const relativePath = filePath.replace(convexDir, "").replace(/^[\\/]/, "");
|
|
43
43
|
const lines = content.split("\n");
|
|
44
|
+
// Pre-scan: detect local helper functions that wrap getAuthUserId/getUserIdentity
|
|
45
|
+
// Pattern: function getSafeUserId(ctx) { ... getAuthUserId(ctx) ... }
|
|
46
|
+
const authHelperNames = [];
|
|
47
|
+
const helperFuncPattern = /(?:async\s+)?function\s+(\w+)\s*\(/g;
|
|
48
|
+
let hm;
|
|
49
|
+
while ((hm = helperFuncPattern.exec(content)) !== null) {
|
|
50
|
+
const hStart = content.slice(0, hm.index).split("\n").length - 1;
|
|
51
|
+
const hBody = lines.slice(hStart, Math.min(hStart + 30, lines.length)).join("\n");
|
|
52
|
+
if (/getAuthUserId|getUserIdentity|getAuthSessionId/.test(hBody)) {
|
|
53
|
+
authHelperNames.push(hm[1]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
// Also check arrow function helpers: const getUserId = async (ctx) => { ... }
|
|
57
|
+
const arrowHelperPattern = /(?:const|let)\s+(\w+)\s*=\s*(?:async\s*)?\([^)]*\)\s*(?::\s*[^=]+)?\s*=>/g;
|
|
58
|
+
while ((hm = arrowHelperPattern.exec(content)) !== null) {
|
|
59
|
+
const hStart = content.slice(0, hm.index).split("\n").length - 1;
|
|
60
|
+
const hBody = lines.slice(hStart, Math.min(hStart + 20, lines.length)).join("\n");
|
|
61
|
+
if (/getAuthUserId|getUserIdentity|getAuthSessionId/.test(hBody)) {
|
|
62
|
+
authHelperNames.push(hm[1]);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
44
65
|
for (let i = 0; i < lines.length; i++) {
|
|
45
66
|
const line = lines[i];
|
|
46
67
|
for (const ft of funcTypes) {
|
|
@@ -69,10 +90,14 @@ function auditAuthorization(convexDir) {
|
|
|
69
90
|
}
|
|
70
91
|
}
|
|
71
92
|
const body = lines.slice(i, endLine).join("\n");
|
|
72
|
-
|
|
93
|
+
// Check for direct auth calls OR calls to local auth helper wrappers
|
|
94
|
+
const hasDirectAuth = /ctx\.auth\.getUserIdentity\s*\(\s*\)/.test(body) ||
|
|
73
95
|
/getUserIdentity/.test(body) ||
|
|
74
96
|
/getAuthUserId/.test(body) ||
|
|
75
97
|
/getAuthSessionId/.test(body);
|
|
98
|
+
const callsAuthHelper = authHelperNames.length > 0 &&
|
|
99
|
+
authHelperNames.some(h => new RegExp(`\\b${h}\\s*\\(`).test(body));
|
|
100
|
+
const hasAuthCheck = hasDirectAuth || callsAuthHelper;
|
|
76
101
|
const hasDbWrite = dbWriteOps.test(body);
|
|
77
102
|
const isSensitiveName = writeSensitive.test(funcName);
|
|
78
103
|
if (hasAuthCheck) {
|
|
@@ -75,7 +75,7 @@ function buildSarif(projectDir, auditTypes, limit) {
|
|
|
75
75
|
tool: {
|
|
76
76
|
driver: {
|
|
77
77
|
name: "convex-mcp-nodebench",
|
|
78
|
-
version: "0.9.
|
|
78
|
+
version: "0.9.7",
|
|
79
79
|
informationUri: "https://www.npmjs.com/package/@homenshum/convex-mcp-nodebench",
|
|
80
80
|
rules: [...rulesMap.values()],
|
|
81
81
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@homenshum/convex-mcp-nodebench",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"description": "Convex-specific MCP server applying NodeBench self-instruct diligence patterns to Convex development. Schema audit, function compliance, deployment gates, persistent gotcha DB, and methodology guidance. Complements Context7 (raw docs) and official Convex MCP (deployment introspection) with structured verification workflows.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|