You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tower: per-session remote credential for cloud-proxied Tower access #1589
Follow-up from #1586 (PR #1588), raised in CMAP review.
Context
#1586 restored cloud access by having TunnelClient stamp the Tower's local key onto tunnel-proxied requests. That is correct under the current trust model — the cloud edge authenticates the remote user, the local key authenticates local actors, and TunnelClient runs inside the Tower process — and it is no worse than pre-#1421, when tunnel access was unauthenticated locally.
But it means the remote browser receives the same injected local key a local browser does. There is no way to scope, expire, or revoke access for one remote session without rotating the key for every local actor too.
What to consider
A per-session credential minted for a remote session, scoped and expirable, distinct from ~/.agent-farm/local-key.
Interaction with BRIDGE_MODE, where the key is the primary control and IP-literal Hosts are already accepted — the same key is doing more work there.
Whether revocation should be per-session, per-device, or per-tower.
Not urgent and deliberately out of scope for the 3.3.3 hotfix — filing so the trade-off is tracked rather than lost in a PR thread.
cc @amrmelsayed — author of #1421; this is the trust-model question your review of #1586 would touch.
Reviewer design input (asked to look at this alongside PR #1588):
The framing checks out against source: the remote browser really does end up holding the same ~/.agent-farm/local-key a local browser does — the dashboard shell is served by the local Tower with the key injected, and #1588's stamp is what lets that serve happen at all. Two things worth adding to the eventual design discussion:
The current revocation story is worse than "rotate for every local actor too." There is no runtime rotation path at all: getExpectedKey() caches the key for the life of the process, and resetExpectedKeyCache() is an exported seam that nothing runtime-wires (server-utils.ts notes this explicitly). Revoking a leaked remote session today means deleting the key file and restarting Tower, which drops every local client simultaneously. Any per-session credential design should probably fix the rotation plumbing first, since scoped credentials without a working revocation path are scope without teeth.
The design hinges on whether Tower can even see a "session." Today nothing on a tunnel-borne request identifies which remote session it belongs to — TunnelClient stamps the same headers on all of them, and the cloud edge's per-user authentication never reaches Tower. So a per-session credential needs either (a) edge cooperation (the edge conveys or holds session identity, which also opens the cheaper alternative of doing revocation at the edge and leaving Tower's model untouched), or (b) Tower minting at some locally-observable boundary. For (b), the tower: cloud OAuth callback (GET /api/tunnel/connect/callback) is 401'd by the local-key check — Connect to Codev Cloud fails with 'Unauthorized' (regression from #1421) #1570 nonce is the house prior art for the credential shape itself (single-use, short TTL, mintable only via an authenticated POST) — but note it fires per tunnel connection, not per remote session, so it locates the pattern, not the minting point. Whichever way, dual-accept alongside the local key (like the legacy codev-web-key window) keeps isRequestAllowed/isWebSocketAllowed the single choke point.
Agreed this is not 3.3.3 material; the trust-model call is @amrmelsayed's per the cc.
Activity
amrmelsayed commentedon Sep 3, 2026
Reviewer design input (asked to look at this alongside PR #1588):
The framing checks out against source: the remote browser really does end up holding the same
~/.agent-farm/local-keya local browser does — the dashboard shell is served by the local Tower with the key injected, and #1588's stamp is what lets that serve happen at all. Two things worth adding to the eventual design discussion:The current revocation story is worse than "rotate for every local actor too." There is no runtime rotation path at all:
getExpectedKey()caches the key for the life of the process, andresetExpectedKeyCache()is an exported seam that nothing runtime-wires (server-utils.ts notes this explicitly). Revoking a leaked remote session today means deleting the key file and restarting Tower, which drops every local client simultaneously. Any per-session credential design should probably fix the rotation plumbing first, since scoped credentials without a working revocation path are scope without teeth.The design hinges on whether Tower can even see a "session." Today nothing on a tunnel-borne request identifies which remote session it belongs to — TunnelClient stamps the same headers on all of them, and the cloud edge's per-user authentication never reaches Tower. So a per-session credential needs either (a) edge cooperation (the edge conveys or holds session identity, which also opens the cheaper alternative of doing revocation at the edge and leaving Tower's model untouched), or (b) Tower minting at some locally-observable boundary. For (b), the tower: cloud OAuth callback (GET /api/tunnel/connect/callback) is 401'd by the local-key check — Connect to Codev Cloud fails with 'Unauthorized' (regression from #1421) #1570 nonce is the house prior art for the credential shape itself (single-use, short TTL, mintable only via an authenticated POST) — but note it fires per tunnel connection, not per remote session, so it locates the pattern, not the minting point. Whichever way, dual-accept alongside the local key (like the legacy
codev-web-keywindow) keepsisRequestAllowed/isWebSocketAllowedthe single choke point.Agreed this is not 3.3.3 material; the trust-model call is @amrmelsayed's per the cc.