fix(mcp): the umask a tool's output deserves, and a websocket refused in its own terms
Three small corrections to the HTTP transport, none of them cosmetic. **`UMask = "0022"` on the unit, not `0077`.** This unit's tools write files an operator then reads: `shot --output` and `record` produce exactly the files the same verbs produce from a shell, and a unit that made them 0600 would be a surprising difference between the CLI and the tool that wraps it -- the sort that ends with a web server unable to read a capture and nothing saying why. The authorization table was never protected by the umask anyway: it is 0600 by an explicit chmod inside a 0700 directory declared by tmpfiles, which is what actually guards it. **A non-`http` scope is refused with `websocket.close`**, not with an `http.response.start` a websocket client cannot read. Nothing here mounts a websocket so the branch is unreachable today, but an unreachable branch that would send the wrong frame is a trap for whoever makes it reachable. **The serialisation this transport widens is written down**, in the module docstring, in `docs/CONTRACT-mcp.md` §1 and in the TODO that already owns the underlying limit. `Runner` has always held a process-wide lock, because the CLI it calls prints to a shared stdout -- but over stdio each client had its own process, so a call only ever queued behind that same client's previous call. One process serving many callers makes a stuck call delay *other people's* agents, and the one who notices is not necessarily the one who caused it. Latency and never a hang (the event loop answers a ping throughout), but it changes what the existing deadline TODO is worth. Also drops two parameters `_refuse` never used. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KchcvnbfhhZhUHy83YL3Ya
This commit is contained in:
1 parent
1fab00f2bf
commit
c32a2dd2ce
2 files changed
+39
-8
No files matched your search
+12
-1
@@ -1534,7 +1534,18 @@ in {
|
||||
SupplementaryGroups = [cfg.sessions.group];
|
||||
|
||||
WorkingDirectory = cfg.mcp.stateDir;
|
||||
UMask = "0077";
|
||||
# The CLI's own umask and not a tighter one, deliberately. This unit's
|
||||
# tools write files an operator then reads: `shot --output` and
|
||||
# `record` produce exactly the files the same verbs produce from a
|
||||
# shell, and a unit that made them 0600 would be a surprising
|
||||
# difference between the CLI and the tool that wraps it -- the sort
|
||||
# that ends with a web server unable to read a capture and nothing
|
||||
# saying why.
|
||||
#
|
||||
# The authorization table is not protected by this. It is `0600` by an
|
||||
# explicit chmod, inside a `0700` directory declared by the tmpfiles
|
||||
# entry above, which is what actually guards it.
|
||||
UMask = "0022";
|
||||
|
||||
Restart = "on-failure";
|
||||
RestartSec = 5;
|
||||
|
||||
Reference in new issue
Block a user