mirror of
https://github.com/chriswritescode-dev/opencode-manager.git
synced 2026-12-06 04:44:21 +01:00
fix(servers): guard stored credentials and reconcile remote session status
Reject a server address change to a new origin unless a password or pairing is supplied, so the stored password is never sent to another host. Test connection now checks the edited values and warns when an origin change needs credentials. Replay and reconcile remote session statuses on stream reconnect and browser resync so linked-server sessions no longer stay busy. Treat malformed server session URLs as not found instead of throwing.
This commit is contained in:
1 parent
3a7227a602
commit
5586120ba2
18 files changed
+843
-62
No files matched your search
@@ -12,6 +12,7 @@ import {
|
||||
type OpenCodeServerLink,
|
||||
type OpenCodeServerTestResult,
|
||||
} from '@opencode-manager/shared/schemas'
|
||||
import { haveSameUrlOrigin } from '@opencode-manager/shared/utils'
|
||||
import { Badge } from '@/components/ui/badge'
|
||||
import { Button } from '@/components/ui/button'
|
||||
import { Checkbox } from '@/components/ui/checkbox'
|
||||
@@ -172,8 +173,14 @@ export function OpenCodeServerDialog({
|
||||
}, [open, server, form])
|
||||
|
||||
const baseUrlValue = form.watch('baseUrl')
|
||||
const passwordValue = form.watch('password')
|
||||
const transportWarning = sendsCredentialsInClear(baseUrlValue)
|
||||
const isEditing = Boolean(server)
|
||||
const originChanged = Boolean(
|
||||
server && isHttpUrl(baseUrlValue) && !haveSameUrlOrigin(server.baseUrl, baseUrlValue),
|
||||
)
|
||||
const needsCredentialsForOriginChange =
|
||||
Boolean(server?.hasPassword) && originChanged && !passwordValue && !clearPassword && !pairingLink
|
||||
const isSubmitting = form.formState.isSubmitting
|
||||
|
||||
const applyPairingLink = (text: string) => {
|
||||
@@ -381,6 +388,13 @@ export function OpenCodeServerDialog({
|
||||
)}
|
||||
/>
|
||||
|
||||
{needsCredentialsForOriginChange && (
|
||||
<div role="status" className="flex items-start gap-2 rounded-md border border-warning/40 p-2 text-sm text-warning">
|
||||
<AlertTriangle className="mt-0.5 h-4 w-4 shrink-0" />
|
||||
<span>Changing the server address requires re-entering the password or pairing again.</span>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{isEditing && server?.hasPassword && (
|
||||
<div className="flex items-center gap-2">
|
||||
<Checkbox
|
||||
|
||||
Reference in new issue
Block a user