Skip to content

v0.3.0

Latest

Choose a tag to compare

@github-actions github-actions released this 10 Nov 13:22
Immutable release. Only release title and notes can be modified.
1510e9f

Setup commands that write every file the hand steps of TARGET-SETUP and deploy/README.md write, and a security fix for targets set up with 0.1.0's or 0.2.0's TARGET-SETUP that run the privileged helper: on those, the new gate refuses the read-only and operator keys until they move to a second service account (Upgrading, step 2). Protocol version 2, the tool catalogue, both policy schemas and the helper's units are unchanged from 0.2.0, so a 0.2.0 server works with a 0.3.0 gate and the reverse. The design record behind each change is docs/ARCHIVE.md §14, sessions S8-scope to S8-4 and PRs #77 to #94.

Security

  • The gate refuses a key without privileged forwarding on the helper's socket-group account (#90). A GitHub security advisory accompanies this release.
    • Who is affected: a target set up by 0.1.0's or 0.2.0's TARGET-SETUP with the privileged helper installed, where a key whose gate policy has no privileged.enabled: true (a read-only or operator key) is on the same service account as the admin key. Those documents put every key on one account (svc-shell) and added it to the helper's socket group. A target without the helper, or whose only keys on that account forward to the helper, is not affected.
    • What could happen: below Landlock ABI 9 (every kernel this project is tested on; the CI runners have ABI 8) the gate's sandbox does not govern a connect to a pathname Unix socket. The socket's permissions (root:svc-shell-priv 0660) and the helper's peer-UID check (client_uid) were all that stood between such a key's commands and the helper, and both passed. Human approval is enforced by the server, not the helper (PRIVILEGED §3). So a compromised server holding the read-only key, with any declared read command able to open a Unix socket, could ask the helper for root actions without any approval, up to what the privileged policy allows. Shown in containers before the fix: a read-only policy's command, inside the gate's own sandbox, got an answer from the helper.
    • What changes: when a policy has no privileged forwarding and the gate's process belongs to the group that owns /run/shell-mcp/privd.sock or /run/shell-mcp/privd-broad.sock (read from the socket files; the gate never reads the privileged policy), the gate refuses every request with install_insecure, before the sandbox and before any byte of the request, hello included: "this account is in the privileged helper's socket group and this policy has no privileged forwarding: serve the keys without forwarding from a second service account outside that group …". It also refuses when /run/shell-mcp cannot be inspected. check-policy as the account prints FAIL install: gate process belongs to group "svc-shell-priv" …, and shell-mcp doctor and shell-mcp check show the refusal for the target. The admin key keeps working; the helper, its policy, its units and its socket group are unchanged.
    • What to do: Upgrading, step 2. SECURITY §2 ("Shared service account") and §5 item 8 state the rule: one account per privilege level.

Upgrading from 0.2.0

The full steps, with what each command does on a host set up by hand, are README's "Upgrading from 0.2.0" and TARGET-SETUP §4, §7, §8 and §12.

  1. Install the new shell-mcp-gate and shell-mcp-privd on every target, then the new server image. The protocol is unchanged (version 2), so the order is free and nothing is refused for a version mismatch; both start per request, so nothing on the target restarts. The server restart drops pending approvals, as on every upgrade.
  2. Targets with the helper: move every key without privileged forwarding to a second service account (required; the security fix). Do it in the same window as step 1: the new gate refuses those keys on the shared account.
    1. Create the account with install, with the first key you move: that key's own flags (policy, principal, from= list, .pub file) and --user svc-shell-std --uid 60125 --gid 60125 (your own unused ids; never the socket group). Run it with --dry-run first. It appends the account's Match block to the sshd drop-in, writes its keys file with the key's line byte for byte as the old one, its slice drop-in and, with services.control, its polkit rule (60-shell-mcp-svc-shell-std.rules), checks the policy as the new account and reloads sshd. The key then logs in as either account. An account's keys must agree on the journal: keys whose policy has a journal section and keys whose policy has none go to different accounts.
    2. Give the moved policies' write roots and repositories to the new account (chown -R svc-shell-std: <root>).
    3. On the server, set the target user of each moved key's instance to the new account (SHELL_MCP_TARGET_USER=svc-shell-std, or user: in the targets file), then docker compose up -d. The host-key pin, the key and from= are unchanged.
    4. shell-mcp-gate move-key --principal <label> --from-user svc-shell --to-user svc-shell-std, one run per key. For a key install already put on the new account it finishes the move; any other key's line moves byte for byte with its polkit rule. It refuses the admin key, which stays on svc-shell with everything about the helper.
    5. If svc-shell was in systemd-journal only for keys that moved, remove the membership: usermod -r -G systemd-journal svc-shell (install for the admin key refuses it otherwise).
    6. install for each key of either account, and move-key again, then report every item unchanged.
  3. Optional: adopt the setup commands. On a host set up by hand as TARGET-SETUP says, shell-mcp-gate install with the flags that describe it, and shell-mcp-privd install --accept <sha256> over units units generated from the same policy, report every item unchanged and write nothing; any difference is refused with a diff, never overwritten. policy new never overwrites a hand-written policy, and is optional: from the example answers files it writes 0.2.0's example policies with their comments rearranged, and with one value changed in admin and the privileged policy, both of which now carry the union of the two examples' deny lists (README, "Upgrading from 0.2.0", step 6). On the server, init refuses 0.2.0's by-hand secrets directory until it belongs to the image's user: chown -R 65532:65532 secrets, after which it keeps every file. init compose prints the reference compose with your values; diff it against your file before using it.
  4. Check: shell-mcp doctor in the server's container (docker compose exec shell-mcp /shell-mcp doctor), check-policy as each service account, and journalctl -t shell-mcp-gate for the install commands' audit lines.

