Non-deterministic wildcard secret selection

未关闭
#723 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

  • #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 分钟
30 天内合并 PR
33

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

docker/secrets-engine 的其他 Issue

查看 docker/secrets-engine 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。