Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(control-api): return secret identity in the mcp-secrets list
M4a9694bf23f6
diff --git a/control-api/package-lock.json b/control-api/package-lock.jsonindex a45491636..a9d59615e 100644--- a/control-api/package-lock.json+++ b/control-api/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-api",- "version": "0.1.786",+ "version": "0.1.787","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-api",- "version": "0.1.786",+ "version": "0.1.787","dependencies": {"@clerum/display-field": "file:../packages/display-field","@clerum/grok-provider-attempt-contract": "file:../packages/grok-provider-attempt-contract",diff --git a/control-api/package.json b/control-api/package.jsonindex 8b27b361e..1c8f9ca9d 100644--- a/control-api/package.json+++ b/control-api/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-api",- "version": "0.1.786",+ "version": "0.1.787","description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets","main": "dist/main.js","engines": {diff --git a/control-api/src/routes/admin/secrets.ts b/control-api/src/routes/admin/secrets.tsindex 6d2c60d4c..ce9830e2b 100644--- a/control-api/src/routes/admin/secrets.ts+++ b/control-api/src/routes/admin/secrets.ts@@ -583,7 +583,8 @@ export function createAdminSecretsRouter(// the wizard never writes a CR whose clientIdRef/clientSecretRef dangle. The// server-side install saga re-verifies existence at submit; this is the UI's// pre-check. Values are structurally impossible here: listSecrets projects only- // metadata + key names, and this route forwards only name + keys.+ // metadata + key names, and this route forwards only name + keys + the+ // uid/resourceVersion identity the UI needs for compare-and-delete.router.get('/admin/mcp-secrets',enforceNamespace(config.mcpServersNamespace),@@ -593,10 +594,18 @@ export function createAdminSecretsRouter(const record = asRecord(row)const metadata = asRecord(record?.metadata)const name = typeof metadata?.name === 'string' ? metadata.name : ''+ const uid = typeof metadata?.uid === 'string' ? metadata.uid : undefined+ const resourceVersion =+ typeof metadata?.resourceVersion === 'string' ? metadata.resourceVersion : undefinedconst keys = Array.isArray(record?.keys)? (record.keys as unknown[]).filter((k): k is string => typeof k === 'string'): []- return { name, keys }+ return {+ name,+ keys,+ ...(uid ? { uid } : {}),+ ...(resourceVersion ? { resourceVersion } : {}),+ }})res.status(200).json({ items })})diff --git a/control-api/test/routes.mcpSecrets.list.test.ts b/control-api/test/routes.mcpSecrets.list.test.tsindex 26c9036db..e6dabb980 100644--- a/control-api/test/routes.mcpSecrets.list.test.ts+++ b/control-api/test/routes.mcpSecrets.list.test.ts@@ -11,12 +11,24 @@ import { SecretService } from '../src/services/secretService.js'// hand-built row (e.g. one with a stray `data` field the producer never emits)// would test an impossible leak path instead of the real one.async function listSecretsOutput(- secrets: Array<{ name: string; data: Record<string, string> }>+ secrets: Array<{+ name: string+ data: Record<string, string>+ uid?: string+ resourceVersion?: string+ }>): Promise<unknown[]> {const fakeCoreApi = {listNamespacedSecret: async ({ namespace }: { namespace: string }) => ({items: secrets.map(s => ({- metadata: { name: s.name, namespace, labels: {}, annotations: {} },+ metadata: {+ name: s.name,+ namespace,+ ...(s.uid ? { uid: s.uid } : {}),+ ...(s.resourceVersion ? { resourceVersion: s.resourceVersion } : {}),+ labels: {},+ annotations: {},+ },type: 'Opaque',data: s.data,})),@@ -70,4 +82,22 @@ describe('GET /admin/mcp-secrets (E-16.1)', () => {expect(res.body.items[0]).not.toHaveProperty('data')expect(res.body.items[0]).not.toHaveProperty('stringData')})++ it('forwards the live uid/resourceVersion identity the UI needs for compare-and-delete', async () => {+ const rows = await listSecretsOutput([+ {+ name: 'asana-creds',+ data: { api_key: 'a2V5' },+ uid: 'uid-asana-1',+ resourceVersion: '42',+ },+ { name: 'legacy-creds', data: { api_key: 'a2V5' } },+ ])+ const { app } = makeApp(rows)+ const res = await request(app).get('/admin/mcp-secrets').expect(200)+ expect(res.body.items).toEqual([+ { name: 'asana-creds', keys: ['api_key'], uid: 'uid-asana-1', resourceVersion: '42' },+ { name: 'legacy-creds', keys: ['api_key'] },+ ])+ })})