Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
6510056
feat(egress): add upstream proxy support
senamakel Nov 16, 2026
e5f116a
feat(egress): route covered destinations through upstream proxies
senamakel Nov 16, 2026
9233071
feat(egress): route browser connections through configured upstream p…
senamakel Nov 16, 2026
90b988e
feat(egress): add host-configured upstream proxy support
senamakel Nov 16, 2026
d8c2e9f
chore(browser): drop unused tokio net import and update test fixtures
senamakel Nov 16, 2026
0b77f5c
chore(egress): reformat upstream proxy code and tests
senamakel Nov 16, 2026
bf59c8b
feat(browser): support upstream proxies in egress config
senamakel Nov 16, 2026
828c010
feat(browser): expose upstream proxy error reason
senamakel Nov 16, 2026
9ff3a86
docs(browser): document upstream proxy support for egress
senamakel Nov 16, 2026
effff1e
test(tinybus_module): cover upstream proxy parsing and credential red…
senamakel Nov 16, 2026
71cdb8d
test(tinybus): simplify upstream proxy emptiness assertions
senamakel Nov 16, 2026
3ca27b6
fix(egress): pin upstream proxy tunnels to an approved destination ad…
senamakel Nov 16, 2026
24d7210
test(egress): cover tunnel pinning to an approved ipv4 address
senamakel Nov 16, 2026
8ac3e38
fix(egress): tunnel to an approved destination address instead of the…
senamakel Nov 16, 2026
89cd242
test(browser_egress): add upstream_tests module
senamakel Nov 16, 2026
f8157bf
test(browser_egress): hardcode local proxy credentials in upstream tests
senamakel Nov 16, 2026
1e04c43
style(egress): reformat ipv6 test address and drop stray brace
senamakel Nov 16, 2026
7e7a82e
test(egress): use the destination variable in the tunnel assertion
senamakel Nov 16, 2026
431b75b
test(browser_egress): yield in upstream host callbacks to exercise as…
senamakel Nov 16, 2026
21b284e
fix(egress): return crate errors from upstream proxy parsing
senamakel Nov 16, 2026
9fd6523
chore(browser): reformat upstream proxy code and tighten tests
senamakel Nov 16, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions crates/tinycomputer-browser/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ contents remain opaque to the proxy and require TinySecurity's explicit
[`configuration.md`](../../docs/crates/tinycomputer/configuration.md#browser)
for the host contract and its privacy behavior.

A host may also name upstream HTTP proxies for some destination domains
(`EnforcedAgentBrowser::with_upstream_proxies`, from the module's
`browser.egress.upstream_proxies`). Those destinations are still authorized
first, and the upstream proxy's own dial goes through the same host grant.

The proxy internals and request-framing constraints are described in
[`src/egress/README.md`](src/egress/README.md).

Expand Down
33 changes: 33 additions & 0 deletions crates/tinycomputer-browser/src/egress/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ grant before each dial, and revalidates active leases.
response data while checking active leases.
- `serve.rs` sequences authorization, grant consumption, exact-address
connection, request forwarding, and response handling for one connection.
- `upstream.rs` holds `UpstreamProxy`, the optional host-configured upstream
HTTP proxy for a list of destination domains, and its `CONNECT` handshake.

## Operational constraints

Expand All @@ -33,3 +35,34 @@ once per second while uploading, tunneling, or receiving a response, and closes
the connection when validation is denied or fails. Do not add a direct-dial
fallback or locally resolve a host here: destination policy belongs to the
authenticated host callback.

## Upstream proxies

A host may route some destination domains (each entry matches itself and its
subdomains) through an upstream HTTP proxy, for sites that refuse the host's
own address (`EgressProxy::bind_with_upstreams`). Routing never weakens the
policy:

1. The destination is authorized exactly as for a direct dial. Its grant is
consumed for one approved address (IPv4 first), and that address is the
tunnel's target: the upstream proxy resolves nothing, so split DNS or a
rebinding answer at the proxy cannot move the connection elsewhere.
2. The upstream proxy's host and port are authorized through the same host
callback as any other dial (`scheme` `http`), and the proxy socket opens
only at an address that grant names, after consuming it. Nothing is
resolved locally and nothing is dialed outside a grant.
3. The proxy is asked for `CONNECT <approved address>` with the configured
`Proxy-Authorization: Basic` credentials. The browser's `Host` header and
TLS SNI travel inside the tunnel unchanged. Plain `http` and WebSocket
requests to a routed host travel the same kind of tunnel (to the URL's
port, 80 when it names none), with the usual
origin-form request written into it, so no request reaches a routed host
other than through a tunnel.
4. Every lease check validates both the destination lease and the proxy
lease; either one failing closes the connection.

A refused upstream dial answers the browser `403`; an upstream proxy that
answers but will not open the tunnel (a `407` for bad credentials, a `502`,
a timeout) answers `502` and logs only the upstream status. Only `http://`
upstream proxies are supported. The credentials stay inside `UpstreamProxy`:
its `Debug` output, its errors, and the log lines never carry them.
1 change: 1 addition & 0 deletions crates/tinycomputer-browser/src/egress/egress_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ mod lease_tests;
mod lifecycle_tests;
mod retry_tests;
mod simulator;
mod upstream_tests;
mod websocket_tests;

#[tokio::test]
Expand Down
Loading
Loading