Skip to content

fix(azure): sign build-context blob requests with the storage account's shared key - #927

Merged
e6qu merged 4 commits into
mainfrom
azure-blob-shared-key
Aug 25, 2026
Merged

fix(azure): sign build-context blob requests with the storage account's shared key#927
e6qu merged 4 commits into
mainfrom
azure-blob-shared-key

Conversation

@e6qu

@e6qu e6qu commented Aug 25, 2026

Copy link
Copy Markdown
Owner

The consumer follow-up recorded when the simulator started enforcing storage authorization: the Azure Container Registry build service reached the build-context blob container with azblob.NewClientWithNoCredential, on a comment claiming the simulator "does not enforce storage bearer auth" — no longer true, so the client would be refused at the next simulator pin bump, and it was never right against a sovereign cloud either.

The fix

ensureBlobClient now reads the storage account's key through the Azure Resource Manager (ListKeys — the way an administrator reads it, on the accounts client the service already holds) and builds the blob client with NewSharedKeyCredential. Shared-key signing works over plain HTTP, where azblob rejects bearer tokens — the same code against the simulator and the real cloud, differing only in coordinates.

Proof

A new test in backends/azure-common provisions a storage account through ARM against the pinned simulator, resolves the advertised blob endpoint, and round-trips a blob through the signed client. The blob host is a per-account name under .shim.localhost that a deployment's DNS resolves — dnsmasq in the Linux harness, systemd-resolved on CI; macOS cannot install that mapping without root, the documented host-capability skip (Linux never skips).

Bundled

  • The 39 dependency drifts the pre-push freshness gate reported (AWS SDK for Go v2, cloud.google.com/go/storage + gRPC + cloudbuild, testify, docker/setup-buildx-action). Every upgraded module builds and its tests pass.
  • The ECS terraform harness started the simulator without SIM_DNS_PORT, so the Route 53 DNS listener bound the default :5353 — mDNS, held open by desktop browsers — and the simulator refused to start on hosts with a browser running. The harness now hands it a free port, like the sockerless-cloud harnesses do.

Adrian Mârza added 4 commits August 25, 2026 10:24
…'s shared key

The Azure Container Registry build service reached the build-context
container with azblob.NewClientWithNoCredential, on a comment claiming the
simulator does not enforce storage bearer auth — no longer true, so the
client would be refused at the next simulator pin bump, and it was never
right against a sovereign cloud either. The client now reads the account
key through the Azure Resource Manager (ListKeys, the way an administrator
reads it) and signs with NewSharedKeyCredential, which works over plain
HTTP where azblob rejects bearer tokens — the same code against the
simulator and the real cloud, differing only in coordinates.

A new test provisions a storage account through ARM against the pinned
simulator and round-trips a blob through the signed client. The advertised
blob host is a per-account name under .shim.localhost that a deployment's
DNS resolves (dnsmasq in the Linux harness, systemd-resolved on CI); macOS
cannot map it without root — the documented host-capability skip. Linux
never skips.
… Route 53 DNS a free port

The pre-push freshness gate found 39 drifts: AWS SDK for Go v2 service
modules across aws-common/ecs/lambda/tests, cloud.google.com/go/storage and
gRPC across the Google Cloud backends, cloudbuild in gcp-common, testify in
the ECS terraform test module, and the docker/setup-buildx-action pin. All
upgraded modules build and their tests pass.

The ECS terraform harness started the simulator without SIM_DNS_PORT, so
the Route 53 DNS listener bound the default :5353 — mDNS, which desktop
browsers hold open — and the simulator refused to start on any host with a
browser running. The harness now hands it a free port, the same way the
sockerless-cloud test harnesses do.
The upgrade moved shared dependencies (gRPC, protobuf, genproto, x/net)
that modules beyond the freshness-flagged ones consume, and a conflicted
pre-commit stash rollback left several go.sum files without entries for
them — CI's build jobs failed on the missing sums. Every module is tidied
and builds with GOWORK=off; the freshness check stays clean.
@e6qu
e6qu merged commit a8c46da into main Aug 25, 2026
31 checks passed
@e6qu
e6qu deleted the azure-blob-shared-key branch August 25, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant