Repository navigation
docs: security model and hardening checklist (PR 7c of REORG-PLAN) - #503
Conversation
reference/security-model.md: what each component holds, who can reach it, the token and credential model, isolation by tier, what is not enforced, what is designed but not built, transport security and supply chain. operations/hardening.md: a checklist per deployment path. Both lead with the findings that matter most: anonymous /turn when SH_REQUIRE_AUTH is off, direct credential mode everywhere, no control-plane user allowlist, and no isolation between sessions on a container sandbox. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Thanks, this is a careful page. I checked it against the code and manifests at main. Most claims hold at the cited behaviour: token scopes and TTLs, the NetworkPolicies, the credential flow and stores, the transport table, Action pinning, and the SECURITY.md gaps.
Must-fix (1): the first item in "Read this first" says unauthenticated callers can name any subject with X-SH-Subject. In P6 the header only feeds the subject_conflict check when a token is present, and with no token the auth result is null. That flow is the P5 spec's. Since this is the page's headline claim, please correct it here and in the PR body.
Suggestions:
- The Redis password is held only on Kubernetes.
- The
ocp-singlesingle namespace opens admin port 8081 to sandboxes. - The grace key holds the plaintext successor refresh token.
- The microVM jailer runs with the worker's uid, which is root with the shipped unit.
--imagedoesn't pin the remote-worker image; that needs--sandbox-image.
The rest are wording nits, all inline.
| ## Read this first | ||
|
|
||
| 1. **With `SH_REQUIRE_AUTH` not set to `true`, anyone who can reach port 8080 can run turns on the operator's model | ||
| credential, and can name any subject with `X-SH-Subject`.** Compose defaults to `false` and passes the operator's |
There was a problem hiding this comment.
must-fix: The X-SH-Subject half of this is not what P6 does. With no bearer and SH_REQUIRE_AUTH off, resolveTurnAuth returns null (packages/knative-server/src/turn-auth.ts:229-233), and no subject is set. The header is read in exactly one place, the subject_conflict check at turn-auth.ts:249-251, and that check runs only when a token is present. Nothing in packages/, harness/ or remote-worker/ derives a subject or owner from it. The "name any subject" flow is the P5 spec's (docs/specs/2026-09-06-p5-session-isolation-design.md:177). The first half (unauthenticated turns spend the operator's ANTHROPIC_*) holds. Please drop the header clause here and in the PR body, or mark it (designed, not built). As the page's first claim, it should be the most solid one.
|
|
||
| | Component | Holds | | ||
| | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| | Supervisor and workers | Redis URL and password; the relay exec token; the exchange token; the control plane's **public** keys; a user's real model key for the length of a turn (direct mode). Compose also holds the operator's `ANTHROPIC_*` | |
There was a problem hiding this comment.
suggestion: "Redis URL and password" (and the relay's "the Redis password" on line 28) is true only on Kubernetes (moca-redis Secret). Compose (deploy/compose/docker-compose.yml:39) and the VM (deploy/vm/env/supervisor.env.example:41, setup-vm.sh:211) run Redis with no password, as this page's own "Where secrets live" table says. Suggest "Redis URL (with password on Kubernetes)".
| | Redis | Sessions, ownership, sandbox records (which decide where a turn executes), leases, hashed refresh tokens, audit streams, bundles | | ||
|
|
||
| Tool commands run in a sandbox with an explicit environment that strips the worker's own settings | ||
| (`SANDBOX_TOKEN`, `RELAY_*`, `SH_*`, `MOCA_*` and others). But commands run as the same Unix user as the sandbox |
There was a problem hiding this comment.
nit: There is no RELAY_* prefix rule. remote-worker/internal/exec/sandboxenv.go:9-18 strips exact names (RELAY_ADDR, RELAY_TLS, RELAY_CA_FILE, …), and the prefix rules cover only SANDBOX_TOKEN_, SH_ and MOCA_ (:22). Any other RELAY_FOO reaches commands. Suggest listing the three RELAY_ names.
| | Redis 6379 | Supervisor, relay and control plane, which share one password | | ||
| | Sandbox | No ingress. Egress to the relay, DNS, and the internet except private, CGNAT and link-local ranges | | ||
|
|
||
| Default-deny applies in both directions in `moca`, `moca-sandbox` and `moca-credentials`. It only works on a CNI that |
There was a problem hiding this comment.
suggestion: The ocp-single overlay deletes these three namespaces and their default-denies and puts everything in one namespace (deploy/k8s/overlays/ocp-single/delete-*, network-policy-single.yaml). There, the 8081 rule from: podSelector: {} (base/supervisor.yaml:163-166) also admits the sandbox pods, so a sandbox can read the supervisor's /metrics. That should be called out in the 8081 row and in the hardening checklist's "Scope the admin port" item.
| password, a compromised worker could rewrite the ownership index _(inferred)_; the VM README says whoever can write it | ||
| can make another user's session their own. | ||
|
|
||
| The control plane has no rate limiting; its only cap is the request body size (64 KiB by default). A credential's |
There was a problem hiding this comment.
nit: Two qualifications. POST /v1/config-bundles raises the body cap to 12 MiB (packages/control-plane/src/routes.ts:150-157), and bundles also have a byte quota (429 bundle_quota_exceeded, SH_BUNDLE_TOTAL_BYTES). "No rate limiting" itself holds.
| the root `Dockerfile` only. Scorecard runs weekly. Images are pushed to `ghcr.io/rossoctl/*` and **are not signed or | ||
| attested**. The harness image has no `USER` line (the manifests impose non-root), uses floating base tags and includes | ||
| `kubectl` for the deprecated Knative path. Redis and the OpenShift TLS sidecar are pinned by digest; the harness and | ||
| remote-worker images are `:latest` unless you pass `--image`. |
There was a problem hiding this comment.
suggestion: --image only sets the harness image. The remote-worker image is --sandbox-image (deploy/k8s/setup.sh:86-87, used at :261), and on the VM it is SANDBOX_IMAGE. The same applies to the hardening checklist's "Pin images by digest" item. Also, Redis is pinned by digest only in the Kubernetes manifests: VM (setup-vm.sh:235) and Compose (docker-compose.yml:23) use redis:7-alpine by tag.
|
|
||
| `SECURITY.md` says dependency vulnerabilities are detected with `pnpm audit` (no workflow runs it), and describes | ||
| non-root, read-only-rootfs, capability-dropped containers on Kubernetes (true of the supervisor, control plane, relay | ||
| and Redis, not of the sandbox). Treat this page as the more accurate description until `SECURITY.md` is corrected. |
There was a problem hiding this comment.
nit: "not of the sandbox" reads as though the sandbox fails all three. It is non-root and drops ALL capabilities (deploy/k8s/base/sandbox.yaml:32,51); only readOnlyRootFilesystem: false (:55) differs, as your isolation table already says. Suggest "true of every container except that the sandbox's root filesystem is writable".
| networks you do not trust. The admin port is unauthenticated. | ||
| - [ ] **Keep the supervisor reachable at layer 4 only.** No Ingress, edge Route or mesh sidecar in front of it. | ||
| - [ ] **Pin images by digest.** The harness and remote-worker images are `:latest` by default; pass | ||
| `--image <ref>@sha256:...` to `setup.sh`. Images are not signed. |
There was a problem hiding this comment.
suggestion: For the remote-worker image this needs --sandbox-image <ref>@sha256:... too (deploy/k8s/setup.sh:87), or SANDBOX_IMAGE on the VM. --image covers only the harness.
| it; set `SH_SANDBOX_EGRESS_EXCEPT` _(documented, #446)_. | ||
| - [ ] **Scope the admin port.** Any pod in `moca` can read the unauthenticated `/metrics`. Do not run unrelated | ||
| workloads in that namespace, or tighten the policy. | ||
| - [ ] **Restrict who can read secrets in `moca`.** All four MU1 values (signing key, KEK, exchange token) are keys of |
There was a problem hiding this comment.
nit: "All four MU1 values (signing key, KEK, exchange token)" lists three. The fourth is the public keys (deploy/k8s/setup.sh:617).
| sit in Secrets (sealed under the KEK, with metadata in plaintext annotations). | ||
| - [ ] **Add what the manifests omit:** no ResourceQuota, LimitRange, PID or ephemeral-storage limits, and no | ||
| PodDisruptionBudget. | ||
| - [ ] **On OpenShift, supply a real certificate** (`--tls-cert`/`--tls-key` or `--tls-secret`) instead of the |
There was a problem hiding this comment.
nit: --tls-secret works only with --target ocp-single (deploy/k8s/setup.sh:139). Worth saying so here.
- Drop the unauthenticated X-SH-Subject claim from the headline: it is the P5 design, not built. - Redis password and the exec/attach details only on Kubernetes; RELAY_ names stripped from commands are exact; ocp-single admits sandboxes to the admin port; bundle body cap and quota; exchange token is not issued by the control plane; the refresh grace key holds the plaintext successor; the operator fallback switch is wired but its token is not on Kubernetes; jailer uid/gid; four pinned plus one documented Pi global; --sandbox-image and Redis digest pinning; sandbox rootfs wording. - Hardening: MU1 secret keys, --tls-secret is ocp-single only. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Paolo Dettori <[email protected]>
|
Addressed in 6c186ed. Must-fix: the |
ingpaolodettori-dev
left a comment
There was a problem hiding this comment.
Follow-up at 6c186ed: thanks, this addresses everything from the 243dce6 round. I reviewed only the new commit (fast-forward, 2 files, +49/−43) and checked the new wording against main 3ca984f:
- Must-fix: the
X-SH-Subjectclause is out of the headline and marked designed-not-built, matchingresolveTurnAuth. - Redis password scoped to Kubernetes (VM/Compose Redis has none); Redis digest-pinned only in
deploy/k8s(kustomization.yamldigest; Compose/VM usedocker.io/redis:7-alpineby tag). - Strip list now names
RELAY_ADDR/RELAY_TLS/RELAY_CA_FILEexactly. ocp-singleadmin-port exposure to sandboxes stated on both pages.- Bundle caps:
maxBodyBytes: 12 * 1024 * 1024(control-plane routes.ts:156) and 429bundle_quota_exceeded(errors.ts:66). - Refresh grace key plaintext successor;
SH_REFRESH_REUSE_GRACE_SECONDSdefault 30, capped at 300 (main.ts:100,142). - Operator fallback on Kubernetes: switch wired, token not, boot refused — matches the
control-plane.yaml:78-79comment citing #368. - Jailer uid/gid = worker's (root under the shipped unit).
- Four pinned Pi globals plus
fileMutationQueuesdocumented (P5 spec :341). --sandbox-image/SANDBOX_IMAGE(setup-vm.sh:56) for the remote worker.- Sandbox rootfs: only
sandbox.yamlhasreadOnlyRootFilesystem: false; the others aretrue. - Hardening:
moca-mu1holds the four listed keys (setup.sh:617);--tls-secretisocp-singleonly.
Docs only, DCO signed off, CI green. LGTM.
Summary
PR 7c of
docs/REORG-PLAN.md: the security model and a hardening checklist. Docs only. Based onmainafter #501.docs/reference/security-model.md: what each component holds and who can reach it (per port, on Kubernetes), the token and credential model, isolation by tier, what is not enforced, what is designed but not built (MI1, the Z track), transport security hop by hop, audit and logging, and supply chain. Each claim is from code or a manifest unless marked documented only, designed, not built or inferred.docs/operations/hardening.md: a checklist per deployment path (all paths, Kubernetes, single VM, Compose, microVM).docs/index.md, the README and the operations index; the plan file records 7c.The page leads with four things
SH_REQUIRE_AUTHnottrue, anyone who can reach port 8080 can run turns on the operator's credential. (Naming a subject withX-SH-Subjectis the P5 design, not built; the page no longer claims it.) Compose defaults tofalseand passes the operator'sANTHROPIC_*into the supervisor.Please check
SECURITY.mdmakes claims the repo does not support: it says dependency vulnerabilities are detected withpnpm audit(no workflow or script runs it), and that Kubernetes containers are non-root with a read-only rootfs and dropped capabilities (true of the supervisor, control plane, relay and Redis, not of the sandbox, whose root filesystem is writable on purpose). The security page notes this. I did not changeSECURITY.mdhere; say if you want a correcting PR. (Its contact address is being changed separately in docs: point the security contact at rossoctl.dev #502.)Verification
scripts/check-doc-links.pyreports 0 broken links over 183 files; Prettier run on changed files. Nothing was deployed.make lintnot run locally; CI will.Assisted-By: Claude (Anthropic AI) [email protected]