Skip to content

Commit 075db92

Browse files
committed
Remove host access toggle from web UI
The toggle to enable/disable host access on the landing page doesn't make sense - this security config should only be controlled on the host itself (via CLI flags like --host-access), not remotely through the web interface. - Remove updateHostAccess endpoint from backend router - Remove updateHostAccess API method from frontend - Make HostSection display-only, showing how to enable via CLI flag
1 parent 1969206 commit 075db92

File tree

3 files changed

+46
-81
lines changed

3 files changed

+46
-81
lines changed

src/agent/router.ts

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1000,20 +1000,7 @@ export function createRouter(ctx: RouterContext) {
10001000
};
10011001
});
10021002

1003-
const updateHostAccess = os
1004-
.input(z.object({ enabled: z.boolean() }))
1005-
.handler(async ({ input }) => {
1006-
const currentConfig = ctx.config.get();
1007-
const newConfig = { ...currentConfig, allowHostAccess: input.enabled };
1008-
ctx.config.set(newConfig);
1009-
await saveAgentConfig(newConfig, ctx.configDir);
1010-
return {
1011-
enabled: input.enabled,
1012-
hostname: os_module.hostname(),
1013-
username: os_module.userInfo().username,
1014-
homeDir: os_module.homedir(),
1015-
};
1016-
});
1003+
10171004

10181005
const listModels = os
10191006
.input(
@@ -1105,7 +1092,6 @@ export function createRouter(ctx: RouterContext) {
11051092
},
11061093
host: {
11071094
info: getHostInfo,
1108-
updateAccess: updateHostAccess,
11091095
},
11101096
info: getInfo,
11111097
config: {

web/src/lib/api.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,6 @@ export const api = {
143143
getAgents: () => client.config.agents.get(),
144144
updateAgents: (data: CodingAgents) => client.config.agents.update(data),
145145
getHostInfo: () => client.host.info(),
146-
updateHostAccess: (enabled: boolean) => client.host.updateAccess({ enabled }),
147146
getSSHSettings: () => client.config.ssh.get(),
148147
updateSSHSettings: (data: SSHSettings) => client.config.ssh.update(data),
149148
listSSHKeys: () => client.config.ssh.listKeys(),

web/src/pages/WorkspaceList.tsx

Lines changed: 45 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -81,54 +81,17 @@ function WorkspaceRow({ workspace, onClick }: { workspace: WorkspaceInfo; onClic
8181
)
8282
}
8383

84-
function HostSection({ hostInfo, onNavigate, onToggle, isToggling }: {
84+
function HostSection({ hostInfo, onNavigate }: {
8585
hostInfo: HostInfo
8686
onNavigate: () => void
87-
onToggle: () => void
88-
isToggling: boolean
8987
}) {
90-
return (
91-
<div className="space-y-3">
92-
<div className="flex items-center justify-between">
88+
if (!hostInfo.enabled) {
89+
return (
90+
<div className="space-y-3">
9391
<h2 className="text-sm font-medium text-muted-foreground uppercase tracking-wider">
9492
Host Machine
9593
</h2>
96-
{hostInfo.enabled && (
97-
<span className="flex items-center gap-1.5 text-xs text-amber-600 dark:text-amber-400">
98-
<AlertTriangle className="h-3 w-3" />
99-
Direct access enabled
100-
</span>
101-
)}
102-
</div>
103-
104-
<div className={cn(
105-
"rounded-lg border overflow-hidden transition-colors",
106-
hostInfo.enabled
107-
? "border-amber-500/50 bg-amber-500/5"
108-
: "border-border/50 bg-card/50"
109-
)}>
110-
{hostInfo.enabled ? (
111-
<button
112-
onClick={onNavigate}
113-
className="w-full flex items-center gap-4 px-4 py-4 hover:bg-accent/50 transition-colors text-left group"
114-
>
115-
<div className="h-10 w-10 rounded-lg bg-amber-500/10 flex items-center justify-center">
116-
<Monitor className="h-5 w-5 text-amber-600 dark:text-amber-400" />
117-
</div>
118-
<div className="flex-1 min-w-0">
119-
<div className="flex items-center gap-2">
120-
<span className="font-medium text-foreground">{hostInfo.hostname}</span>
121-
<span className="text-[10px] uppercase tracking-wider text-amber-600 dark:text-amber-400 font-medium">
122-
Active
123-
</span>
124-
</div>
125-
<p className="text-sm text-muted-foreground mt-0.5">
126-
{hostInfo.username}@{hostInfo.hostname} &middot; {hostInfo.homeDir}
127-
</p>
128-
</div>
129-
<ChevronRight className="h-4 w-4 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" />
130-
</button>
131-
) : (
94+
<div className="rounded-lg border border-border/50 bg-card/50 overflow-hidden">
13295
<div className="px-4 py-4">
13396
<div className="flex items-start gap-4">
13497
<div className="h-10 w-10 rounded-lg bg-muted/50 flex items-center justify-center flex-shrink-0">
@@ -137,28 +100,54 @@ function HostSection({ hostInfo, onNavigate, onToggle, isToggling }: {
137100
<div className="flex-1 min-w-0">
138101
<div className="font-medium text-foreground">Host Access Disabled</div>
139102
<p className="text-sm text-muted-foreground mt-0.5">
140-
Enable to run agents and terminals directly on {hostInfo.hostname}
103+
Run with <code className="px-1.5 py-0.5 rounded bg-muted text-foreground text-xs">--host-access</code> to enable direct access to {hostInfo.hostname}
141104
</p>
142105
</div>
143106
</div>
144107
</div>
145-
)}
146-
<div className={cn(
147-
"px-4 py-3 border-t flex items-center justify-between",
148-
hostInfo.enabled ? "border-amber-500/30 bg-amber-500/5" : "border-border/50 bg-muted/20"
149-
)}>
108+
</div>
109+
</div>
110+
)
111+
}
112+
113+
return (
114+
<div className="space-y-3">
115+
<div className="flex items-center justify-between">
116+
<h2 className="text-sm font-medium text-muted-foreground uppercase tracking-wider">
117+
Host Machine
118+
</h2>
119+
<span className="flex items-center gap-1.5 text-xs text-amber-600 dark:text-amber-400">
120+
<AlertTriangle className="h-3 w-3" />
121+
Direct access enabled
122+
</span>
123+
</div>
124+
125+
<div className="rounded-lg border border-amber-500/50 bg-amber-500/5 overflow-hidden">
126+
<button
127+
onClick={onNavigate}
128+
className="w-full flex items-center gap-4 px-4 py-4 hover:bg-accent/50 transition-colors text-left group"
129+
>
130+
<div className="h-10 w-10 rounded-lg bg-amber-500/10 flex items-center justify-center">
131+
<Monitor className="h-5 w-5 text-amber-600 dark:text-amber-400" />
132+
</div>
133+
<div className="flex-1 min-w-0">
134+
<div className="flex items-center gap-2">
135+
<span className="font-medium text-foreground">{hostInfo.hostname}</span>
136+
<span className="text-[10px] uppercase tracking-wider text-amber-600 dark:text-amber-400 font-medium">
137+
Active
138+
</span>
139+
</div>
140+
<p className="text-sm text-muted-foreground mt-0.5">
141+
{hostInfo.username}@{hostInfo.hostname} &middot; {hostInfo.homeDir}
142+
</p>
143+
</div>
144+
<ChevronRight className="h-4 w-4 text-muted-foreground/50 group-hover:text-muted-foreground transition-colors" />
145+
</button>
146+
<div className="px-4 py-3 border-t border-amber-500/30 bg-amber-500/5">
150147
<div className="flex items-center gap-2 text-xs text-muted-foreground">
151148
<AlertTriangle className="h-3.5 w-3.5" />
152149
<span>Commands run directly on your machine without isolation</span>
153150
</div>
154-
<Button
155-
variant={hostInfo.enabled ? "outline" : "default"}
156-
size="sm"
157-
onClick={onToggle}
158-
disabled={isToggling}
159-
>
160-
{isToggling ? 'Updating...' : hostInfo.enabled ? 'Disable' : 'Enable'}
161-
</Button>
162151
</div>
163152
</div>
164153
</div>
@@ -182,13 +171,6 @@ export function WorkspaceList() {
182171
queryFn: api.getHostInfo,
183172
})
184173

185-
const hostToggleMutation = useMutation({
186-
mutationFn: (enabled: boolean) => api.updateHostAccess(enabled),
187-
onSuccess: () => {
188-
queryClient.invalidateQueries({ queryKey: ['hostInfo'] })
189-
},
190-
})
191-
192174
const createMutation = useMutation({
193175
mutationFn: (data: CreateWorkspaceRequest) => api.createWorkspace(data),
194176
onSuccess: () => {
@@ -263,8 +245,6 @@ export function WorkspaceList() {
263245
<HostSection
264246
hostInfo={hostInfo}
265247
onNavigate={() => navigate(`/workspaces/${encodeURIComponent(HOST_WORKSPACE_NAME)}`)}
266-
onToggle={() => hostToggleMutation.mutate(!hostInfo.enabled)}
267-
isToggling={hostToggleMutation.isPending}
268248
/>
269249
)}
270250

0 commit comments

Comments
 (0)