Skip to content

plugins: a project's plugin is used only once approved, as its files are - #33

Merged
blockmandev merged 1 commit into
mainfrom
feat/plugin-approval
Oct 22, 2026
Merged

blockmandev merged 1 commit into
mainfrom
feat/plugin-approval

Conversation

@blockmandev

Copy link
Copy Markdown
Member

Approved by the owner. A plugin in <workspace>/.incode/plugins/ arrives with whatever was cloned, and its hooks, MCP servers, skills and commands were used with no approval: a repository could run a command on the first tool call.

  • Approval = name + a fingerprint of the folder (every path and its bytes, .git left out). Any change leaves it out again until re-approved, the same rule as a project's .mcp.json servers. A plugin with a symbolic link cannot be approved (its target could change unseen). A broken store is reported and trusts nothing.
  • One gate (plugins::discover_usable) for hooks, servers, skills and custom commands; plugins left out are said once (REPL, --acp, -t), with how to approve.
  • incode plugin approve <name>; incode plugin list shows the state. Your own ~/.incode/plugins/ need no approval.

Tests go through the real gate with the data folder pointed at a temp dir; controls (gate passing everything, links fingerprinted) fail them.

Local (Windows): fmt clean; clippy only the existing with_tool_server warning; bin 59 passed; lib 2197 passed, 1 failed: the desktop UIA live test that walks whatever window has focus here (passes in CI).

Follow-up: an interactive "approve now?" question in the REPL.

A plugin in <workspace>/.incode/plugins/ arrives with whatever was cloned,
and its hooks ran commands, its servers started programs and its skills
and commands were told to the agent, with no approval: a repository could
run a command on the first tool call.

Now none of a project's plugin is used until the operator approves it:

- src/plugin_approvals.rs: a fingerprint of the plugin folder (every
  entry's path and bytes, sorted and length-framed; .git left out) and
  the store <data dir>/plugin-approvals.json. An approval is the
  plugin's name and that fingerprint, so any change to the plugin leaves
  it out again until approved again, the rule a project's .mcp.json
  servers follow. A symbolic link anywhere in the plugin makes it
  unapprovable: its target could change without the plugin changing.
  A store that cannot be read is said, never read as approved.
- plugins::discover_usable is the one gate. session_hooks,
  session_servers, session_skills and custom_commands::Registry::load
  all take their plugins through it; the plugins left out are said once,
  with Registry::load's warnings (REPL, --acp and -t), with how to
  approve each.
- `incode plugin approve <name>` approves a project's plugin as it is
  now; `incode plugin list` shows each one's state; the completion table
  offers `approve`. The operator's own plugins (~/.incode/plugins/) need
  no approval.

plugins::discover_here lost its last caller to the gate and is removed.

Tests: through discover_usable with the data dir pointed at a temp
folder, a project plugin is left out and said, used once approved, and
left out again when its hooks change, while the operator's is used as
is; the fingerprint follows content and ignores .git; a plugin holding
a symlink cannot be approved; a broken store is reported and trusts
nothing. Controls: with the gate passing every plugin, or with links
fingerprinted, the tests fail.

Follow-up: an interactive "approve now?" question in the REPL, as
.mcp.json servers have.
@blockmandev
blockmandev merged commit dc96e76 into main Oct 22, 2026
7 checks passed
@blockmandev
blockmandev deleted the feat/plugin-approval branch November 15, 2026 20:29
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.

1 participant