Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Lifecycle actions and DELETE are allowed on containers that no policy covers

Chiusa
#86 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Una pull request collegata è già stata integrata.

  • #90 di @abienkowski — integrata

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
docker, go, rust, typescript

Direzione di ricerca

Start with routeByContainerName in go/internal/proxy/router.go (lines 158-170), where a failed manager.Get(name) still returns ActionAllow; the Rust and TypeScript routers have the same branch. The spec/README.md rows realNameDeleteAllowed, execPrefixNameStartAllowed and execPrefixNameDeleteAllowed pin the current behavior. Done means unknown targets return 403 across all three implementations, the tests and Quint model match, and open design questions are settled. PR #90 is already open against this issue, so check it before starting.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Priority: P1 Status: Break Change Type: Bug

Describe the bug

The proxy forwards start, stop, restart, kill, wait, pause, unpause and DELETE for any container name, including names that no loaded policy covers. The README says these endpoints are "Allowed on known containers" (README routing table, lines 214-215). The code, the tests and the Quint router model all allow unknown containers on purpose (spec/README.md row realNameDeleteAllowed: "allow (unknown container)"). So the README and the implementation disagree.

The effect: every caller of a socket can stop or delete every container on the host, not only the containers its policies describe. On a host that also runs operator containers (monitoring, Watchtower, log shippers), a contributor can stop or remove them. The trust model bounds a caller to the union of the socket's policies. Containers outside every policy are outside that union, so this is wider than the documented trust boundary.

Affected implementation(s)

  • Go
  • Rust
  • TypeScript
  • All

Go go/internal/proxy/router.go routeByContainerName (lines 158-170): if manager.Get(name) fails, it still returns ActionAllow. Rust and TypeScript have the same branch, and their router tests assert it.

To Reproduce

  1. Policy:

    service_name: beacon
    allowed_image_prefixes: [chainsafe/lodestar]
    
  2. Directly on the daemon (not through the proxy): docker run -d --name dsp-monitoring alpine:3.20 sleep 1d

  3. With DOCKER_HOST pointed at the proxy socket, run each command:

    Command Container state after Audit log
    docker stop -t 1 dsp-monitoring exited POST /v1.56/containers/dsp-monitoring/stop?t=1 ALLOW
    docker start dsp-monitoring running POST /v1.56/containers/dsp-monitoring/start ALLOW
    docker kill <full 64-hex id> exited POST /v1.56/containers/f4b4ac3e…fee2/kill ALLOW
    docker rm dsp-monitoring removed DELETE /v1.56/containers/dsp-monitoring ALLOW

    I expected 403 for each.

Expected behavior

Default-deny, the same as the rest of the router: forward a lifecycle action or DELETE only if the target belongs to a loaded policy. Otherwise return 403.

Points to decide:

  1. How a target matches a policy. Today manager.Get(name) matches on service_name. After #85, container_names is the better key, because one image can serve several names.
  2. Container IDs. Callers often use an ID instead of a name, and Ansible community.docker does. The proxy needs to resolve the ID to a name (one GET /containers/{id}/json to the daemon) before it decides.
  3. Test rows. realNameDeleteAllowed, execPrefixNameStartAllowed and execPrefixNameDeleteAllowed change from allow to deny. The Quint router model changes too.

If allow-unknown is the intended behavior, the README routing table needs to say so, and the Trust model section needs to say that every caller can stop or delete every container on the host.

Environment

  • OS: OrbStack, Linux arm64
  • Docker version: Engine 29.8.2 (API 1.56), CLI 29
  • Implementation version/commit: v0.3.11 (3130b0a), Go docker-socket-policy-go-linux-arm64

Additional context

First seen with the request probe from ChainSafe/lodestar-infrastructure#73 (not merged), while checking the proxy design in ChainSafe/lodestar-infrastructure#9. Seven of its checks fail on this behavior. The table above is from a real daemon. A related create-time gap: a create named monitoring with an allowed image is also accepted. #85's "exactly one match, otherwise deny" closes that gap if every policy sets container_names.

Lingua principale
Rust
Stelle
2
Fork
0
Merge medio
12h 11m
PR unite (30g)
30

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ChainSafe/docker-socket-policy

Tutte le issue di ChainSafe/docker-socket-policy

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.