Skip to content

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

TypeScript

fix(control-ui): close residual context-copy leaks found in audit pass

Miguelon Peluchon734fba71ad83
diff --git a/control-ui/app/hosts/[name]/page.tsx b/control-ui/app/hosts/[name]/page.tsx
index b3b1c29b8..72498519a 100644
--- a/control-ui/app/hosts/[name]/page.tsx
+++ b/control-ui/app/hosts/[name]/page.tsx
@@ -100,7 +100,7 @@ function agentConnectorMutationError(error: unknown): string {
if ((error as { status?: unknown } | null)?.status === 409) {
return 'This agent’s connectors changed since they were loaded. Reload the agent and try again.'
}
- if (error instanceof Error && /context version is unavailable/i.test(error.message)) {
+ if (error instanceof Error && /required version is unavailable/i.test(error.message)) {
return 'This agent’s connector settings are missing a server version. Reload the agent and try again.'
}
return contextMutationError(error, 'Failed to update connectors for this agent.')
diff --git a/control-ui/app/mcp-servers/page.tsx b/control-ui/app/mcp-servers/page.tsx
index d48148633..12eafb571 100644
--- a/control-ui/app/mcp-servers/page.tsx
+++ b/control-ui/app/mcp-servers/page.tsx
@@ -156,6 +156,9 @@ function connectorAccessMutationError(error: unknown, fallback: string): string
if ((error as { status?: unknown } | null)?.status === 409) {
return 'This connector’s access changed since it was loaded. Reload the page and try again.'
}
+ if (error instanceof Error && /required version is unavailable/i.test(error.message)) {
+ return 'This connector’s access is missing a server version. Reload the page and try again.'
+ }
return contextMutationError(error, fallback)
}
diff --git a/control-ui/components/GovernedTraceSurface/AdministrativeEventDetail/index.tsx b/control-ui/components/GovernedTraceSurface/AdministrativeEventDetail/index.tsx
index 09de30854..6f21a15a5 100644
--- a/control-ui/components/GovernedTraceSurface/AdministrativeEventDetail/index.tsx
+++ b/control-ui/components/GovernedTraceSurface/AdministrativeEventDetail/index.tsx
@@ -340,7 +340,7 @@ export function AdministrativeEventDetail({ eventId }: AdministrativeEventDetail
payload_sha256: detail.provenance.payloadSha256,
}}
headingId="admin-stored-context-provenance"
- title="Stored context and provenance"
+ title="Stored details and provenance"
/>
<section className="cu-trace-detail-section" aria-labelledby="admin-target-human">
diff --git a/control-ui/components/RecipeEditor.tsx b/control-ui/components/RecipeEditor.tsx
index 7bfcb4a28..b82229d4e 100644
--- a/control-ui/components/RecipeEditor.tsx
+++ b/control-ui/components/RecipeEditor.tsx
@@ -72,7 +72,7 @@ function checkPolicyL1(parsed: { spec?: unknown } | null): ServerValidationError
` • Option A — opt in to sharing: add \`"security": { "allowContextRef": true }\` to spec, ` +
`and ensure a WorkflowRecipePolicy with \`allowContextRef: true\` exists in the target namespace.\n` +
` • Option B — keep it private: remove \`spec.contextRef\` entirely. ` +
- `WRC will auto-create a private Context "wf-<recipeName>" for this recipe, ` +
+ `WRC will auto-create a private connector scope for this recipe, ` +
`with no first-party server sharing and no policy required.`,
}
}
diff --git a/control-ui/components/__tests__/GovernedTraceDetails.test.tsx b/control-ui/components/__tests__/GovernedTraceDetails.test.tsx
index 52ec9f2a2..6bdff0f74 100644
--- a/control-ui/components/__tests__/GovernedTraceDetails.test.tsx
+++ b/control-ui/components/__tests__/GovernedTraceDetails.test.tsx
@@ -100,7 +100,7 @@ describe('governed event details', () => {
expect(screen.getByText('admin:write, users:write')).toBeInTheDocument()
expect(screen.getByText('exchange-reference-1')).toBeInTheDocument()
expect(screen.getByText('approval-1')).toBeInTheDocument()
- expect(screen.getByText('Stored context and provenance')).toBeInTheDocument()
+ expect(screen.getByText('Stored details and provenance')).toBeInTheDocument()
expect(screen.getByText('audit-1')).toBeInTheDocument()
expect(screen.getByText('authorization-1')).toBeInTheDocument()
expect(screen.getByRole('link', { name: 'Bob Target' })).toHaveAttribute(
diff --git a/control-ui/components/__tests__/RecipeEditor.test.tsx b/control-ui/components/__tests__/RecipeEditor.test.tsx
index a5b1fb363..6529c1631 100644
--- a/control-ui/components/__tests__/RecipeEditor.test.tsx
+++ b/control-ui/components/__tests__/RecipeEditor.test.tsx
@@ -599,7 +599,7 @@ describe('RecipeEditor — validation flow', () => {
expect(screen.getByText('Blocking errors')).toBeInTheDocument()
expect(screen.getByText('Informational notes')).toBeInTheDocument()
expect(screen.getByText(/env name looks sensitive/)).toBeInTheDocument()
- expect(screen.getByText(/WRC will auto-create a private Context/)).toBeInTheDocument()
+ expect(screen.getByText(/WRC will auto-create a private connector scope/)).toBeInTheDocument()
})
it('blocks reserved WorkflowRecipe secret names and invalid secret keys during validation', () => {
diff --git a/control-ui/e2e/qa-recorder-connector-edit.spec.ts b/control-ui/e2e/qa-recorder-connector-edit.spec.ts
index 3963094ce..7a32d509f 100644
--- a/control-ui/e2e/qa-recorder-connector-edit.spec.ts
+++ b/control-ui/e2e/qa-recorder-connector-edit.spec.ts
@@ -140,12 +140,12 @@ test.describe('optional QA recorder: Control UI connector edit', () => {
await page.getByRole('tab', { name: 'External Egress', exact: true }).click()
- // Image and access scopes are rendered as static read-only text (not
- // editable inputs).
+ // Image is rendered as static read-only text (not an editable input).
const meta = page.locator('.cu-connector-edit-meta')
await expect(meta).toBeVisible({ timeout: 20_000 })
await expect(meta.getByText('qa-recorder/example:dev')).toBeVisible()
- await expect(meta.getByText(connectorContextName)).toBeVisible()
+ // The private scope slug must NOT surface anywhere on this page.
+ await expect(meta.getByText(connectorContextName)).toHaveCount(0)
// External Egress: switch to exact-CIDR mode and add one public CIDR + port.
// 8.8.8.8/32 is a valid public target; the model rejects private/doc ranges.
diff --git a/control-ui/lib/budgets.ts b/control-ui/lib/budgets.ts
index 37551f315..8074c5005 100644
--- a/control-ui/lib/budgets.ts
+++ b/control-ui/lib/budgets.ts
@@ -27,7 +27,7 @@ export const BUDGET_DIMENSION_LABELS: Record<string, string> = {
user_id: 'User',
host_ref: 'Agent',
llm_secret_name: 'Secret',
- context_ref: 'Context',
+ context_ref: 'Connector scope',
source_kind: 'Source',
recipe_name: 'Recipe',
cron_job_id: 'Cron job',
diff --git a/control-ui/lib/contextMutation.ts b/control-ui/lib/contextMutation.ts
index 1b6eba4ae..80822729e 100644
--- a/control-ui/lib/contextMutation.ts
+++ b/control-ui/lib/contextMutation.ts
@@ -11,14 +11,14 @@ export function buildContextUpdatePayload(
): ContextUpdatePayload {
const version = resourceVersion?.trim()
if (!version) {
- throw new Error('Context version is unavailable. Reload before changing membership.')
+ throw new Error('A required version is unavailable. Reload before changing access.')
}
return { metadata: { resourceVersion: version }, spec }
}
export function contextMutationError(error: unknown, fallback: string): string {
if ((error as { status?: unknown } | null)?.status === 409) {
- return 'This Context changed since it was loaded. Reload it before applying your changes.'
+ return 'This access changed since it was loaded. Reload the page before applying your changes.'
}
return error instanceof Error ? error.message : fallback
}
diff --git a/control-ui/lib/recipeValidator.ts b/control-ui/lib/recipeValidator.ts
index 3868bb711..642bdb6e1 100644
--- a/control-ui/lib/recipeValidator.ts
+++ b/control-ui/lib/recipeValidator.ts
@@ -735,7 +735,7 @@ export function validateRecipe(input: string, defaults?: OperatorDefaults): Vali
severity: 'info',
path: 'spec.contextRef',
message:
- 'Omitted — WRC will auto-create a private Context "wf-<recipeName>" for this recipe. Set explicitly only to share connectors with other recipes in the same namespace.',
+ 'Omitted — WRC will auto-create a private connector scope for this recipe. Set explicitly only to share connectors with other recipes in the same namespace.',
})
}
diff --git a/control-ui/next-env.d.ts b/control-ui/next-env.d.ts
index 9edff1c7c..c4b7818fb 100644
--- a/control-ui/next-env.d.ts
+++ b/control-ui/next-env.d.ts
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
-import "./.next/types/routes.d.ts";
+import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index 4f486ae9d..f5980bc64 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.463",
+ "version": "0.1.464",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.463",
+ "version": "0.1.464",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/llm-providers": "file:../packages/llm-providers",
diff --git a/control-ui/package.json b/control-ui/package.json
index 72b9a4ca7..d8b025660 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.463",
+ "version": "0.1.464",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/docs/features/control-ui-context-removal.md b/docs/features/control-ui-context-removal.md
index 5a2c75471..095fb2986 100644
--- a/docs/features/control-ui-context-removal.md
+++ b/docs/features/control-ui-context-removal.md
@@ -197,6 +197,7 @@ Tests updated in the same commit: `HostTable.test.tsx` (hover card now asserts a
| 2026-08-26 | 3 | Category A implemented + e2e migration for phases 0–3. Deleted: `/contexts` pages (`page`, `new`, `[name]`, `[name]/[tab]`), `components/ContextTable.tsx`, sidebar item/type/order, `DashboardLayout` branch, `CONTROL_ROUTES.contexts` builders, `createFlowLoading.createContext`, stale `/contexts/:name/shared-files` redirect. Added `app/contexts/[[...slug]]/page.tsx` legacy resolver (slug → owning agent's Connectors tab via `spec.contextRef` join; unknown/`new`/failures → `/agents`). Tests: contexts suites + `ContextTable.test.tsx` deleted; **spec-preservation contract re-homed** to `HostDetailsPage.connectors.test.tsx` (unknown `spec.gfs` + `resourceVersion` survive agent-side connector PUTs); RFC1123 generation stays covered by `lib/__tests__/agentContext.test.ts`; `Sidebar.test.tsx` order, `AuthContext.test.tsx` URL fixture updated. E2e: main `contexts.spec.ts` rewritten as redirect/no-sidebar regression; `auth.spec.ts`, `channels.spec.ts`, `mcp-servers.spec.ts`, `helpers/selectors.ts` cleaned. QA-recorder: 4 context specs deleted + their npm scripts; connector-edit/navigation/onboarding-combo/team-create/create-form-smoke/connectors/shared-fs-upload migrated to agent-access flows (API-created contexts where a context fixture is needed). Full vitest + `tsc` green. No backend changes. |
| 2026-08-26 | 4 | Category D + close-out. SFS list column → "Mounted by" with mount refs resolved to owning agent names (failure-tolerant hosts/contexts enrichment); SFS create subtitle + loading-skeleton copy reworded; SFS detail chip "not mounted by any agent" / "mounted by <agents>" (invisible scopes don't count); recipe editor L1 banner speaks "shared connector scope" (JSON keys untouched); workflow-run infra error → "connector access"; workflow access panel description reworded; dead `ResourceTable.tsx` deleted. New shared `lib/accessScopeLabels.ts` (scope id → agent/display label join) now backs users/teams Access tabs and SFS surfaces. Residual sweep: missed "Contexts:" meta line on connector egress tab removed; `createFlowLoading` SFS copy fixed; verified remaining "context" strings are all §3 exclusions (LLM prompt "User context", guardrail `may_add context`, service name `host-context-controller`, internal identifiers). **Verification:** full vitest 1700/1700, `tsc --noEmit` clean, `next build` compiles with `/contexts/[[...slug]]` as the only contexts route. No backend changes. |
| 2026-08-26 | 4 | Product e2e `control-ui/e2e/registry-install.spec.ts` migrated: install flows drop the removed Context step (one fewer Continue; access scope is provisioned silently); J1 manual-create flows rewritten to the current form (egress via "Advanced options" disclosure on the Connector step, optional Access step passed through, "No credentials required" radio before submit). API-level sections (contextRef payloads, context1 allowlist assertions) intentionally unchanged — the backend contract is untouched. Full vitest 1700/1700 + `tsc` green after migration. |
+| 2026-08-27 | audit | Fresh-eyes residual audit (independent pass) + fixes. **Backend re-verified untouched**: `git diff --name-only a584c259a..HEAD` contains zero files outside `control-ui/`, `docs/`, `tests/e2e/` (an apparent `host-context-controller` diff was `origin/dev` moving forward under us mid-run — PR #471, someone else's lane; our branch never touched it). Leaks fixed: (1) RecipeEditor L1 Option B still said "a private Context \"wf-<recipeName>\"" (earlier scripted replace had silently missed it) → "a private connector scope"; (2) `lib/recipeValidator.ts` INFO hint same reword; (3) `lib/contextMutation.ts` default messages neutralized ("A required version is unavailable…", "This access changed since it was loaded…") + `hosts/[name]` regex updated + connectors page now also intercepts the version-unavailable path; (4) token-budget dimension label `context_ref` "Context" → "Connector scope"; (5) "Stored context and provenance" trace-detail heading → "Stored details and provenance"; (6) stale qa-recorder-connector-edit assertion on the removed context-slug meta now asserts it does NOT render. Tests updated (RecipeEditor, GovernedTraceDetails). Remaining "context" words verified as §3 exclusions: kubectl `--context` flags in recipe-status hints (kubeconfig syntax), manifest `contextRef` prose (wire format), raw-id fallback labels (by design, muted), `host-context-controller` service label, LLM "User context" (USER.md), guardrail `may add context`, plus intentional legacy redirects in `next.config.js`. Full vitest 1700/1700, `tsc` clean. No backend changes. |
## 11. Open questions / follow-ups (non-blocking)