Skip to content

feat(windows-sandbox): add network proxy support#12220

Merged
viyatb-oai merged 6 commits intomainfrom
codex/viyatb/windows-proxy-loopback-egress
Mar 27, 2026
Merged

feat(windows-sandbox): add network proxy support#12220
viyatb-oai merged 6 commits intomainfrom
codex/viyatb/windows-proxy-loopback-egress

Conversation

@viyatb-oai
Copy link
Copy Markdown
Collaborator

@viyatb-oai viyatb-oai commented Feb 19, 2026

Summary

This PR makes Windows sandbox proxying enforceable by routing proxy-only runs through the existing offline sandbox user and reserving direct network access for the existing online sandbox user.

In brief:

  • if a Windows sandbox run should be proxy-enforced, we run it as the offline user
  • the offline user gets firewall rules that block direct outbound traffic and only permit the configured localhost proxy path
  • if a Windows sandbox run should have true direct network access, we run it as the online user
  • no new sandbox identity is introduced

This brings Windows in line with the intended model: proxy use is not just env-based, it is backed by OS-level egress controls. Windows already has two sandbox identities:

  • offline: intended to have no direct network egress
  • online: intended to have full network access

This PR makes proxy-enforced runs use that model directly.

Proxy-enforced runs

When proxy enforcement is active:

  • the run is assigned to the offline identity
  • setup extracts the loopback proxy ports from the sandbox env
  • Windows setup programs firewall rules for the offline user that:
    • block all non-loopback outbound traffic
    • block loopback UDP
    • block loopback TCP except for the configured proxy ports
    • optionally allow broader localhost access when allow_local_binding=1

So the sandboxed process can only talk to the local proxy. It cannot open direct outbound sockets or do local UDP-based DNS on its own.The proxy then performs the real outbound network access outside that restricted sandbox identity.

Direct-network runs

When proxy enforcement is not active and full network access is allowed:

  • the run is assigned to the online identity
  • no proxy-only firewall restrictions are applied
  • the process gets normal direct network access

Unelevated vs elevated

The restricted-token / unelevated path cannot enforce per-identity firewall policy by itself.

So for Windows proxy-enforced runs, we transparently use the logon-user sandbox path under the hood, even if the caller started from the unelevated mode. That keeps enforcement real instead of best-effort.

@viyatb-oai viyatb-oai changed the title fix(windows-sandbox): route offline egress via loopback proxy feat(windows-sandbox): add network proxy support Mar 3, 2026
@viyatb-oai viyatb-oai requested a review from iceweasel-oai March 3, 2026 21:22
@viyatb-oai viyatb-oai force-pushed the codex/viyatb/windows-proxy-loopback-egress branch from f3e2f3e to 0cbe0bc Compare March 11, 2026 20:30
Copy link
Copy Markdown
Collaborator

@iceweasel-oai iceweasel-oai left a comment

Choose a reason for hiding this comment

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

overall looks good.

One downside is that this will cause an unexpected elevated setup UAC prompt for all users. But that is an existing limitation where we don't have a UI treatment letting people know that they need to re-setup their sandbox.

@github-actions
Copy link
Copy Markdown
Contributor

Closing this pull request because it has had no updates for more than 14 days. If you plan to continue working on it, feel free to reopen or open a new PR.

@github-actions github-actions bot closed this Mar 26, 2026
@viyatb-oai viyatb-oai reopened this Mar 26, 2026
@viyatb-oai viyatb-oai merged commit 81fa047 into main Mar 27, 2026
60 of 63 checks passed
@viyatb-oai viyatb-oai deleted the codex/viyatb/windows-proxy-loopback-egress branch March 27, 2026 00:27
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants