Non-deterministic wildcard secret selection

Aberta
#723 2 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

  • #724 de @locker95 — fechado sem integrar

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
35/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
docker, go
Domínio
backend, security

Direção de pesquisa

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.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.

Linguagem predominante
Go
Estrelas
97
Forks
23
Merge médio
2h 1min
PRs com merge (30d)
33

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de docker/secrets-engine

Todas as issues de docker/secrets-engine

Issues semelhantes

Mais issues de Go

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.