MVP-0.2 · Tenant isolation: per-tenant clones, no file:// or local-path ingest, artifact + runner scoping #255

Closed
opened 2026-09-20 20:16:02 +00:00 by sharang · 0 comments
Owner

Goal

Clone directories and the SSH deploy key are shared across tenants today, file:// and local-path ingest are accepted, artifacts are served without a tenant check and the runner scope is too loose. Multi-tenant production cannot open until one tenant's scan cannot read, write or trigger anything belonging to another.

What to change

  • Per-tenant clone directories (pipeline/git.rs:86, orchestrator.rs:62,1116, api/handlers/graph.rs:264-276).
  • Reject file://, local paths and source_ref server paths on ingest (ingest/mod.rs:127-133,233-247).
  • Drop the shared SSH deploy key (git.rs:139-147, ssh.rs). MVP uses HTTPS token auth; per-tenant keys are deferred to R1 (decision 5 in the plan).
  • serve_artifact checks the tenant (handlers/werkbank_jobs.rs:187-198).
  • Runner scope must be exactly werkbank:runner (handlers/werkbank_jobs.rs:56-58).
  • The static WERKBANK_RUNNER_TOKEN is refused in production.
  • Webhooks for an unknown tenant must not create a database (webhooks/github.rs:26 and the gitea/gitlab equivalents).

Acceptance

  • Two tenants scanning the same repository URL never share a clone directory or a work directory.
  • Ingest rejects file://, absolute and relative local paths, and server-side source_ref paths, with a test per case.
  • No SSH deploy key remains in the agent image or the configuration; git auth is HTTPS token only.
  • serve_artifact returns 404 for an artifact belonging to another tenant.
  • A runner token with any scope other than werkbank:runner is rejected; the static WERKBANK_RUNNER_TOKEN is refused when APP_ENV=production.
  • A webhook for an unknown tenant is rejected and creates no database.
  • Covered by the cross-tenant negative tests tracked in MVP-1.13.
## Goal Clone directories and the SSH deploy key are shared across tenants today, `file://` and local-path ingest are accepted, artifacts are served without a tenant check and the runner scope is too loose. Multi-tenant production cannot open until one tenant's scan cannot read, write or trigger anything belonging to another. ## What to change - Per-tenant clone directories (`pipeline/git.rs:86`, `orchestrator.rs:62,1116`, `api/handlers/graph.rs:264-276`). - Reject `file://`, local paths and `source_ref` server paths on ingest (`ingest/mod.rs:127-133,233-247`). - Drop the shared SSH deploy key (`git.rs:139-147`, `ssh.rs`). MVP uses HTTPS token auth; per-tenant keys are deferred to R1 (decision 5 in the plan). - `serve_artifact` checks the tenant (`handlers/werkbank_jobs.rs:187-198`). - Runner scope must be exactly `werkbank:runner` (`handlers/werkbank_jobs.rs:56-58`). - The static `WERKBANK_RUNNER_TOKEN` is refused in production. - Webhooks for an unknown tenant must not create a database (`webhooks/github.rs:26` and the gitea/gitlab equivalents). ## Acceptance - [ ] Two tenants scanning the same repository URL never share a clone directory or a work directory. - [ ] Ingest rejects `file://`, absolute and relative local paths, and server-side `source_ref` paths, with a test per case. - [ ] No SSH deploy key remains in the agent image or the configuration; git auth is HTTPS token only. - [ ] `serve_artifact` returns 404 for an artifact belonging to another tenant. - [ ] A runner token with any scope other than `werkbank:runner` is rejected; the static `WERKBANK_RUNNER_TOKEN` is refused when `APP_ENV=production`. - [ ] A webhook for an unknown tenant is rejected and creates no database. - [ ] Covered by the cross-tenant negative tests tracked in MVP-1.13.
sharang added this to the Production MVP milestone 2026-09-20 20:16:02 +00:00
sharang added the criticalsecurity labels 2026-09-20 20:16:02 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#255