Non-deterministic wildcard secret selection

オープン
#723 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

まだ誰も着手していません。

  • #724 @locker95 による — マージされずにクローズ

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
docker, go
領域
backend, security

調査の方向性

Read plugin.go and run.go around the “First match wins” handling, then compare how wildcard matches are selected with the sorting in testing.go. Reproduce the issue with the commands in the report; done means repeated runs consistently select the intended first match, with coverage that catches nondeterministic ordering.

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

説明

Wildcard secrets with 2+ matches randomly inject the wrong secret ~1 in 8 times.

The docs recommend a docker/db/<env>/password layout, and docker pass run --help uses se://*/password as the wildcard example and says the "first match is used".

Steps to reproduce:

docker pass set app/dev/pw=test
docker pass set app/prod/pw=qcXU9Yt7jWy0YV8FAAk1kDh89JPh4r3F

for i in $(seq 100); do docker run --rm -e DB_PASSWORD='se://app/*/pw' alpine printenv DB_PASSWORD; done
#   14 test
#   86 qcXU9Yt7jWy0YV8FAAk1kDh89JPh4r3F

Compose inherits this with --scale, or multiple deploy.replicas: with multiple environment::

cat > compose.yaml <<EOF
services:
  app:
    image: alpine
    command: printenv DB_PASSWORD
    environment:
      DB_PASSWORD: se://app/*/pw
EOF
docker compose up --scale app=100

I believe the cause is in plugin.go and run.go under a // For now: First match wins. The 1/8 split reminds me of Go's swiss-mapping on small sets, not a race condition.

Introduced by #666 (spooky!) which flagged this as a critical/high/security finding "non-deterministic secret selection"

Not caught by testing.go because it sorts the results.

主要言語
Go
スター
97
フォーク
23
平均マージ
2時間 1分
マージ済み PR(30日)
33

環境構築

はじめの一歩

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

docker/secrets-engine のほかの issue

docker/secrets-engine の issue をすべて見る

似ている issue

Go の issue をもっと見る

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

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