Added

  • shell-mcp-gate install (S8-1, #79; several accounts per host since #94): the service account (locked with usermod -L, never the setuid passwd), its memory slice, its polkit rule, its Match block in the sshd drop-in and the key line, last; check-policy as the account, sshd -t and sshd -T -C for every account and for a name that is not one, the reload, and the host-key pin, read locally. It refuses a from= wider than /24 or /64 (no override), a key with options, a private key or a host key, ids below 1000 or in use, any file on the host owned by a new id (the owner scan), any supplementary group but systemd-journal (journal section) and the socket group (privileged forwarding), and every file with other content, with a diff. One Match block per account in the one drop-in; polkit rules 60-shell-mcp.rules for the first account and 60-shell-mcp-<user>.rules for others. Idempotent, with --dry-run, rollback of every file on a later failure, temp files that a failed run removes, and one audit line per change or refusal (TARGET-SETUP §12.1, §12.4).
  • shell-mcp-gate move-key (#94): moves one key line between two accounts install made, byte for byte, with its polkit rule, in one transaction with rollback and a read-back of both files. It refuses a key with privileged forwarding and a destination whose groups the moved policy does not allow; it finishes a move install began, and a second run reports unchanged (TARGET-SETUP §12.1, "Moving a key between accounts").
  • shell-mcp-gate host-key (#79): the pin lines from the host's own .pub files, as any user, never from the network.
  • shell-mcp-privd install (#79): the full check-policy, then the review (every REVIEW line and the policy's SHA-256), and nothing written without --accept <that sha256>, on every run; the backup store, the units exactly as units generates them, systemd-analyze verify with rollback, the sockets enabled, a socket restarted only when its own file changed, an unused broad pair disabled and removed, and the exposure score (TARGET-SETUP §12.3).
  • policy new in both binaries (S8-3, #83): the gate policy and the privileged policy from one answers file and a preset (read-only, operator, admin), rendered from examples/ with their comments and loaded strictly by each binary's own loader before anything is written. The answers file is strict (unknown keys, duplicates, wrong types refused), and its comments are untrusted: each line gets its own # prefix, control characters and the Unicode line and paragraph separators are refused, and a comment is bounded. examples/policies/*.answers.yaml reproduce the examples byte for byte (POLICY §9).
  • shell-mcp init and init compose (S8-2, #82). init writes the bearer token, the SSH key pair and, with --approver, the approvers file, owned by the image's user, in the image with no network and no capabilities; it never prints the token or the key, keeps every existing file, and refuses wrong owners, modes and keys rather than repair them. The approver's seed is shown on a terminal only: without one, --approver is refused before anything is written. init compose prints the reference compose with a deployment's values in two forms: compose secrets: for docker compose, or one read-only bind mount of the directory (--form bind) for stack editors. With --profile operator and --approve-host it sets SHELL_MCP_APPROVAL_TIERS: operator,destructive; --profile admin needs --approve-host.
  • shell-mcp doctor (S8-4, #84): run in the server's container, one row per check with its fix: the configuration as serve loads it, the secret files' modes, each target's pin, gate, protocol and sandbox, the helper's core and broad sockets, each trusted proxy against the container's own routes (a gateway is a FAIL), the approval page and, with --mcp-url, the MCP endpoint without a token. It writes nothing and never sends the token (TARGET-SETUP §12.6).
  • scripts/verify-release.sh (#84), in the repository and the examples archive: every file against SHA256SUMS, and the signatures (cosign) or provenance (gh) at the release tag; without either tool it refuses unless --sums names a SHA256SUMS verified elsewhere. No network fallback, no identity override, and a dry run's files never pass. The release workflow runs it against the files it just signed, and checks that it refuses a changed binary, a changed SHA256SUMS, a missing bundle and another release's identity.
  • deploy/caddy/ (#84, #87): an example Caddyfile and an example nginx.conf for the reference compose, and a README of what any proxy needs: a container on the server's network at a fixed address, the address it saw as X-Forwarded-For, that address alone trusted (never the gateway), the approval page for the LAN or VPN only, and a restart after an edit.
  • The quick start in eleven steps (#84, #87), each naming its command: verify the image (cosign or gh) before running it; the secrets with init; download and verify the release on a workstation and copy it to the target; the binaries; the gate policy with policy new; install; write roots by hand; the privileged policy and privd install with the review; init compose and the proxy; up -d and doctor; a client. TARGET-SETUP is its reference part, with every hand step and the command that does it.

Fixed

Other security-relevant fixes found on the way:

  • Three required CI checks and the release preflight could not fail (#86). Without an explicit shell, GitHub runs steps as bash -e, without pipefail, so … run.sh | tee in the exposure, setup-check and caddy-check jobs, and the release preflight's notes.sh … | tee, took tee's exit status. No run had hidden a failure. Every workflow now sets shell: bash (-eo pipefail), and scripts/workflowcheck fails if one loses it.
  • The execx credential option and its checks (#79). The one caller, install's check-policy as the account, needs a process that starts as root and runs as the account. The option is off by default and honoured only for a root caller; the trampoline runs all its usual checks as root, then switches every thread to exactly the account's groups, gid and uid, reads back the ids, groups and capability sets of every thread, re-arms the parent-death signal and sets no_new_privs before the exec. A cgo build, where the switch could not reach every thread, is refused before anything is written. A test keeps every other caller from setting it.
  • The approval seed reaches a terminal only (#82): init --approver off a terminal is refused before anything is generated, a --dry-run included.
  • The proxy and tunnel guidance (#87). The docs now say never to put a tunnel or internet-facing relay in front of either name (a source filter cannot tell: the proxy sees the connector's address), that a proxy on the host itself reaches the server from the gateway and is not supported, and that .env.example's trusted-proxy value is a single address (its /29 held the gateway). caddy-check and nginx-check refuse an example that allows private_ranges, 172.16.0.0/12, the compose's subnet or any Docker default network.
  • The deployer-docs review (#87): the image verified before it first runs; TARGET-SETUP §2's verification loop stops at the first failure; the host-key pin's refusal and the docs name shell-mcp-gate host-key and a trusted channel, never ssh-keyscan; the Landlock refusal names a newer kernel first and says best-effort weakens the sandbox; --help exits 0 on every subcommand; removal and rotation steps (TARGET-SETUP §11.1, deploy/README.md).

CI

  • e2e-host in four shards (#86) beside a required e2e-host-coverage job that checks every e2e test ran in exactly one shard, passed, and that nothing skipped; CI's wall time went from about 25 to about 8 minutes, with the same test counts.
  • pipefail in every workflow and actionlint v1.7.12 (#86), with workflowcheck holding the ci aggregate to every job; go and go-checks split per runner image (#86).
  • New container checks in CI and scripts/ci-local.sh: setup-check (the install, init and policy commands on Debian 13, Ubuntu 24.04 and 26.04, against hosts set up by hand; #79 to #94), caddy-check and nginx-check (#84, #87), proxy-live-check (#88: both example proxies live in front of the server, with negative controls for a pass-through X-Forwarded-For and a gateway-sourced proxy), and the quick start's and CLIENTS §3.2's commands checked against each binary's --help (#88). doccheck checks every relative link and DOC §N reference (#84).
  • scripts/ci-local.sh runs in lanes, prints NOT RUN for what only CI runs, and its --quick says it is not the full gate (#86).

Other merged changes

  • The 0.2.0 image digest pinned in deploy/, SECURITY §7 and CLIENTS, and the release recorded (#77). The setup tooling scoped (docs/handoff/S8-SETUP-TOOLING.md, #78).
  • go.yaml.in/yaml/v3 v3.0.6 (from v3.0.5); Go 1.27.3; the builder image and the test images' bases at their current digests; CodeQL Action v4.39.3 and cosign-installer v4.1.3. No dependency added.

Known limits

  • N-37: at its memory limit a Go 1.27.3 command sometimes ends with a SIGSEGV in the garbage collector instead of Go's out-of-memory error (newSpanSPMC stores an unchecked allocation). The limit holds every time; only the message differs. TestExecMemoryLimit accepts the fault only with proof of the stop, and TestGCSpanQueueBugInRuntime is a tripwire that fails on the Go release that fixes it, so the acceptance is removed in that release's PR (POLICY §4a, POST-RELEASE N-37).
  • go.yaml.in/yaml held on v3 (#91): v4.0.0 accepts inputs v3 refuses at the policy boundary (C1 control characters, empty keys, wider anchor names, some flow-context text). Golden tests pin every parser's YAML layer to v3's behaviour, and deps-current's exception for v4 lasts until 2026-12-08, when a narrow YAML profile in the strict loaders is due, applied on v3 first, then the migration.
  • Deferred: shellcheck over the scripts and workflows (approved, its own PR); running setup-check's three distributions in parallel (L5); keys list and revoke beyond move-key; uninstall (TARGET-SETUP §11.1 has the hand steps).

Verify

Image: ghcr.io/tyler-rich/shell-mcp:0.3.0@sha256:95fd125d8f18c869b884f336881b24383383270f5d7b63a6efaa145d6a3eb537 (linux/amd64, linux/arm64). Pin the digest.

SHA256SUMS lists every release file except itself and the Sigstore bundles. The binaries, the examples archive and SHA256SUMS are signed with Sigstore keyless signing (<file>.sigstore.json). Every file SHA256SUMS lists, and the image index, carry SLSA build provenance; SHA256SUMS itself has no attestation (gh attestation verify SHA256SUMS finds nothing), and its cosign signature covers it. The binaries and the platform images also carry CycloneDX SBOM attestations. Only the identity below is a release of this version; anything signed by another ref is not.

Run the cosign verify-blob command for each binary you use, the examples archive and SHA256SUMS, and the gh attestation verify command for each file you use that SHA256SUMS lists.

cosign verify-blob --bundle shell-mcp-gate_0.3.0_linux_amd64.sigstore.json \
  --certificate-identity https://github.com/tyler-rich/shell-mcp/.github/workflows/release-build.yml@refs/tags/v0.3.0 \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com \
  shell-mcp-gate_0.3.0_linux_amd64
sha256sum --ignore-missing -c SHA256SUMS
gh attestation verify shell-mcp-gate_0.3.0_linux_amd64 --repo tyler-rich/shell-mcp \
  --signer-workflow tyler-rich/shell-mcp/.github/workflows/release-build.yml --source-ref refs/tags/v0.3.0
cosign verify ghcr.io/tyler-rich/shell-mcp@sha256:95fd125d8f18c869b884f336881b24383383270f5d7b63a6efaa145d6a3eb537 \
  --certificate-identity https://github.com/tyler-rich/shell-mcp/.github/workflows/release-build.yml@refs/tags/v0.3.0 \
  --certificate-oidc-issuer https://token.actions.githubusercontent.com
gh attestation verify oci://ghcr.io/tyler-rich/shell-mcp@sha256:95fd125d8f18c869b884f336881b24383383270f5d7b63a6efaa145d6a3eb537 --repo tyler-rich/shell-mcp \
  --signer-workflow tyler-rich/shell-mcp/.github/workflows/release-build.yml --source-ref refs/tags/v0.3.0