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 2bdc552
Browse filesBrowse the repository at this point in the historyBrowse files
fix: enforce --readonly in the router for every write (#75) (#77)
* spec: model --readonly as a router rule (#75)
* test: pin --readonly as a router rule in all three (#75)
* fix: enforce --readonly in the router for every write (#75)
* docs: note the attach gap and tidy the read-only docs (#75)
-`middleware/` — Gate trait + Chain: RegistryGate, MountSourceGate, EnvFileGate, CmdGate, ContainerConfigMutator (`--readonly` and exec are denied by the router)
31
31
-`proxy/` — Router (default-deny), Handler (orchestrates chain), Transport (forwards to Docker socket)
- Integration, per implementation: 50 tests via deploy/test.sh and 15 socket tests via deploy/test-sock.sh (docker-compose)
46
+
- Quint: `make test-spec` runs the `spec/listener.qnt``run` tests (instances `listener_locked`, `listener_unlocked`) and the `spec/router.qnt``run` tests (instances `router`, `router_pre48`, `router_pre53`, `router_pre55`, and `router_readonly`, whose `readonly*` tests run with `--match`)
Copy file name to clipboardExpand all lines: README.md
+10-8Lines changed: 10 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,9 +10,9 @@ A validating Docker API proxy that enforces **per-service container policies** t
10
10
Key features:
11
11
12
12
-**Policy-driven**: Per-service YAML policies, selected by image name, control images, volumes, flags, and env vars. The listening socket is the trust boundary: every caller of a socket can use every policy behind it (see [Trust model](#trust-model))
| ReadonlyGate | Gate | Denies `POST`, `PUT`, `DELETE`, `PATCH` (optional `--readonly` flag). Like every gate it runs only on container create, so lifecycle actions and `DELETE` are not blocked yet ([#75](https://github.com/ChainSafe/docker-socket-policy/issues/75)) |
197
196
| RegistryGate | Gate | Validates image ref against `allowed_image_prefixes`|
| EnvFileGate | Gate | Strips `Env` field from create body; env must come from locked `env_file`|
200
199
| CmdGate | Gate | Validates each CLI flag in `Cmd` array against allowlist + denylist |
201
200
201
+
The chain runs only on container create. `--readonly` is not a gate: the router denies every request that is not `GET` or `HEAD`, on every path, before any other check ([#75](https://github.com/ChainSafe/docker-socket-policy/issues/75)). A websocket attach (`GET /containers/{name}/attach/ws` with `Upgrade`) is a `GET` and is not denied yet; the Go proxy lets it write to a container's stdin ([#76](https://github.com/ChainSafe/docker-socket-policy/issues/76)).
202
+
202
203
## Endpoint Access
203
204
204
205
| HTTP Method | Path | Action |
205
206
|-------------|------|--------|
207
+
| Not GET/HEAD | Any (with `--readonly`) |**DENIED** (checked first) |
206
208
| Any | Path containing `%`|**DENIED** (see below) |
207
209
| Any | Path containing `//`|**DENIED**|
208
210
| POST |`/containers/create`| Validated by middleware chain |
@@ -232,7 +234,7 @@ Exec is matched on whole path segments, so containers named like `exec-runner` w
|`--readonly`|`false`| Enable read-only mode: the router denies every request that is not `GET` or `HEAD`|
236
238
|`--listen-socket-group`|`docker-socket-policy`| Group owning the socket (default `docker-socket-policy`; `""` = the proxy's own group) |
237
239
238
240
> **Unix socket security boundary**: the proxy listens on a Unix socket only,
@@ -439,7 +441,7 @@ not at the socket.
439
441
440
442
## Formal Verification
441
443
442
-
This project includes a [Quint](https://quint-lang.org/) formal specification that models the security invariants as a state machine. Random-simulation verification runs 10,000 sampled traces of up to 100 steps each, checking all 9 invariants on every state transition. A second module, `spec/listener.qnt`, models listening-socket startup (group selection, existing-path checks, the single-instance lock) with 6 more invariants. A third module, `spec/router.qnt`, models the router's denies for percent-encoded paths ([#53](https://github.com/ChainSafe/docker-socket-policy/issues/53)), empty interior segments ([#55](https://github.com/ChainSafe/docker-socket-policy/issues/55)) and exec ([#49](https://github.com/ChainSafe/docker-socket-policy/issues/49)), the `POST /containers/create` route, container-name extraction and the container-lifecycle branch, not the full routing table ([#24](https://github.com/ChainSafe/docker-socket-policy/issues/24), [#48](https://github.com/ChainSafe/docker-socket-policy/issues/48)). Its 7 properties are checked exhaustively over the methods `GET`, `HEAD`, `POST`, `DELETE` and every path of 1 to 3 segments over the model's word set; exec is denied by the router, not by a middleware gate.
444
+
This project includes a [Quint](https://quint-lang.org/) formal specification that models the security invariants as a state machine. Random-simulation verification runs 10,000 sampled traces of up to 100 steps each, checking all 9 invariants on every state transition. A second module, `spec/listener.qnt`, models listening-socket startup (group selection, existing-path checks, the single-instance lock) with 6 more invariants. A third module, `spec/router.qnt`, models the router's denies for writes under `--readonly` ([#75](https://github.com/ChainSafe/docker-socket-policy/issues/75)), percent-encoded paths ([#53](https://github.com/ChainSafe/docker-socket-policy/issues/53)), empty interior segments ([#55](https://github.com/ChainSafe/docker-socket-policy/issues/55)) and exec ([#49](https://github.com/ChainSafe/docker-socket-policy/issues/49)), the `POST /containers/create` route, container-name extraction and the container-lifecycle branch, not the full routing table ([#24](https://github.com/ChainSafe/docker-socket-policy/issues/24), [#48](https://github.com/ChainSafe/docker-socket-policy/issues/48)). Its 8 properties are checked exhaustively over the methods `GET`, `HEAD`, `POST`, `DELETE` and every path of 1 to 3 segments over the model's word set; exec is denied by the router, not by a middleware gate.
443
445
444
446
The CI pipeline runs verification on every push and PR. A violation blocks the build.
0 commit comments