Skip to content

Build fails when shared context directory contains non-ASCII characters#3972

Open
maxproske wants to merge 1 commit into
docker:masterfrom
maxproske:sanitize-sharedkey
Open

Build fails when shared context directory contains non-ASCII characters#3972
maxproske wants to merge 1 commit into
docker:masterfrom
maxproske:sanitize-sharedkey

Conversation

@maxproske

Copy link
Copy Markdown

Initially caught by docker/compose#13965 2 Compose services sharing a build context containing Chinese characters, but after some digging, every build dialed over gRPC fails. Same as #2793 which was closed as not reproducible.

Sanitize the shared key before it reaches gRPC.

Steps to reproduce:

mkdir -p 早

docker buildx create --name repro --driver docker-container
docker buildx build --builder repro 早

docker buildx bake -f - a b <<'EOF'
target "a" { context = "早" }
target "b" { context = "早" }
EOF

docker compose -f - build <<'EOF'
services:
  a: {build: 早}
  b: {build: 早}
EOF

All 3 fail with:

failed to dial gRPC: rpc error: code = Internal desc = rpc error: code = Internal desc = header key "x-docker-expose-session-sharedkey" contains value with non-printable ASCII characters

Signed-off-by: Max Proske <max@mproske.com>
@maxproske

Copy link
Copy Markdown
Author

Newbie question: if approved, worth me guarding downstream in buildkit too?

@crazy-max crazy-max left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks but I think this should probably be fixed in BuildKit by encoding the shared key when it's put into session metadata and decoding it in the session manager, rather than hashing it in Buildx.

@crazy-max

Copy link
Copy Markdown
Member

opened moby/buildkit#6989

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants