Allow explicitly permitted loopback proxy targets (#34603)

## Why

With `allow_local_binding = false`, proxy-aware clients bypassed the managed
proxy for loopback and private IP targets. This prevented explicit local IP and
`localhost` allowlist entries from taking effect.

## What changed

- Route local targets through the managed proxy when local binding is disabled,
  while preserving direct access when it is enabled.
- Allow a non-public connection only when its requested IP literal or
  `localhost` target is explicitly permitted. Continue blocking private
  addresses reached through unrelated hostnames.
- Bypass inherited upstream proxies for non-public targets so Codex applies the
  local-target policy directly.

## Testing

Added connector, upstream proxy, environment override, and Linux sandbox
coverage for explicitly allowlisted loopback access.

GitOrigin-RevId: 35e0d73633d5051816e096bc5aa8d586aec5eea4
This commit is contained in:
viyatb-oai
2026-07-21 19:50:11 +00:00
committed by copyberry
parent 6c00dc087e
commit 2497972808
9 changed files with 310 additions and 75 deletions
+1 -1
View File
@@ -425,7 +425,7 @@ where
}
};
let proxy = if allow_upstream_proxy {
proxy_for_connect()
proxy_for_connect(&authority)
} else {
None
};