Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Container create: default-deny HostConfig, validate Mounts and the bind read-only mode

クローズ
#88 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #92 @abienkowski による — マージ済み

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
15/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
docker, go, rust, typescript
領域
api, security

調査の方向性

Start with the POST /containers/create middleware in go/internal/middleware/mountsource.go and containerconfig.go, then the matching files in rs/src/middleware.rs and ts/src/middleware.ts. The issue asks for a default-deny allowlist on HostConfig, a Mounts check that matches the Binds whitelist, bind-mode parsing for read_write, and forcing Privileged to false even when container_config is empty. Done means the three repro creates return 403 in each implementation, and the policy tests cover the new rules. The issue is a breaking security change that needs maintainer agreement on the allowlist first.

索引モデルが issue の本文から書いたものです。

説明

Priority: P0 Status: Break Change Type: Bug

Describe the bug

On POST /containers/create, the proxy checks only part of the request. Every other field goes to the daemon unchanged:

  • The volume whitelist checks the host path of HostConfig.Binds and the legacy top-level Volumes. It does not check HostConfig.Mounts.
  • The bind mode is not checked. read_write: false is parsed in all three implementations, but no gate reads it.
  • ContainerConfigMutator overwrites NetworkMode, RestartPolicy, SecurityOpt, Privileged, User and LogConfig. If container_config is empty, it returns early and does not even force Privileged: false.
  • Other HostConfig fields pass through: Devices, DeviceRequests, DeviceCgroupRules, GroupAdd, CapAdd, VolumesFrom, Links, Sysctls, CgroupParent, Runtime, the host values of PidMode, IpcMode, UTSMode, UsernsMode and CgroupnsMode, MaskedPaths/ReadonlyPaths, and SecurityOpt when the policy sets none.

So every policy-level restriction on mounts and privileges can be bypassed by a caller of the socket.

Affected implementation(s)

  • Go
  • Rust
  • TypeScript
  • All

Go go/internal/middleware/mountsource.go (Binds host path only), go/internal/middleware/containerconfig.go:13 (early return). Rust rs/src/middleware.rs and TypeScript ts/src/middleware.ts have the same gaps.

To Reproduce

Policy with volumes: [{host_path: /srv/ok, container_path: /ok, read_write: false}]. Through the proxy, each of these creates is accepted and the daemon receives the field unchanged:

  1. docker create --mount type=bind,src=/,dst=/host alpine:3.20 true
  2. docker create -v /srv/ok:/ok:rw alpine:3.20 true (also -v /srv/ok:/ok with no mode)
  3. docker create --cap-add SYS_ADMIN --pid host alpine:3.20 true

Expected behavior

Default-deny on HostConfig:

  1. A HostConfig key outside a fixed allowlist must be absent or hold its zero value. Otherwise the proxy returns 403 and names the field. A denylist would miss fields that the Engine API adds later.
  2. HostConfig.Mounts gets the same whitelist as Binds. bind mounts must match a policy volume, with ReadOnly: true if the volume is not read_write. volume mounts and all other types except tmpfs are denied.
  3. Each bind mode is parsed. A volume with read_write: false requires ro.
  4. The mutator forces Privileged: false even if container_config is empty. SecurityOpt from the caller is denied unless the policy lists it, apart from no-new-privileges.

Status: Break Change: creates that set these fields are now denied.

Additional context

Found while verifying the proxy for ChainSafe/lodestar-infrastructure#9.

主要言語
Rust
スター
2
フォーク
0
平均マージ
12時間 11分
マージ済み PR(30日)
30

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

ChainSafe/docker-socket-policy のほかの issue

ChainSafe/docker-socket-policy の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。