Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

fix: identify profile link labels as unverified

Josuéf63aed1aba9b
diff --git a/desktop-app/ui/src/App.tsx b/desktop-app/ui/src/App.tsx
index a5c845a4c..6d7778420 100644
--- a/desktop-app/ui/src/App.tsx
+++ b/desktop-app/ui/src/App.tsx
@@ -123,6 +123,12 @@ type PendingSandboxUiDeepLinkLaunch = {
conversationOrigin: SandboxUiConversationOrigin | null
}
+function formatLinkProvidedEnvironmentName(name: string): string {
+ const characters = Array.from(name.trim())
+ if (characters.length <= 64) return characters.join('')
+ return `${characters.slice(0, 63).join('')}…`
+}
+
const TRANSIENT_TEAM_CONTEXT_ERROR_CODES = new Set([
'ECONNRESET',
'ECONNREFUSED',
@@ -2722,18 +2728,34 @@ export function App() {
}
})()
: ''
+ const pendingSwitchCurrentHost = vm.pendingDesktopEnvironmentSwitchConfirmation
+ ? (() => {
+ try {
+ return new URL(
+ vm.pendingDesktopEnvironmentSwitchConfirmation.activeExternalRestApiBaseUrl
+ ).host
+ } catch {
+ return vm.pendingDesktopEnvironmentSwitchConfirmation.activeExternalRestApiBaseUrl
+ }
+ })()
+ : ''
const environmentSwitchConfirmationDialog = vm.pendingDesktopEnvironmentSwitchConfirmation ? (
<ConfirmDialog
title="Switch desktop environment?"
body={
<>
<p>
- You are signed in to{' '}
- <strong>{vm.pendingDesktopEnvironmentSwitchConfirmation.activeEnvironmentName}</strong>.
- Switching to{' '}
- <strong>{vm.pendingDesktopEnvironmentSwitchConfirmation.targetEnvironmentName}</strong>{' '}
+ You are signed in to the REST API host{' '}
+ <strong>{pendingSwitchCurrentHost || 'unknown'}</strong>. The Profile UI link requests{' '}
+ the REST API host <strong>{pendingSwitchTargetHost || 'unknown'}</strong>. Switching
will sign you out and interrupt activity in the current environment.
</p>
+ <p className="muted">
+ Profile link label (unverified):{' '}
+ {formatLinkProvidedEnvironmentName(
+ vm.pendingDesktopEnvironmentSwitchConfirmation.targetEnvironmentName
+ )}
+ </p>
{vm.pendingDesktopEnvironmentSwitchConfirmation.activeExternalRestApiBaseUrl ? (
<p className="auth-environment-confirm-url">
Current REST API:{' '}
@@ -2761,15 +2783,21 @@ export function App() {
title="Add desktop environment?"
body={
<>
- <p>
- Review the External REST API for{' '}
- <strong>{vm.pendingDesktopEnvironmentSetup.appName || 'Evenfire'}</strong>. Continue
- only if you trust this host.
+ <p>Review this External REST API host. Continue only if you trust it.</p>
+ {pendingEnvironmentHost ? (
+ <p>
+ Host: <strong>{pendingEnvironmentHost}</strong>
+ </p>
+ ) : null}
+ <p className="muted">
+ Profile link label (unverified):{' '}
+ {formatLinkProvidedEnvironmentName(
+ vm.pendingDesktopEnvironmentSetup.appName || 'Evenfire'
+ )}
</p>
<p className="auth-environment-confirm-url">
{vm.pendingDesktopEnvironmentSetup.externalRestApiBaseUrl}
</p>
- {pendingEnvironmentHost ? <p className="muted">Host: {pendingEnvironmentHost}</p> : null}
</>
}
cancelLabel="Cancel"
diff --git a/desktop-app/ui/src/__tests__/App.deepLinks.test.tsx b/desktop-app/ui/src/__tests__/App.deepLinks.test.tsx
index 2b04fdf3b..baf4ba1c7 100644
--- a/desktop-app/ui/src/__tests__/App.deepLinks.test.tsx
+++ b/desktop-app/ui/src/__tests__/App.deepLinks.test.tsx
@@ -382,10 +382,11 @@ describe('App deep-link orchestration', () => {
const getSandboxUiLocation = vi.fn().mockResolvedValue(null)
it('prompts to add an environment when a Profile Portal handoff has no saved match', () => {
+ const linkProvidedName = 'Tenant from profile link '.repeat(5)
currentController = makeController({
initialExperienceLoading: false,
pendingDesktopEnvironmentSetup: {
- appName: 'Example tenant',
+ appName: linkProvidedName,
externalRestApiBaseUrl: 'https://api.example.test',
rpcProxyBaseUrl: 'https://rpc.example.test',
},
@@ -396,8 +397,12 @@ describe('App deep-link orchestration', () => {
expect(confirmDialogHarness.props?.title).toBe('Add desktop environment?')
const dialogBody = renderToStaticMarkup(<>{confirmDialogHarness.props?.body}</>)
expect(dialogBody).toContain(
- 'Review the External REST API for <strong>Example tenant</strong>. Continue only if you trust this host.'
+ 'Review this External REST API host. Continue only if you trust it.'
)
+ expect(dialogBody).toContain('<strong>api.example.test</strong>')
+ expect(dialogBody).toContain('Profile link label (unverified):')
+ expect(dialogBody).toContain(`${linkProvidedName.slice(0, 63)}…`)
+ expect(dialogBody).not.toContain(linkProvidedName.slice(64))
expect(dialogBody).toContain('https://api.example.test')
expect(dialogBody).not.toContain('https://rpc.example.test')
})
@@ -405,12 +410,13 @@ describe('App deep-link orchestration', () => {
it('wires environment switch confirmation actions to the controller', () => {
const cancelSwitch = vi.fn()
const confirmSwitch = vi.fn()
+ const linkProvidedName = 'Tenant from profile link '.repeat(5)
currentController = makeController({
initialExperienceLoading: false,
pendingDesktopEnvironmentSwitchConfirmation: {
activeEnvironmentName: 'Current environment',
activeExternalRestApiBaseUrl: 'https://current-api.example.test/api/v1',
- targetEnvironmentName: 'Target environment',
+ targetEnvironmentName: linkProvidedName,
targetExternalRestApiBaseUrl: 'https://target-api.example.test/api/v1',
},
handleCancelDesktopEnvironmentSwitchConfirmation: cancelSwitch,
@@ -421,6 +427,12 @@ describe('App deep-link orchestration', () => {
expect(confirmDialogHarness.props?.title).toBe('Switch desktop environment?')
expect(confirmDialogHarness.props?.confirmLabel).toBe('Sign out and switch')
+ const dialogBody = renderToStaticMarkup(<>{confirmDialogHarness.props?.body}</>)
+ expect(dialogBody).toContain('<strong>current-api.example.test</strong>')
+ expect(dialogBody).toContain('<strong>target-api.example.test</strong>')
+ expect(dialogBody).toContain('Profile link label (unverified):')
+ expect(dialogBody).toContain(`${linkProvidedName.slice(0, 63)}…`)
+ expect(dialogBody).not.toContain(linkProvidedName.slice(64))
act(() => confirmDialogHarness.props?.onCancel())
expect(cancelSwitch).toHaveBeenCalledOnce()
act(() => confirmDialogHarness.props?.onConfirm())