Skip to content

rvt-mcp: answers and server memory have no byte cap, and file text reaches the client unmarked #1883

Closed

Description

@DrunkOnJava

Batch 5's audit of rvt-mcp (main at e57db42), three slices, each finding confirmed by a second reader. The common thread: answers and server memory are sized by the file or the client with no byte cap, and file text reaches the client's model with nothing marking it as file content.

Answer size and memory

  1. list_rooms (views.rs:731, handler server.rs:380) has no page or limit: every space, twice (structured content plus the same JSON as a text block). list_elements is capped at 1,000 rows (server.rs:287); this one is not. (medium)
  2. list_elements rows carry file strings with no length cap (views.rs:148), so 1,000 rows can be arbitrarily large.
  3. The whole diagnostics document is returned inline (views.rs:295, exports.rs:121-125).
  4. max_open_models truncates the retained list (store.rs:521) but concurrent calls each decode a model before that (store.rs:327), so N concurrent opens decode N models.
  5. export_gltf builds the whole GLB in memory plus copies of its binary chunk (exports.rs:219-221), where export_ifc streams.
  6. The phase string a client sends, and file-derived phase lists on the error path, are retained up to 64 copies with no byte cap (store.rs:468-469).
  7. Progress events queue without a cap when the client reads slowly; the 250 ms throttle applies to sending, not queueing (server.rs:106).

Arguments

  1. limit is bounded only in prose: the schema is Option<u32> (args.rs:53-54), over 1,000 is silently clamped and 0 returns one row (server.rs:287). Fix: state minimum/maximum in the schema and treat 0 as 0 or an error.
  2. A file whose modification time cannot be read becomes 0 in the model's identity (store.rs:97-101), which weakens the "file changed since opened" check.

File text as content

  1. Element names, parameter values and messages quoting them reach the client verbatim (views.rs:42, :148, :378, :706; exports.rs:64-66). JSON escaping keeps them inside strings, but a crafted model can still place text shaped as instructions where the client's model reads an answer. Fix direction: a per-field length cap, and a note in the tool descriptions that names, values and messages are file content.

Defaults to decide (documented behaviour, not bugs)

  1. Reads are not confined (store.rs:476), and writes are confined only when --output-dir is given (output.rs:85, :117). Both are stated in docs/mcp.md:11-13. Whether the server should default to the folder it was started in is a product call; it is recorded here, not changed.

No export moves. Contract tests in tests/ cover the tool shapes; a schema change to limit updates docs/schemas/ and the rendered tool list (tools/ci/render-mcp-tools.py).

Activity

  1. added
    area:product
    priority:P2
    type:security
    on Nov 13, 2026
  2. DrunkOnJava commented on Nov 13, 2026

    @DrunkOnJava
    OwnerAuthor

    Decision on item 11 (the server's default reach), from the maintainer, 2026-11-13: confine reads and writes to one folder by default.

    rvt-mcp opens and writes files only inside one root folder: the folder it is started in, unless the setup names another. A flag widens it for anyone who needs that. Today it reads anything the account can read and writes anywhere without --output-dir (docs/mcp.md:11-13). Item 10 is why the default matters: a crafted model's text reaches the client's model unmarked and could steer it into opening or overwriting files outside the project.

    What a fix needs:

    • one root for both reads (store.rs:476) and writes (output.rs:85, :117), compared after canonicalising so .. and symlinks cannot leave it;
    • the flag that widens it, stated in docs/mcp.md and the tool descriptions;
    • an upgrade note, since a setup that opens files outside its start folder must now pass the flag.
  3. DrunkOnJava commented on Nov 13, 2026

    @DrunkOnJava
    OwnerAuthor

    Refinement of the folder decision above, so the default protects something whatever the client does. An MCP client chooses the server's working directory, and some start their servers from / (Claude Desktop on macOS has been reported to). "The folder it is started in" would then be the whole disk.

    • The root comes from the setup: a --root <folder> argument, or an environment variable for clients that pass only those. The decision's words were "the folder you pick, ... when you set it up".
    • With no root given, the server falls back to its working directory only when that is not a filesystem root (/, a drive root such as C:\), not the user's home folder, and not a parent of the home folder. Otherwise it starts, but every tool that touches a file refuses with a message naming --root, so the client shows the user what to set.
    • The flag that widens the reach stays explicit (for example --root /), so reaching the whole disk is always something someone typed.
  4. DrunkOnJava commented on Nov 13, 2026

    @DrunkOnJava
    OwnerAuthor

    All eleven items are on main: items 1 to 10 as #1897 (cdd5f5d: field and answer bounds, the gate for concurrent opens, the streamed GLB, the capped progress queue, paged list_rooms, the limit range, the modification time, file text marked as data in the tool descriptions), and item 11, the product call, as #1900 following Griffin's decision on this issue: the server reads from and writes to one root folder that its setup picks (--root, RVT_MCP_ROOT, or the folder it was started in unless that is /, the home folder or a folder above it), --unconfined lifts the limit, and docs/mcp.md has the upgrade note.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:productpriority:P2type:security

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions