Container create: default-deny HostConfig, validate Mounts and the bind read-only mode
メンテナーはふだん 1 日以内に返信
関連するプルリクエストがすでにマージされています。
- #92 @abienkowski による — マージ済み
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 15/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- docker, go, rust, typescript
調査の方向性
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 の本文から書いたものです。
説明
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.Bindsand the legacy top-levelVolumes. It does not checkHostConfig.Mounts. - The bind mode is not checked.
read_write: falseis parsed in all three implementations, but no gate reads it. ContainerConfigMutatoroverwritesNetworkMode,RestartPolicy,SecurityOpt,Privileged,UserandLogConfig. Ifcontainer_configis empty, it returns early and does not even forcePrivileged: false.- Other
HostConfigfields pass through:Devices,DeviceRequests,DeviceCgroupRules,GroupAdd,CapAdd,VolumesFrom,Links,Sysctls,CgroupParent,Runtime, thehostvalues ofPidMode,IpcMode,UTSMode,UsernsModeandCgroupnsMode,MaskedPaths/ReadonlyPaths, andSecurityOptwhen 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:
docker create --mount type=bind,src=/,dst=/host alpine:3.20 truedocker create -v /srv/ok:/ok:rw alpine:3.20 true(also-v /srv/ok:/okwith no mode)docker create --cap-add SYS_ADMIN --pid host alpine:3.20 true
Expected behavior
Default-deny on HostConfig:
- A
HostConfigkey outside a fixed allowlist must be absent or hold its zero value. Otherwise the proxy returns403and names the field. A denylist would miss fields that the Engine API adds later. HostConfig.Mountsgets the same whitelist asBinds.bindmounts must match a policy volume, withReadOnly: trueif the volume is notread_write.volumemounts and all other types excepttmpfsare denied.- Each bind mode is parsed. A volume with
read_write: falserequiresro. - The mutator forces
Privileged: falseeven ifcontainer_configis empty.SecurityOptfrom the caller is denied unless the policy lists it, apart fromno-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
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
ChainSafe/docker-socket-policy のほかの issue
-
Type: Feature
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
ChainSafe/docker-socket-policy#96 ·
メンテナーはふだん 1 日以内に返信
-
Priority: P3 Type: Enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 15/100
ChainSafe/docker-socket-policy#95 ·
メンテナーはふだん 1 日以内に返信
-
Type: Feature
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
ChainSafe/docker-socket-policy#65 ·
メンテナーはふだん 1 日以内に返信
-
Type: Enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 38/100
ChainSafe/docker-socket-policy#46 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
ChainSafe/docker-socket-policy の issue をすべて見る
似ている issue
-
corro-client drops the last byte of a response line that has no trailing newline対応中かも @RaphaelFakhri が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
-
proxy: include denial_category in the "proxy request denied" log line対応中かも @sreyas-endor が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
nolabs-ai/nono#2172 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
metasequoiaime/msime#9113 ·
メンテナーはふだん 1 日以内に返信
-
area:desktop priority:p2 type:chore
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
area: supply-chain
難易度 1/5 1時間未満 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信