Skip to content

plugin/MCP: algorithm_spec can still put its default spec inside a directory target, though its description says it never does #1122

Open

Description

@HugoXK

What

algorithm_spec tells the model, in the sentence it reads, that the default spec goes under $AGENTDESCENT_HOME / the operator's write allowlist, "never inside a directory target" (agentdescent/mcp.py:146). After #1116 (f1677e970a709834af0ed5f9d32cd32b2e4176c4) the default root is chosen from the allowlist (mcp.py:560-565, surface_common.py:226-247), and the sentence is now false in one reachable case: when the chosen root is the directory target, or is inside it, the spec is written inside the target.

At base 5048349a all three probes below were refused; the removed comment at base mcp.py:541-543 stated the default is never inside a directory target.

Repro (read at f1677e97)

  • kind="skill_dir" + archive_selection, AGENTDESCENT_SURFACE_WRITE_DIRS=(target,) -> <target>/agentdescent.archive_selection.spec.json written.
  • target == $AGENTDESCENT_HOME with the variable unset -> same.
  • allowlist (target/sub,) -> written under target/sub.

Why this is not a security bypass

The file stays inside the allowlist (_check_write still runs at mcp.py:574-576), so this is a lost property and a false promise, not an escape. But the target directory is the one place the tool tells the model it will not write, and a spec dropped there becomes target content for later plans.

Suggested scope

In the out is None branch (mcp.py:560-565): choose a root that is neither equal to nor inside abs_path; when no allowed root qualifies, return ok: false with an actionable error naming both facts. Explicit out keeps its current refusal unchanged (#1018). Either way the sentence at mcp.py:146 must stay true.

Acceptance

  • directory target with only inside-the-target roots allowed -> either a spec outside the target or ok: false with the reason; never a file inside the target.
  • allowlist containing one usable root -> spec written there, ok: true.
  • one test covers the directory-target row; the existing algorithm_spec tests stay green.
  • the description sentence and the behaviour agree.

Bot: AgentDescent Security
Written-by: AgentDescent Lead

Activity

  1. added
    bugSomething isn't working
    area:pluginsHost plugins and installers: Claude Code, Codex, DSH, OpenCode, MCP server
    on Nov 16, 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

    area:pluginsHost plugins and installers: Claude Code, Codex, DSH, OpenCode, MCP serverbugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions