Skip to content

docs: security model and hardening checklist (PR 7c of REORG-PLAN) - #503

Merged
pdettori merged 2 commits into
rossoctl:mainfrom
pdettori:docs/security-pr7c
Oct 13, 2026
Merged

pdettori merged 2 commits into
rossoctl:mainfrom
pdettori:docs/security-pr7c

Conversation

@pdettori

@pdettori pdettori commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Summary

PR 7c of docs/REORG-PLAN.md: the security model and a hardening checklist. Docs only. Based on main after #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).
  • Linked from docs/index.md, the README and the operations index; the plan file records 7c.

The page leads with four things

  1. With SH_REQUIRE_AUTH not true, anyone who can reach port 8080 can run turns on the operator's credential. (Naming a subject with X-SH-Subject is the P5 design, not built; the page no longer claims it.) Compose defaults to false and passes the operator's ANTHROPIC_* into the supervisor.
  2. Every shipped deployment runs credential "direct" mode, so a shared worker holds every concurrent user's real key for the length of a turn.
  3. The control plane has no user allowlist.
  4. Container sandboxes do not isolate sessions or users from each other, and egress is open.

Please check

  • SECURITY.md makes claims the repo does not support: it says dependency vulnerabilities are detected with pnpm 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 change SECURITY.md here; say if you want a correcting PR. (Its contact address is being changed separately in docs: point the security contact at rossoctl.dev #502.)
  • Items I inferred, not ran: a shared attach token letting a holder attach under any unattached sandbox id; run-status reads with a deleted session's token until it expires; a user-supplied credential endpoint aiming a worker at in-cluster 443 targets; a compromised worker rewriting the ownership index through the shared Redis password. All are marked.
  • Whether encryption of etcd at rest, SELinux or AppArmor are on in your clusters is not determinable from the repo and is not claimed.
  • The log search for secrets was a grep of obvious paths, not an audit; the page says so.

Verification

scripts/check-doc-links.py reports 0 broken links over 183 files; Prettier run on changed files. Nothing was deployed. make lint not run locally; CI will.

Assisted-By: Claude (Anthropic AI) [email protected]

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]>
@pdettori pdettori added the ready-for-ai-review Request automated AI code review from clawgenti label Oct 13, 2026

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-single single 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.
  • --image doesn't pin the remote-worker image; that needs --sandbox-image.

The rest are wording nits, all inline.

Comment thread docs/reference/security-model.md Outdated
## 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/reference/security-model.md Outdated

| 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_*` |

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)".

Comment thread docs/reference/security-model.md Outdated
| 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/reference/security-model.md Outdated
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/reference/security-model.md Outdated
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`.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/reference/security-model.md Outdated

`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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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".

Comment thread docs/operations/hardening.md Outdated
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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread docs/operations/hardening.md Outdated
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: "All four MU1 values (signing key, KEK, exchange token)" lists three. The fourth is the public keys (deploy/k8s/setup.sh:617).

Comment thread docs/operations/hardening.md Outdated
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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>
@pdettori

Copy link
Copy Markdown
Member Author

Addressed in 6c186ed. Must-fix: the X-SH-Subject clause is removed from the headline and marked designed, not built; the PR body is corrected. Suggestions and nits: Redis password on Kubernetes only, exact stripped RELAY_ names, the ocp-single admin-port exposure to sandboxes (page and checklist), the 12 MiB bundle cap and quota, "All JWS and refresh tokens", the plaintext successor in the refresh grace key, the operator fallback switch wired but not its token on Kubernetes, the jailer uid/gid, four pinned plus one documented Pi global, --sandbox-image and SANDBOX_IMAGE for the remote worker and Redis digest pinning on Kubernetes only, the sandbox rootfs wording, the fourth MU1 value, and --tls-secret being ocp-single only.

@ingpaolodettori-dev ingpaolodettori-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-Subject clause is out of the headline and marked designed-not-built, matching resolveTurnAuth.
  • Redis password scoped to Kubernetes (VM/Compose Redis has none); Redis digest-pinned only in deploy/k8s (kustomization.yaml digest; Compose/VM use docker.io/redis:7-alpine by tag).
  • Strip list now names RELAY_ADDR/RELAY_TLS/RELAY_CA_FILE exactly.
  • ocp-single admin-port exposure to sandboxes stated on both pages.
  • Bundle caps: maxBodyBytes: 12 * 1024 * 1024 (control-plane routes.ts:156) and 429 bundle_quota_exceeded (errors.ts:66).
  • Refresh grace key plaintext successor; SH_REFRESH_REUSE_GRACE_SECONDS default 30, capped at 300 (main.ts:100,142).
  • Operator fallback on Kubernetes: switch wired, token not, boot refused — matches the control-plane.yaml:78-79 comment citing #368.
  • Jailer uid/gid = worker's (root under the shipped unit).
  • Four pinned Pi globals plus fileMutationQueues documented (P5 spec :341).
  • --sandbox-image / SANDBOX_IMAGE (setup-vm.sh:56) for the remote worker.
  • Sandbox rootfs: only sandbox.yaml has readOnlyRootFilesystem: false; the others are true.
  • Hardening: moca-mu1 holds the four listed keys (setup.sh:617); --tls-secret is ocp-single only.

Docs only, DCO signed off, CI green. LGTM.

@pdettori
pdettori merged commit 42c3a3f into rossoctl:main Oct 13, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready-for-ai-review Request automated AI code review from clawgenti

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants