Skip to content

fix(bicep): emit sandbox egress parameters from the PowerShell assembler - #374

Open
jlinenkohl wants to merge 1 commit into
microsoft:mainfrom
jlinenkohl:fix-ps-assembler-egress
Open

jlinenkohl wants to merge 1 commit into
microsoft:mainfrom
jlinenkohl:fix-ps-assembler-egress

Conversation

@jlinenkohl

Copy link
Copy Markdown

bicep/assemble-agent.sh passes seven egress parameters to the template -- egressMode, allowedHosts, allowedRegistries, allowedCodeRepositories, allowHttpMcpServerNetworkAccess, usePrivateDnsResolution and vnetSubnetId -- reading each from .networkConfiguration in agent.json.

bicep/Assemble-Agent.ps1 emits none of them. A clone taken through the PowerShell path therefore cannot inherit its source's egress configuration at all: whatever the export contains, the deployment falls back to the template default. Cloning an agent running Limited behind a 13-host allowlist produced parameters of egressMode null with an empty host list.

This is the mirror of the two bash-side divergences fixed earlier in this series. Each implementation is ahead of the other in different places, so the fix in both directions is to adopt what the other already does.

Properties are probed rather than dereferenced because the script runs under StrictMode and an export predating the networkConfiguration key would otherwise throw.

Verified against an export of an agent running Limited: the assembled parameters now carry egressMode Limited, 13 allowed hosts, 4 registries and 3 code-repository kinds.

bicep/assemble-agent.sh passes seven egress parameters to the template --
egressMode, allowedHosts, allowedRegistries, allowedCodeRepositories,
allowHttpMcpServerNetworkAccess, usePrivateDnsResolution and vnetSubnetId --
reading each from .networkConfiguration in agent.json.

bicep/Assemble-Agent.ps1 emits none of them. A clone taken through the
PowerShell path therefore cannot inherit its source's egress configuration at
all: whatever the export contains, the deployment falls back to the template
default. Cloning an agent running Limited behind a 13-host allowlist produced
parameters of egressMode null with an empty host list.

This is the mirror of the two bash-side divergences fixed earlier in this
series. Each implementation is ahead of the other in different places, so the
fix in both directions is to adopt what the other already does.

Properties are probed rather than dereferenced because the script runs under
StrictMode and an export predating the networkConfiguration key would otherwise
throw.

Verified against an export of an agent running Limited: the assembled
parameters now carry egressMode Limited, 13 allowed hosts, 4 registries and
3 code-repository kinds.
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