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

Policy is selected from the request body, not the caller: "per-service" enforcement has no caller identity

Aperta
#39 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
45/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
docker, go, linux, rust, typescript

Direzione di ricerca

The issue is about authenticating callers via Unix socket peer credentials (SO_PEERCRED/LOCAL_PEERCRED) to enforce per-service policies. Start by examining the proxy's router in go/internal/proxy/router.go:116 where policy is currently selected by image name. Review the Quint spec in spec/docker_socket_policy.qnt:211 to understand the model. Look for existing socket handling code across go/, rs/src/, and ts/src/ to see where peer credentials could be read. 'Done' means the proxy selects policy based on caller identity, not request body, and the spec is updated accordingly.

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

Descrizione

Priority: P2 Type: Enhancement

Is your feature request related to a problem?

The proxy is described as enforcing "per-service policies" (README.md:8), but it never establishes which service is calling. Policy is selected from attacker-controlled request content, so the per-service framing does not hold at the enforcement layer.

Policy selection for container creation is by image name (go/internal/proxy/router.go:116):

p, err := r.manager.GetByImage(image)   // image comes from body["Image"]

The Quint spec models the same thing faithfully (spec/docker_socket_policy.qnt:211):

nondet matched = oneOf(policies.filter(p => imageNameAllowed(imageRef.imageName, p)))

So spec and implementation agree — there is no divergence to fix. The gap is that neither models a caller at all. A search across go/, rs/src/ and ts/src/ for SO_PEERCRED, getpeereid, ucred, peer_cred and LOCAL_PEERCRED returns zero hits: nothing reads the peer credentials the Unix socket makes available.

The consequence: every caller of a given socket shares one trust domain. Any client that can connect can act under any policy in that proxy's --config-dir, simply by naming that policy's image. A CI runner authorised for ci.yaml can create a container under beacon.yaml's policy — inheriting its volume allow-list, its networkMode: host, and its env_file — by asking for chainsafe/lodestar.

This was surfaced while reviewing #35. Removing the TCP listener there is still correct and still an improvement: reaching the proxy now requires socket-level authorisation rather than the ability to open a port. But it grants access to the whole proxy, not to one service's policy, and #38 has been corrected to say so rather than implying isolation that does not exist.

Describe the solution

Decide and document what the trust boundary actually is. Roughly in increasing order of cost:

  1. Document the current model and make it the supported one. One proxy instance per service, each with its own socket and a --config-dir holding only that service's policy. This is already what deploy/docker-compose.sock.yml gestures at with separate proxy-granted / proxy-denied instances. Cheapest, and arguably the honest reading of the design; needs README changes and probably a deployment example.
  2. Authenticate the caller from peer credentials. Read SO_PEERCRED (Linux) / LOCAL_PEERCRED (BSD) on accept, map uid/gid to a service, and select the policy from that identity instead of from the body — falling back to deny. Gives real per-service enforcement on a single socket, and would let serviceName enter the Quint spec as a genuine input rather than a derived field.
  3. Socket-per-service on one proxy. Bind several listening sockets, each owned by a different group and pinned to one policy. Avoids per-process overhead while keeping kernel-enforced separation.

Option 2 is the only one that makes "per-service policy" true as written on a shared socket, and it is the one that would require a spec change: createContainer would take the caller identity as a parameter, and an invariant along the lines of "a container's serviceName equals the authenticated caller's service" becomes expressible. Today that invariant cannot even be stated, because the model has no caller.

Describe alternatives

  • Treat image-based selection as sufficient. Rejected as a silent default: it is defensible only when a proxy serves exactly one policy, which is neither enforced nor documented today.
  • Have callers pass a service name header. Rejected: it is as attacker-controlled as the image field, so it changes nothing about the trust model.

Which implementation(s) would this affect?

  • Go
  • Rust
  • TypeScript
  • Quint specification
  • All

Scope depends on which option is chosen; option 1 is documentation only, options 2 and 3 touch all three implementations and the spec.

Additional context

Not a regression — this predates #35 and is unchanged by it. Filed separately so the transport change can land on its own.

README.md:8 ("per-service policies") and README.md:12 ("Per-service YAML policies") should be revisited once the model is settled; the note added in #38 currently carries the correction.

Lingua principale
Rust
Stelle
2
Fork
0
Merge medio
9h 35m
PR unite (30g)
6

Guida per i contributori

Apri la guida per i contributori

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.