Non-deterministic wildcard secret selection

Đang mở
#723 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

  • #724 của @locker95 — đã đóng, không merge

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
docker, go
Lĩnh vực
backend, security

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Go
Star
97
Fork
23
Merge trung bình
2 giờ 1 phút
Pull request đã merge (30 ngày)
33

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của docker/secrets-engine

Tất cả issue của docker/secrets-engine

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.