Skip to content

Fix audited dependencies, keep cookie requests on the Overleaf origin, safer live tests - #11

Merged
lonetis merged 1 commit into
lonetis:mainfrom
JohannKaspar:wt/security-hardening
Nov 9, 2026
Merged

lonetis merged 1 commit into
lonetis:mainfrom
JohannKaspar:wt/security-hardening

Conversation

@JohannKaspar

Copy link
Copy Markdown
Contributor

What

1. Vulnerable dependencies. npm audit reported 9 vulnerabilities in production dependencies (1 critical, 5 high), all through @modelcontextprotocol/sdk 1.29 (its HTTP/OAuth parts and their express/hono stack) plus zod, and 7 more in the dev toolchain (vitest 2 / vite / esbuild). Claudeleaf only uses the stdio transport, so the exposure is small, but anyone installing it gets the alerts.

  • @modelcontextprotocol/sdk ^1.12.0 → ^1.32.2. The floor matters: npx claudeleaf installs from package.json, not from the lockfile.
  • zod ^3.23 → ^4 (the SDK accepts ^3.25 || ^4.0; no code changes needed).
  • vitest ^2.1 → ^5.1 (dev only).
  • npm audit now reports 0.

2. Cookie-carrying requests stay on the Overleaf origin. RestClient.request and fetchText built URLs as baseUrl + path. fetchText takes its path from a server response (the compile output URL), and plain concatenation turns a path like @evil.example/x into https://www.overleaf.com@evil.example/x, whose host is evil.example – with the session cookie attached. Only a misbehaving server could trigger it, but the fix is cheap: sameOriginUrl resolves the path against the base (self-hosted base paths kept) and refuses anything off its origin. Unit tests in test/rest.test.ts.

3. Live tests never pick an arbitrary project. When OVERLEAF_TEST_PROJECT was unset (and the dev project not accessible), the integration and MCP e2e suites fell back to the first writable project of whoever was signed in, then created and deleted documents there and briefly overwrote its main.tex for the compile test. That can hit someone's real paper. They now run only against OVERLEAF_TEST_PROJECT (id or exact name) or the dev project, and otherwise skip with a warning (test/liveProject.ts).

Tested

npm run typecheck, npm run build, npm test with a live session against a throwaway project: everything passes except the compile-error test when it runs right after the compile test – Overleaf answers the second compile with too-recently-compiled and no output. That happens on main too; run alone it passes. Without OVERLEAF_TEST_PROJECT the live suites skip.

Note: this and the tracked-changes PR both touch test/integration.test.ts; whichever lands second needs a small rebase, which I'm happy to do.

…and never run live tests on an arbitrary project

- Bump @modelcontextprotocol/sdk to ^1.32.2 (the floor matters for npx users, who do
  not get the lockfile), zod to ^4 (the SDK accepts ^3.25 || ^4), vitest to ^5;
  npm audit reports 0 vulnerabilities (was 9 in production deps, 7 more in dev deps).
- REST requests and fetchText resolve paths with sameOriginUrl and refuse anything
  off the configured origin. They carry the session cookie, and fetchText takes a
  path from a server response, where plain concatenation would turn
  '@evil.example/x' into a request to evil.example.
- The live suites only run against OVERLEAF_TEST_PROJECT (id or name) or the dev
  project. They used to fall back to the first writable project of whoever is
  signed in and would then overwrite its main.tex for a moment.
@lonetis
lonetis merged commit 7ed7c2e into lonetis:main Nov 9, 2026
lonetis pushed a commit that referenced this pull request Nov 9, 2026
Releases what landed since 0.3.0:

- tracked changes: list a document's pending suggestions (SDK
  listTrackedChanges, CLI `changes`, MCP overleaf_list_tracked_changes),
  and refuse by default any edit that would touch one
  (TrackedChangeConflictError; override with overwriteTrackedChanges /
  --overwrite-tracked-changes) (#10)
- security: cookie-carrying REST requests stay on the Overleaf origin;
  @modelcontextprotocol/sdk ^1.32.2 and zod ^4, npm audit clean (#11)

A minor bump rather than 0.3.1: the default edit behaviour changes, and
0.3.1 was published and then unpublished on npm, so that number can
never be reused.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016k8nQbcXiTztFcEngHqwxs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants