Title: mcpx: a principal per surface and a permission per operation, declared permissively · Issue #1968 · developing-today/code · GitHub
Open Graph Title: mcpx: a principal per surface and a permission per operation, declared permissively · Issue #1968 · developing-today/code
X Title: mcpx: a principal per surface and a permission per operation, declared permissively · Issue #1968 · developing-today/code
Description: Relocated from dezren39/darwin-nix#298 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/ni...
Open Graph Description: Relocated from dezren39/darwin-nix#298 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue referenc...
X Description: Relocated from dezren39/darwin-nix#298 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue refe...
Opengraph URL: https://github.com/developing-today/code/issues/1968
X: @github
Domain: github.com
IPv4 address: 140.82.112.4
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"mcpx: a principal per surface and a permission per operation, declared permissively","articleBody":"Relocated from dezren39/nix#298 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix numbering).\n\nParent: #253\n\n## Summary\n\nThe daemon has no notion of *who* is calling. That is deliberate and documented\nthree times over — \"the API is unauthenticated, so the network it is on is the\naccess control\" (`internal/daemon/server.go:214`), \"the socket's file\npermissions are the access control\" (`internal/daemon/origin.go:13`), \"Every\nendpoint is unauthenticated\" (`internal/api/openapi.go:40`) — and for a daemon\non a unix socket it is the right model.\n\nThis issue is the **authorisation model**: one notion of a principal that each\nsurface can construct, and a permission declared on each operation. Built\npermissively, in the same spirit as #253: every principal resolves to the owner,\nevery permission check answers yes, and the daemon behaves exactly as it does\ntoday. What the work buys is that the *vocabulary exists* and is declared in one\nplace, so a future surface has something to populate and a future policy has\nsomething to constrain.\n\n**This blocks nothing.** No surface, transport or feature waits on it. An\nunauthenticated local daemon is a complete answer and stays one. Ordered behind\n#253 so the auth work proceeds in one line rather than two.\n\n## Original notes\n\n> security is just off the table right now, there's no blocker for adding\n> security, there's no blocker for not having auth. just dont mix auth with\n> other things in issues\n\nRaised after an earlier draft of this issue framed itself as a precondition for\nremote surfaces. It is not one, and the framing was wrong.\n\n## Current state\n\n**Unauthenticated by design, and consistently so.** Three separate places state\nthe model in the same terms, which indicates a decision rather than a drift. The\nTCP listener's host is deliberately not defaulted\n(`internal/daemon/server.go:216-220`): \"that has to be somebody's decision\nrather than a default.\" The daemon will bind a port and declines to guess you\nmeant to expose it.\n\n**The peer uid is available and unread.** A unix socket connection carries peer\ncredentials (`SO_PEERCRED` / `LOCAL_PEERCRED`). mcpx never looks. \"Which local\nuser is calling\" is a principal obtainable today for free.\n\n**The ops table is the asset.** Every operation is declared once in\n`internal/api/ops*.go`, and that declaration drives the CLI command, the MCP\ntool and the OpenAPI operation. #114 names this as the project's own precedent —\n\"one declaration should drive every surface\". A permission attached there is\nenforced everywhere by construction, including on surfaces that do not exist\nyet.\n\n**What is adjacent and is not this.** #253 is the authorization *interface*\n(OAuth, resource server, 61 conformance rows). #300 is real credential\nvalidation, behind #253. #240 and #205 are configured upstream auth never being\napplied — mcpx as a client, the opposite direction. #204 is `Origin` validation,\na browser-threat defence, not authentication. #185 is a settings ceiling a\ncaller may lower but not raise — the same *shape* as a permission and worth\nsharing machinery with.\n\n## Approaches\n\n### Approach A — least recommended: a principal only when a surface needs one\n\nLeave it until ssh or a browser surface lands, then add identity to that\nsurface.\n\nThis is how a codebase ends with four authentication systems: each surface\ninvents a principal because none existed when it was written. The cost of\ndeclaring the vocabulary now is small precisely *because* nothing depends on it\n— there is no migration, no compatibility surface and no behaviour to preserve.\nDoing it later means doing it four times, against live surfaces.\n\n### Approach B — middle: principals now, permissions when needed\n\nConstruct a principal per surface, carry it through, and defer the permission\ndeclarations.\n\nHalf the value for most of the work. A principal nothing consults is a field\nthat rots; without a permission to check it against, nothing exercises it and it\nwill be wrong by the time it matters.\n\n### Approach C — recommended: both, permissively, and a decision that is always \"yes\" but always *recorded*\n\n**1. Every surface constructs a principal.** One internal notion, built from\nwhat each transport natively knows:\n\n| surface | principal from |\n| --- | --- |\n| unix socket | peer credentials — the uid, available today, read nowhere |\n| loopback TCP | nothing native; explicit configuration, or anonymous |\n| ssh (#85) | the authenticated key |\n| browser (#174) | a session, alongside #204's `Origin` check |\n| plugin (#82) | a declared plugin identity rather than ambient trust |\n\n**2. Every operation declares a permission.** A field on the ops-table entry,\nchecked at the one place all surfaces funnel through. Default policy: the\nsocket's owner gets everything, anonymous gets everything, and **the check\nalways returns yes**. Behaviour is identical to today.\n\n**3. The decision is recorded even though it is always yes.** This is the piece\nthat makes the permissive stage worth shipping rather than merely harmless.\nWith principals constructed and permissions declared, mcpx can answer \"what\nwould a policy have refused?\" from real traffic, before any policy exists. That\nis the same dry-run property #300 wants for credential checks, and the two\nshould share one mechanism.\n\nWhat this deliberately does **not** do: define a policy file format, decide\nwhich scopes may grant, or enforce anything. Those are a later issue, and they\nare the parts with actual risk.\n\n## Open questions\n\n- Is the permission vocabulary per-operation, or a small set of tiers\n (`read`/`run`/`admin`) operations are tagged with? Tiers are comprehensible\n and coarse; per-operation becomes a 200-row table nobody reads. Leaning tiers.\n- Does a *tool call* carry a permission, or only mcpx's own operations? Upstream\n tools are not in the ops table, and they are the interesting surface. Possibly\n #114's tool views are the natural grant unit.\n- Does the principal belong in the request context, or in the existing session\n notion? There is already a session key (`_meta[\"ai.opencode/sessionID\"]`,\n #211); a principal is not a session but they travel together.\n- Should `mcpx doctor` report \"authorisation: permissive\" so nobody deploys\n believing otherwise? Same hazard #300 flags for the credential interface, and\n the same answer: yes, loudly.\n- Shared machinery with #185's clamping — same ceiling shape, probably one\n implementation.\n- Does the socket peer uid distinguish anything useful on a single-user laptop?\n Honestly, rarely. It matters for a shared host and for #255's elicitation\n storage concern, and it is nearly free, which is the whole argument.\n\n## Ease · Impact · Related\n\n**Ease:** M for principals and the declaration field; S for the permissive check\nand the decision log. The enforcement, policy format and config-chain\nconstraints are explicitly **out of scope** and belong to a later issue.\n**Impact:** low and deferred — this is vocabulary, not capability. Worth doing\nearly only because it is cheap while nothing depends on it. **Blocks nothing.**\n\n**Depends on / related:** **#253 (the auth interface — this is ordered behind\nit)**, #300 (real credential validation — the sibling second stage, also behind\n#253, also blocking nothing), #185 (clamped settings — same ceiling shape,\nshare machinery), #204 (Origin validation — adjacent, not a substitute), #240\nand #205 (configured upstream auth never applied — mcpx as client, the other\ndirection), #255 (elicitation storage permissions — a case a principal would\nmake expressible), #82 (plugins as a principal), #114 (tool views as a possible\ngrant unit), #113 (the operation surface where a policy would be administered),\n#174 (surfaces — each would supply a principal as it lands, none waits on this).\n\n## Acceptance criteria\n\n- A principal type exists that every surface (unix socket, TCP, HTTP) can construct, and a permission is declared per operation in one place.\n- Built permissively: every principal resolves to the owner and every check answers yes — daemon behaviour is byte-for-byte unchanged for existing clients.\n- The vocabulary is documented where the current unauthenticated model is stated (`server.go`, `origin.go`, `openapi.go`), superseding those comments.\n- Tests pin the permissive behaviour so a future policy change is a deliberate diff, not an accident.\n","author":{"url":"https://github.com/dezren39","@type":"Person","name":"dezren39"},"datePublished":"2026-10-28T22:49:38Z","url":"https://github.com/developing-today/code/issues/1968"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:cc1b0d7e-f005-2ab7-d1e8-7a3165e21bf0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D06:2D14E:683FBF:8C742F:6B062D41 |
| html-safe-nonce | b56f5ff9c8a16639812fc7d0dcab9c9dd40429dfe3b4ae84822800099bc6ca16 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDA2OjJEMTRFOjY4M0ZCRjo4Qzc0MkY6NkIwNjJENDEiLCJ2aXNpdG9yX2lkIjoiMjI5MjgyODY1NDUxMTk5MjEyOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | a1bae2749be366f4f888345861f60dde1b30f465dd53e14f066571b4235608ca |
| hovercard-subject-tag | issue:6088942806 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/developing-today/code/1968/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5761d846938871ffb176add8375e56c1923a926d4c3f592a340a71bfac85b5b7/developing-today/code/issues/1968 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5761d846938871ffb176add8375e56c1923a926d4c3f592a340a71bfac85b5b7/developing-today/code/issues/1968 |
| og:image:alt | Relocated from dezren39/darwin-nix#298 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue referenc... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dezren39 |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7f961de5dd5c5d4aca24d33f8b3ffb3fb8b2ef53d0a4f32f01f0a790e512f6d3 |
| turbo-cache-control | no-preview |
| go-import | github.com/developing-today/code git https://github.com/developing-today/code.git |
| octolytics-dimension-user_id | 26439447 |
| octolytics-dimension-user_login | developing-today |
| octolytics-dimension-repository_id | 627308783 |
| octolytics-dimension-repository_nwo | developing-today/code |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 627308783 |
| octolytics-dimension-repository_network_root_nwo | developing-today/code |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 494ea0bb1e0feef734a83e2628697647755e8864 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width