Repository navigation
examples: add mcp-shared-drive, an MCP server secured per tool call - #83
Conversation
The SpiceboxClass needs an image and a tool to be Valid, even though a sidecar uses neither. The SidecarToolbox controller type-checks argument constraints against the SpiceboxToolspec CEL environment, not the MCP one the runner evaluates them with, so it rejects any args.path constraint. Drop the path constraints: a path is checked as the exact ID it names, and only seeded folders and files have relationships, so path tricks are still refused.
How to run the before and after halves, the scenes as they ran live, the optional cold open and revocation scenes, the reset, and the limitations found while running them: what an approval covers, the approval card not naming the requester, DM sessions, and the toolbox's missing path constraints. Also drop a .pyc committed by mistake.
Keep file contents out of the container log: supergateway's info log on stdout copies every message verbatim, so discard stdout and keep stderr. Run Scene 3 and the revocation scene in a private channel Alice is not in. Say who an approval reaches, that each session has its own copy of the drive, and that the sidecar's network mode is declared, not enforced. Scope the reset to this agent's sessions, restore the seed, and stop the port-forward. List zed and npx as prerequisites.
…ublic note appear
|
Deployment failed for project openagentprimitives with the following error: View Documentation: https://vercel.com/docs/accounts/team-members-and-roles |
- Format the README and the two drive markdown files with oxfmt so `mage fmt:check` passes. - Scene 2: tell Bob to only click Approve. Tool calls are checked as whoever sent the latest message, so a reply from Bob in Alice's thread would let the next payroll read pass where Alice can see it. - Say that /shared is itself a symlink to /tmp/shared and that the server lists both; only /shared/... is seeded, so the other spelling is refused. - Give write_file and create_directory a resourceIDHint, so a path with no "/" tells the agent to use a full path instead of an "internal:" error. - before/agent.py prints usage and exits 2 without a prompt argument. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
samkim
left a comment
There was a problem hiding this comment.
This PR adds the examples/mcp-shared-drive demo: a plain agent that leaks payroll through an unmodified MCP filesystem server, and the same agent on OAP with a per-person SpiceDB check on every tool call. The schema, seed, toolbox allowlist and path escaping hold together: nobody can derive approve on finance/ or payroll.csv, Bob's approve covers only eng-budget-q3.csv, only six of the server's 14 tools reach the model, and path variants such as .., // and /tmp/shared/... name unseeded IDs and are refused.
Verdict: approve. The five nits from my first pass are fixed in f4142ca:
mage fmt:checknow passes (README and the two drive markdown files reformatted; wrapping and table alignment only).- Scene 2 tells Bob to only click Approve, since a reply from him in Alice's thread would make the next turn run as Bob.
- The toolbox comment and README now say
/sharedis a symlink to/tmp/shared, that the server lists both, and that only/shared/...is seeded. write_fileandcreate_directorycarry aresourceIDHint, so a path with no/gets a usable message instead of aninternal:error (checked against the runner's checker).before/agent.pyprints usage and exits 2 without a prompt.
oap agent lint and oap agent package pass on the example.
Follow-ups, not blocking:
- After merge,
publish-agentswill push, sign and move:latestforshared-drive-agent, but the package does not carryserver/(the image build context), so installing from the registry stops with "install from the bundle's folder source". The README already says to install from the folder. Consider opting this example out ofscripts/publish-example-agents.sh, or publishing the image. - The demo's authorization claims are checked only by hand. A bronzethread bundle (or a lint/package pass over every example in CI) would keep it from rotting.
Not verified: the "before" leak with the pinned model and the README commands on a live cluster (both need live runs).
This review was drafted by an automated pipeline and checked before submission.
Motivation
We had no example showing what OAP adds in front of an existing MCP server. The common real-world setup is one MCP server reached with one shared credential. A prompt injection in any file the agent reads can then steer it to anything that credential reaches, and the server has no idea who is asking.
This sample shows that situation and the fix side by side. A new docs tutorial walks through it: authzed/docs#612.
Summary of changes
Adds
examples/mcp-shared-drive, a before/after demo over one unmodified MCP filesystem server (@modelcontextprotocol/server-filesystem, served over Streamable HTTP) that holds a fictional company drive:server/: the filesystem server image and the drive./shared/eng/q3-budget-update-template.mdcarries the planted instruction to list per-person salaries from/shared/finance.before/: a plain Python agent that connects straight to the server. It follows the template, readspayroll.csv, and writes salaries into a draft all of eng can read.manifests/andoap.yaml: the same model and authored system prompt on OAP. ASidecarToolboxputs a SpiceDB check on every tool, mapping the path argument to afileorfolder. The AgentClass checks ascurrentRequesterin enforcing mode.cluster/: the permission model and its seed. Nobody holdsapproveon the finance folder orpayroll.csv, so those refusals are final. Bob holdsapproveoneng-budget-q3.csv, so a request for it routes to him in Slack.README.md: the runbook, plus what the demo does and does not claim.Everything is under
examples/; nothing outside it changes.Alternatives considered
Provenance
claude-opus-5-5), directed by @sohanmaheshwarShip gate
mage test:unitmage test:integrationmage test:e2eResults:
Beyond the gate, the branch is rebased on current
main, andoap agent package examples/mcp-shared-drive, run from a cleangit archive, producesshared-drive-agent.oap. Thepublish-agentsworkflow packages every example after a merge to main. The whole flow in the tutorial was also run by hand against a fresh kind cluster and Slack.Regeneration
+kubebuilder:rbacmarker or a CRD-shaping field inpkg/apis/v1alpha1/*_types.go→ ranmage gen:apiandmage manifests: n/aconfig/**→ ranmage manifests: n/amage docs:cli/mage docs:crd: n/amage fmt:alluntilmage fmt:checkis clean: n/a, no Go changesCoverage
(
test/e2e/bronzethread/testdata/<name>/), or it does not adduser-visible behavior. It adds an example, not product behavior.
mage test:integration+mage test:e2eare green, or it touchesnone of those. The example's schema is its own, seeded into the demo cluster only.
Before requesting review
to check the parts they did not.
server/package-lock.jsonis generated bynpm installfromserver/package.json. To check it, regenerate it and compare.