Skip to content

[Bug] dsh-memory-plugin uri-guard blocks write/edit when file content mentions a viking URI #4188

Description

@MiracleOfRevolutionary

Summary

@openviking/dsh-memory-plugin (0.2.1) registers a tools/pre-execute guard that blocks DeepSeek Harness filesystem/shell tools from receiving viking URIs. The guard scans the entire tool-arguments object, so a local write/edit whose content merely mentions a viking URI (e.g. documentation text like "viking://user/default/") is denied with:

viking:// URIs are OpenViking virtual paths, not local filesystem paths. Use mcp__openviking__write instead.

Repro

  1. Install the plugin into a DSH web profile.
  2. Call the local write tool with file_path = any normal local path and content containing the substring "viking://..." (e.g. "viking://user/default/").
  3. The write is denied; no file is created.

Control: same call without "viking://" in the content succeeds.

Root cause

shared/uri-guard.mjs -> findVikingUri(args):

  • checks path-like keys (filePath, file_path, path, uri, target_uri, pattern) - good;
  • then falls back to findVikingUriInValue(args), which recursively scans every argument value, including content (write), new_string (edit), command (bash), pattern (grep).

The regex then matches the URI inside the file content, and the guard denies the call.

Suggested fix

Scan only path-like keys and drop the whole-args fallback (or gate the fallback behind a config flag). The intent - blocking a viking URI as a path argument - is fully preserved by the keys loop.

Environment

  • dsh 0.1.0-rc.7 (profile: web), plugin 0.2.1
  • Windows 11

Activity

  1. moved this from Backlog to In progress in OpenViking projecton Aug 23, 2026
  2. Miasakiii commented on Aug 24, 2026

    @Miasakiii

    Independent confirmation with fresh real-world numbers — still hitting this on @openviking/dsh-memory-plugin 0.2.1 with dsh 0.1.1-rc.1 (profile: web, Windows 11).

    The repro scope is wider than write/edit. The whole-args fallback also blocks:

    • grep with pattern containing the literal — I only had to search for viking:// in your own plugin source in order to read the guard code, and the search itself was denied. Searching for a string that you need to read cannot be a path misuse.
    • bash invocations whose command string contains it.
    • edit where new_string merely mentions it.

    Real impact in our session: while writing local audit docs (markdown result files under a fleet repo) that cite memory paths like viking://user/default/peers/..., three separate local write/edit calls on normal Windows paths were denied purely because the content mentions the URI — the file was never created. Every doc/README/code comment that needs to reference a memory path hits this wall. (This very comment was drafted as a local file and the draft write was denied too; we had to route it around the guard.)

    Small refinement of the suggested fix: instead of "argument contains URI", test "the path-meaning of the argument resolves to a viking:// prefix":

    • keep the path-like key scan (filePath, file_path, path, uri, target_uri) as-is;
    • drop the whole-args recursive fallback;
    • for pattern (grep regex/glob) and shell command, deny only when the value starts with viking:// (or a quoted path prefix), not when the substring appears in body text.

    A simple opt-out flag (uriGuard: false config / OPENVIKING_URI_GUARD=0 env) would also let teams keep strict-by-default without blocking legitimate documentation.

    Both the original issue and this confirm the guard's intent — blocking viking URIs as local paths — is sound; it is purely the matching granularity that needs to move from "appears anywhere in the arguments" to "is the target path". Happy to test a patch if one lands.

  3. moved this from In progress to Done in OpenViking projecton Aug 26, 2026
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

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions