aaronsb_obsidian-mcp-plugin/package.json
Aaron Bockelie b9d99edfd7 feat(bases): replace new Function with expression-eval (ADR-201)
PR2 of 2 for #180 (ADR-201). Closes the arbitrary-code-execution vector
reachable through a synced/shared `.base` file.

- Drop `new Function('context', 'with(context){return ${expr}}')` (and its
  no-implied-eval eslint-disable) from expression-evaluator.ts.
- Parse with expression-eval@5.0.1 (jsep grammar: no eval/Function/new, no
  global scope; member denylist built in). Pinned exact; jsep 0.3.5 is its
  audited transitive parser. Both >7d old; npm audit 0 vulns.
- Defense-in-depth AST pre-walk (assertNoForbiddenAccess): rejects
  constructor/__proto__/prototype member access (Identifier AND computed
  ["constructor"] forms) and ThisExpression, independent of the library's
  internal list — ADR-201's explicit, tested no-globals property lives in
  our code, not a transitive dep.
- createEvalContext and all helpers untouched → behavioural parity.

Differential corpus (tests/bases-expression-evaluator.test.ts, from PR1):
57 EVAL_CASES still green = expression-eval == old new Function for every
realistic Bases construct; the formerly-executing escapes (2/42/99 under
new Function) now fail closed; SECURITY set never reaches a function, the
real global, or a value.

No behavioural change for legitimate `.base` expressions. Breaking only by
design: the RCE vectors, `this`, and prototype-chain access are now
refused. Clears the Obsidian "Dynamic Code Execution" finding.

209/209 tests; build + lint clean. Refs #180, ADR-201
2026-05-16 22:57:43 -05:00

62 lines
1.7 KiB
JSON

{
"name": "obsidian-mcp-plugin",
"version": "0.11.25",
"description": "Give Claude Desktop and other AI assistants semantic access to your notes through a built-in Model Context Protocol (MCP) server.",
"main": "main.js",
"scripts": {
"dev": "node esbuild.config.mjs",
"build": "node sync-version.mjs && tsc -noEmit -skipLibCheck && node build-worker.js && node esbuild.config.mjs production",
"build:worker": "node build-worker.js",
"sync-version": "node sync-version.mjs",
"version": "node sync-version.mjs && git add manifest.json",
"test": "node --no-warnings node_modules/.bin/jest",
"lint": "eslint .",
"lint:fix": "eslint . --fix"
},
"keywords": [
"obsidian",
"plugin",
"mcp",
"rest-api",
"ai",
"semantic"
],
"author": "Aaron Bockelie",
"license": "MIT",
"overrides": {
"yaml": "$yaml"
},
"devDependencies": {
"@eslint/js": "^9.39.2",
"@types/jest": "^30.0.0",
"@types/minimatch": "^5.1.2",
"@types/node": "^25.3.0",
"@typescript-eslint/utils": "^8.56.0",
"esbuild": "^0.27.3",
"eslint": "^9.39.2",
"eslint-plugin-obsidianmd": "^0.3.0",
"globals": "^17.3.0",
"jest": "^30.2.0",
"jiti": "^2.6.1",
"obsidian": "^1.12.2",
"ts-jest": "^29.1.1",
"tslib": "^2.8.1",
"typescript": "^5.9.3",
"typescript-eslint": "^8.56.0"
},
"dependencies": {
"@modelcontextprotocol/sdk": "^1.29.0",
"@types/cors": "^2.8.19",
"@types/express": "^5.0.6",
"@types/node-forge": "^1.3.14",
"@types/turndown": "^5.0.5",
"cors": "^2.8.6",
"express": "^5.2.1",
"expression-eval": "5.0.1",
"minimatch": "^10.2.5",
"node-forge": "^1.4.0",
"turndown": "^7.2.4",
"yaml": "2.8.4",
"zod": "^4.4.3"
}
}