[GH-ISSUE #5899] Five capability permissions are declared in package manifests and enforced nowhere #3256

Closed
opened 2026-10-21 06:01:21 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @kolacheee on GitHub (Sep 6, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5899

Originally assigned to: @SpicyMarinara on GitHub.

A capability package manifest can declare nine permissions. Four of them are actually checked before
the matching capability is handed out; the other five — chat-read, chat-write, network,
storage and ui — are never checked anywhere in the server. They are strings a package writes into
its manifest and a user reads on the install screen, and nothing behind them changes based on what
they say. In particular, any package with a server entrypoint already receives the full persistence
host — read and write, across every chat, not scoped to its own — whether or not its manifest asked
for anything.

Where it is. The permission enum is
packages/shared/src/schemas/capability-package.schema.ts:9-20. A repo-wide search for permission
gates returns five call sites covering four permissions: agent-runtime
(packages/server/src/services/capability-packages/capability-agent-runtime.service.ts:15),
conversation-actions and prompt-context
(packages/server/src/services/capability-packages/capability-module-runtime.service.ts:220 and
:234), and routes
(packages/server/src/services/capability-packages/capability-route-registration.service.ts:71,
packages/server/src/services/capability-packages/package-manager.service.ts:447). Nothing checks the
other five. The persistence host is attached unconditionally in the same activation context that does
the other gating — capability-module-runtime.service.ts:98, persistence: createCapabilityPersistenceHost(app.db) — and that host includes whole-chat metadata writers
(packages/server/src/services/capability-packages/capability-persistence.service.ts:507-545). The
permission list is shown to the user in the catalog detail pane before install
(packages/client/src/components/agents/AgentCatalogView.tsx:731-742) and nowhere after it. Packages
do declare these strings in good faith — the Pixelforge build script declares chat-read,
chat-write, ui with a comment saying the point is to disclose access to users
(scripts/build-pixelforge-package.mjs:126-130 in the Pixelforge package repo).

Why it matters. The install screen makes a promise the engine does not keep. A user reading a package's
permissions is being told what it can reach, and for five of the nine that list is decoration — a
package that declares nothing can still write every chat's metadata. It also means the disclosure runs
backwards: the honest packages that list chat-write look more dangerous than a package that lists
nothing and has identical access.

The smallest honest fix is probably not "enforce all five at once" — ui and network in particular
would need a definition of what enforcement even means for a client bundle — but to close the gap
between what the list claims and what the list does, one permission at a time, starting with the ones
that gate a real server-side capability. chat-read and chat-write are the two with an obvious
enforcement point: the persistence host could be built per-package from the manifest rather than handed
out whole. Two things are worth deciding alongside that. First, every gate that exists today guards a
server entrypoint registration, so a gate on a package with no server code at all would be a new kind
of check, not the existing kind applied once more. Second, permissions are displayed pre-install only,
so any change that widens what an already-granted permission means reaches existing users with no
re-consent — the write-back channel in #5798 will be the first thing to actually enforce chat-write,
and it widens the meaning from "this package's own code writes chat data" to "the engine will execute
writes on this package's behalf, from model output". That widening is worth an answer here rather than
inside that PR.

Originally created by @kolacheee on GitHub (Sep 6, 2026). Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/5899 Originally assigned to: @SpicyMarinara on GitHub. A capability package manifest can declare nine permissions. Four of them are actually checked before the matching capability is handed out; the other five — `chat-read`, `chat-write`, `network`, `storage` and `ui` — are never checked anywhere in the server. They are strings a package writes into its manifest and a user reads on the install screen, and nothing behind them changes based on what they say. In particular, any package with a server entrypoint already receives the full persistence host — read and write, across every chat, not scoped to its own — whether or not its manifest asked for anything. Where it is. The permission enum is `packages/shared/src/schemas/capability-package.schema.ts:9-20`. A repo-wide search for permission gates returns five call sites covering four permissions: `agent-runtime` (`packages/server/src/services/capability-packages/capability-agent-runtime.service.ts:15`), `conversation-actions` and `prompt-context` (`packages/server/src/services/capability-packages/capability-module-runtime.service.ts:220` and `:234`), and `routes` (`packages/server/src/services/capability-packages/capability-route-registration.service.ts:71`, `packages/server/src/services/capability-packages/package-manager.service.ts:447`). Nothing checks the other five. The persistence host is attached unconditionally in the same activation context that does the other gating — `capability-module-runtime.service.ts:98`, `persistence: createCapabilityPersistenceHost(app.db)` — and that host includes whole-chat metadata writers (`packages/server/src/services/capability-packages/capability-persistence.service.ts:507-545`). The permission list is shown to the user in the catalog detail pane before install (`packages/client/src/components/agents/AgentCatalogView.tsx:731-742`) and nowhere after it. Packages do declare these strings in good faith — the Pixelforge build script declares `chat-read`, `chat-write`, `ui` with a comment saying the point is to disclose access to users (`scripts/build-pixelforge-package.mjs:126-130` in the Pixelforge package repo). Why it matters. The install screen makes a promise the engine does not keep. A user reading a package's permissions is being told what it can reach, and for five of the nine that list is decoration — a package that declares nothing can still write every chat's metadata. It also means the disclosure runs backwards: the honest packages that list `chat-write` look more dangerous than a package that lists nothing and has identical access. The smallest honest fix is probably not "enforce all five at once" — `ui` and `network` in particular would need a definition of what enforcement even means for a client bundle — but to close the gap between what the list claims and what the list does, one permission at a time, starting with the ones that gate a real server-side capability. `chat-read` and `chat-write` are the two with an obvious enforcement point: the persistence host could be built per-package from the manifest rather than handed out whole. Two things are worth deciding alongside that. First, every gate that exists today guards a *server entrypoint registration*, so a gate on a package with no server code at all would be a new kind of check, not the existing kind applied once more. Second, permissions are displayed pre-install only, so any change that widens what an already-granted permission means reaches existing users with no re-consent — the write-back channel in #5798 will be the first thing to actually enforce `chat-write`, and it widens the meaning from "this package's own code writes chat data" to "the engine will execute writes on this package's behalf, from model output". That widening is worth an answer here rather than inside that PR.
bsakaguchi 2026-10-21 06:01:21 +07:00
  • closed this issue
  • added the
    in-pr
    label
Author
Owner

@SpicyMarinara commented on GitHub (Sep 9, 2026):

@SpicyMarinara owns this fix in draft #5985. I am gating chat persistence reads/writes and spatial snapshots by the package manifest, preserving the checks inside transactions. The existing trusted-code disclosure will remain explicit: these are Engine API gates, not a sandbox for downloaded JavaScript.

<!-- gh-comment-id:5594375331 --> @SpicyMarinara commented on GitHub (Sep 9, 2026): @SpicyMarinara owns this fix in draft #5985. I am gating chat persistence reads/writes and spatial snapshots by the package manifest, preserving the checks inside transactions. The existing trusted-code disclosure will remain explicit: these are Engine API gates, not a sandbox for downloaded JavaScript.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#3256
No description provided.