You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 05458ff
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/decisions/0019-service-projects.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
| Field | Value |
4
4
|-------|-------|
5
-
| Status | Accepted. [P1](#the-p1-spike) passed with changes, on macOS only. P2 to P7 are built (2026-11-07): the environment allowlist, the sandbox, the lifecycle commands, the mock server, the HTTP grader and the first catalog problem, so a service project works from `cstudy start` to `cstudy submit`. P8 onward is planned. Each recommendation's state is in [its table](#open-to-confirm)|
5
+
| Status | Accepted. [P1](#the-p1-spike) passed with changes on macOS, and the sandbox is measured on Linux (Linux Mint 22.3, kernel 7.0.0-34-generic, Docker Engine 29.8.1, x86_64), with SELinux and rootless Docker unproven ([spec](../specs/service-projects.md#on-linux)). P2 to P7 are built (2026-11-07): the environment allowlist, the sandbox, the lifecycle commands, the mock server, the HTTP grader and the first catalog problem, so a service project works from `cstudy start` to `cstudy submit`. P8 onward is planned. Each recommendation's state is in [its table](#open-to-confirm)|
6
6
| Date | 2026-11-05, revised the same day by [O15](#decided-by-the-owner): service projects always run in Docker |
7
7
| Spec |[service-projects](../specs/service-projects.md). The bank projects' behavior stays in [problem-format](../specs/problem-format.md#project-problems), [runners](../specs/runners.md#project-jobs), [authoring](../specs/authoring.md#project-problems), [cli](../specs/cli.md#cstudy-submit), [installation-and-workspaces](../specs/installation-and-workspaces.md#project-folders) and [web-ui](../specs/web-ui.md#file-api-rules), each of which points to it |
8
8
| Supersedes in part |[ADR 0014](0014-project-problems.md): for service projects only, the rejection of a venv or `node_modules` per project and of test tools that need a network install. Existing problems do not change |
@@ -113,7 +113,7 @@ Added with O15, for the same confirmation:
113
113
| # | Recommendation | Alternative | Trade-off |
114
114
|---|----------------|-------------|-----------|
115
115
| R23 | Hardening of every container cstudy generates: non-root (your UID on Linux), `cap_drop: ALL`, `no-new-privileges`, a read-only root filesystem plus tmpfs, memory and pids limits, a cap on each container's log, the Docker socket never mounted, and an explicit environment only, so nothing from your machine leaks in, especially real API keys. Problem-owned services get the limits and `no-new-privileges`, since an engine such as Postgres needs its own user and writable paths | Docker's defaults | The limits also protect a small machine from runaway memory. A read-only root breaks a tool that writes outside the project and tmpfs, which the spike looks for |
116
-
| R24 | Network. `install` may use the internet, and P1 measured that it also reaches your LAN and this machine's loopback services (the [limit](#honest-limits)); `run` and `test` have no egress. P1 confirmed the catch: a service only on an `internal: true` network publishes nothing, and `docker compose port` says `:0` with exit 0. So a small forwarder container joins both an `internal` network and an ordinary one. It holds no user code and publishes on `127.0.0.1` with a dynamic host port: your app's port and, for the grader alone, the token-protected mock server control port | A grader inside the network, which needs no control port on your machine but puts cases in a container | The forwarder keeps hidden cases on your machine at the cost of one small container per stack. "Only the app's port is published" holds for what a learner uses; the control port is the one exception, and a grader inside the network would remove it |
116
+
| R24 | Network. `install` may use the internet, and P1 measured that it also reaches your LAN and this machine's loopback services (the [limit](#honest-limits)); `run` and `test` have no egress. P1 confirmed the catch: a service only on an `internal: true` network publishes nothing, and `docker compose port` says `:0` with exit 0. So a small forwarder container joins both an `internal` network and an ordinary one. It holds no user code and publishes on `127.0.0.1` with a dynamic host port: your app's port and, for the grader alone, the token-protected mock server control port. On Linux the bridge of an `internal` network holds its gateway address, which is this machine's, and through it a container reaches every service listening on all of this machine's addresses, `sshd` among them. So `sandbox`'s bridge gets no address (`com.docker.network.bridge.inhibit_ipv4`), and D11 probes the gateway of each of the stack's networks | A grader inside the network, which needs no control port on your machine but puts cases in a container | The forwarder keeps hidden cases on your machine at the cost of one small container per stack. "Only the app's port is published" holds for what a learner uses; the control port is the one exception, and a grader inside the network would remove it |
117
117
| R25 | One mock container: a pinned Python image, with cstudy's mock server code mounted read-only from cstudy and the configs mounted read-only. Each mock server's name is a network alias of that container, and the process picks the mock server from the request's `Host`, so every one answers on port 8080 at its own name | One container per mock server | One process costs less memory and keeps one control interface. A client that rewrites `Host` gets a clear 404. Several containers isolate a crash, which a stateless server hardly needs |
118
118
| R26 | No starter holds a `.env`, and S15 refuses one. `cstudy` writes it into the project folder from `project.env` when it copies the starter: the app's port, stable URLs and fake keys, so the manifest is the only source and nothing is repeated. Once written it is tracked, hashed and archived like any file. The app container's environment is `project.env` plus a few fixed variables. `.env.local` is dropped: with fixed values and no secrets you edit `.env` itself. Changed at P7 from a committed starter file that S19 compared with the manifest, against the owner's rule that no `.env` is committed | A committed `.env`, or keeping `.env.local`| A committed copy breaks that rule and repeats the manifest; a second file would hide nothing and cost hash and archive rules |
119
119
| R27 | Per-language toolchain images, named in `project.image`, pinned by digest and pulled on demand, shown in the requirements list before download. Pin the multi-architecture index so macOS on arm64 and Linux on amd64 share one pin. The host needs no Node, uv or JDK for a service project. P1 settled it: no image of cstudy's own, `node:24-slim` with `corepack pnpm`, and the uv image for Python | Images built locally on start | Building needs a registry and a Dockerfile anyway, and costs minutes |
Copy file name to clipboardExpand all lines: docs/roadmap.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -192,7 +192,7 @@ The pilots are written with the next project problems.
192
192
193
193
**Exit criteria.** A step ends when its [checks](specs/service-projects.md#checks) pass and, for a problem, `cstudy verify <slug> --require-ready` exits 0 and a manual run through all its levels works, from `cstudy start` to `cstudy done`.
194
194
195
-
-[x] P1: the spike, passed with changes on macOS; [Linux stays unproven](specs/service-projects.md#unproven-on-linux) until the `sandbox` CI job runs.
195
+
-[x] P1: the spike, passed with changes on macOS; the sandbox is [measured on Linux](specs/service-projects.md#on-linux), with SELinux and rootless Docker unproven.
196
196
-[x] P2: the environment allowlist, for every problem ([Process environment](specs/runners.md#process-environment)).
197
197
-[x] P3 to P6: tooling: the sandbox, the lifecycle commands, the mock server, `cstudy dev` and the HTTP grader, with `verify` and a CI job on a real engine. Planned with P9: the other flags of `cstudy dev`, and `cstudy test --events`.
Copy file name to clipboardExpand all lines: docs/specs/service-projects.md
+17-9Lines changed: 17 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Spec: Service projects
2
2
3
-
**Status: built through P7: the sandbox, the lifecycle commands, the mock server, the HTTP grader and `cstudy dev`, so a service project works from `cstudy start` to `cstudy submit`, on macOS with Docker Desktop, and the first catalog problem, [`coworking-availability-typescript`](#the-first-problem), uses them. What is still planned says so where it stands: the Python version (P8), backing services (P10), code intelligence and the Web UI (P9), and parallel and multi-step cases (P10, P11).** A service project is a [project problem](problem-format.md#project-problems) where you build a small running service: `cstudy` runs your app in a Docker sandbox, with mock servers for third-party APIs and, where the problem declares them, backing services, and judges it by what it answers over HTTP. Decision record: [ADR 0019](../decisions/0019-service-projects.md), which tags each decision by who made it. Items marked R*n* there are recommendations confirmed when their phase starts. Phases P*n* are the ADR's. Existing problems, the bank projects included, stay native, need no Docker and do not change.
3
+
**Status: built through P7: the sandbox, the lifecycle commands, the mock server, the HTTP grader and `cstudy dev`, so a service project works from `cstudy start` to `cstudy submit`, on macOS with Docker Desktop and [on Linux](#on-linux) with Docker Engine, and the first catalog problem, [`coworking-availability-typescript`](#the-first-problem), uses them. What is still planned says so where it stands: the Python version (P8), backing services (P10), code intelligence and the Web UI (P9), and parallel and multi-step cases (P10, P11).** A service project is a [project problem](problem-format.md#project-problems) where you build a small running service: `cstudy` runs your app in a Docker sandbox, with mock servers for third-party APIs and, where the problem declares them, backing services, and judges it by what it answers over HTTP. Decision record: [ADR 0019](../decisions/0019-service-projects.md), which tags each decision by who made it. Items marked R*n* there are recommendations confirmed when their phase starts. Phases P*n* are the ADR's. Existing problems, the bank projects included, stay native, need no Docker and do not change.
4
4
5
5
## Names
6
6
@@ -14,7 +14,7 @@ A service project is `kind: project` with `project.grading: http`. The name is n
14
14
15
15
## Sandbox
16
16
17
-
Service projects always run in Docker, as their sandbox (owner, O15). Per-project dependencies mean running third-party code and install scripts, and security catalog starters contain deliberate flaws, so an unfixed SSRF starter could otherwise reach your LAN or a cloud metadata endpoint. Docker gives a boundary at the project folder: nothing above it is visible. The [P1 spike](../decisions/0019-service-projects.md#the-p1-spike) measured this section on macOS with Docker Desktop, and what it could not measure on Linux stays [unproven](#unproven-on-linux).
17
+
Service projects always run in Docker, as their sandbox (owner, O15). Per-project dependencies mean running third-party code and install scripts, and security catalog starters contain deliberate flaws, so an unfixed SSRF starter could otherwise reach your LAN or a cloud metadata endpoint. Docker gives a boundary at the project folder: nothing above it is visible. The [P1 spike](../decisions/0019-service-projects.md#the-p1-spike) measured this section on macOS with Docker Desktop, and [On Linux](#on-linux) says what is measured on Linux and what stays unproven.
18
18
19
19
It runs on your own Docker, which you use for other things. cstudy never changes, requires changing, or recommends changing an engine setting; its limits are per container, on its own stacks only; and it never stops the engine (owner, O16).
20
20
@@ -47,7 +47,7 @@ cstudy generates the compose file, `.cs/runs/<run>/stack.yaml`, and merges the p
47
47
48
48
| Network | Who | Egress |
49
49
|---------|-----|--------|
50
-
|`sandbox` (`internal: true`) | Everything in the stack | None: `bootstrap`, `run`, `test`, `reset` and `grade_setup` cannot reach the internet, your LAN or a metadata address. DNS is no way out either, as measured on Engine 29: the engine's name server answers an outside name with `SERVFAIL` in under 0.2 ms, where an ordinary bridge takes about 30 ms to ask upstream, and `host.docker.internal` resolves to nothing and the addresses behind it are unreachable, so D11 probes addresses alone |
50
+
|`sandbox` (`internal: true`) | Everything in the stack | None: `bootstrap`, `run`, `test`, `reset` and `grade_setup` cannot reach the internet, your LAN, a metadata address or your machine. DNS is no way out either, as measured on Engine 29: the engine's name server answers an outside name with `SERVFAIL` in under 0.2 ms, where an ordinary bridge takes about 30 ms to ask upstream, and `host.docker.internal` resolves to nothing and the addresses behind it are unreachable, so D11 probes addresses alone. Its bridge holds no address (`com.docker.network.bridge.inhibit_ipv4`): an internal network's bridge otherwise holds its gateway address, and on Linux a container reaches every service listening on all of your machine's addresses through it, `sshd` among them. Its containers still reach each other|
51
51
|`edge` (an ordinary bridge) |`cstudy-forward` only | Holds no user code |
52
52
| An ordinary bridge, `egress`|`install` containers (and `cstudy dev --exec --network`, planned) only, with no mock server or service attached | Yes, and P1 measured that it reaches your LAN and this machine's loopback services too |
53
53
@@ -914,7 +914,7 @@ If a terminal holds the dev stack, the page shows that and does not start a seco
914
914
| D3 (changed) | The reference passes every HTTP case through the [graded run](#graded-run), as the starter with its overlay |
915
915
| D9 (changed) | The reference: `commands.test`exits 0, and the visible cases pass. No generated test files exist |
916
916
| D7 (extended) | Planned with parallel cases, P10: a broken overlay passes every sequential case and fails each parallel case in its `caught_by` |
917
-
| D11 (new) | `install` leaves the lock's digest unchanged; `bootstrap` succeeds from empty and twice in a row; three runs of the reference give the same verdicts; the slowest case stays within 50% of its hang guard; the install is within 25% of `requires.sizes.install_mb`; a probe on `sandbox` reaches no public, LAN or metadata address. Outside NFR-3's 30 s per problem, as D6, D7 and D10 are |
917
+
| D11 (new) | `install` leaves the lock's digest unchanged; `bootstrap` succeeds from empty and twice in a row; three runs of the reference give the same verdicts; the slowest case stays within 50% of its hang guard; the install is within 25% of `requires.sizes.install_mb`; a probe on `sandbox` reaches no public, LAN or metadata address, and not your machine at the gateway of any of the stack's networks, on ports 22, 80 and 443, where a refusal counts as reaching it. Outside NFR-3's 30 s per problem, as D6, D7 and D10 are |
918
918
919
919
Without a usable engine, `cstudy verify` skips a service project with the reason, as a JDK out of range does, and `--require-ready` counts that as not passed. `--static` asks the engine nothing.
920
920
@@ -935,16 +935,24 @@ The [ready rules](authoring.md#ready-criteria) can be met with these changes:
935
935
936
936
`cli/tests/fixtures/service_projects/` holds two working problems, one in TypeScript and one in Python, for the tests on a real engine. They are the smallest that use everything built: a mock server, `bootstrap`, `reset`, levels, hidden cases with the 429 scenario, a reference and a naive solution that a hidden case catches. They are no catalog problems.
937
937
938
-
## Unproven on Linux
938
+
## On Linux
939
939
940
-
Nothing here has run on Linux. The `sandbox` CI job is what will show it, on its first push. What may differ:
940
+
Measured on Linux Mint 22.3, kernel 7.0.0-34-generic, Docker Engine 29.8.1 with its iptables firewall and AppArmor, x86_64: by the tests on a real engine, and with the first catalog problem through `cstudy start`, `cstudy dev`, `cstudy test`, `cstudy submit` and `cstudy start --fresh`.
941
+
942
+
| Item | Measured |
943
+
|------|----------|
944
+
| `internal: true`, the forwarder, the egress probe | From the app and the mock server on `sandbox`, in a dev, a test and a graded stack: no public, LAN, VPN or metadata address, no other bridge's gateway, no outside name, no `host.docker.internal`, and, with the bridge holding no address, no service of your machine's ([Networks](#networks)). The forwarder publishes on `127.0.0.1` only |
945
+
| Hardening | Your UID, every capability set empty with `NoNewPrivs`, AppArmor's `docker-default` profile enforced, a read-only root, and the pids limit refusing a fork past it |
946
+
| File ownership | What `install` and the app write in the project folder, a named pipe and a link included, and the data volume belong to your UID and group, never root. `cstudy submit` hashes the folder, `--fresh` archives it, and you can remove it |
947
+
948
+
What stays unproven on Linux:
941
949
942
950
| Item | Why |
943
951
|------|-----|
944
-
| `internal: true`, the forwarder, the egress probe | A real firewall on the host in place of Docker Desktop's proxy. Whether a sandbox container reaches the host at its bridge address needs its own probe |
945
-
| `host.docker.internal` | Not defined by default on Linux, so what `install` reaches there differs |
946
-
| File ownership | **The biggest gap**, because Docker Desktop hides it: UIDs are real on Linux, for the tmpfs options, the one-off `chown`, setuid bits, and whatever a root one-off leaves in the project. Clearing a setuid bit changes a mode without following a link, which an older glibc cannot do: the bit then stays |
947
952
| SELinux labels, rootless Docker | Not exercised |
953
+
| `host.docker.internal` | Not defined by default on Linux, so what `install` reaches there differs |
954
+
| IPv6 on new networks | An engine set to give new networks IPv6 gives `sandbox`'s bridge an IPv6 address, which `inhibit_ipv4` does not take away. Not exercised |
955
+
| Setuid bits | Clearing one changes a mode without following a link, which an older glibc cannot do: the bit then stays. Not exercised |
948
956
| Starting the engine, and the "no permission" state | `systemctl` and a printed `sudo` command are untested |
0 commit comments