Skip to content

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

TypeScript

fix(control-api): address review feedback (comment accuracy + test realism)

Alfredo Lopez6d1e9ef9d371
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 1bf20ca32..72203d2f3 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.393",
+ "version": "0.1.394",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.393",
+ "version": "0.1.394",
"dependencies": {
"@clerum/image-policy": "file:../packages/image-policy",
"@clerum/llm-providers": "file:../packages/llm-providers",
diff --git a/control-api/package.json b/control-api/package.json
index 1376f982e..f30245741 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.393",
+ "version": "0.1.394",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/src/k8s.ts b/control-api/src/k8s.ts
index ab233500a..60012696f 100644
--- a/control-api/src/k8s.ts
+++ b/control-api/src/k8s.ts
@@ -391,8 +391,8 @@ export class K8sGateway {
}
// Write ops return a names-only summary (never the k8s Secret's `.data`), so no
- // route can leak secret values by echoing the return — and a future cast to
- // V1Secret is now a compile error. Reads (getSecret) stay full-fat.
+ // route can leak secret values by echoing the return — and reading `.data` off
+ // the returned summary is now a compile error. Reads (getSecret) stay full-fat.
async createSecret(req: SecretUpsertRequest): Promise<SecretSummary> {
return this.secrets.createSecret(req)
}
diff --git a/control-api/src/routes/admin/communicationChannelCredentials.ts b/control-api/src/routes/admin/communicationChannelCredentials.ts
index 56c4c93b3..0248bc30c 100644
--- a/control-api/src/routes/admin/communicationChannelCredentials.ts
+++ b/control-api/src/routes/admin/communicationChannelCredentials.ts
@@ -104,9 +104,8 @@ export function registerCommunicationChannelCredentialsRoutes(
}
await gateway.updateResource('communicationchannels', name, { spec: nextSpec }, ns)
// Names-only for consistency with the rotated:true branch and the #223
- // policy. `updated` is the CommunicationChannel CRD (only
- // credentialsSecretRef, no secret values), but we still avoid echoing the
- // raw CRD and return only the written key NAMES.
+ // policy. The updateResource result (the CommunicationChannel CRD) is not
+ // echoed — respond with only the written key NAMES.
res.status(200).json({
name,
secretName,
diff --git a/control-api/test/routes.secretsNamesOnly.integration.test.ts b/control-api/test/routes.secretsNamesOnly.integration.test.ts
index 42dc87242..4b3d1b4ab 100644
--- a/control-api/test/routes.secretsNamesOnly.integration.test.ts
+++ b/control-api/test/routes.secretsNamesOnly.integration.test.ts
@@ -128,8 +128,9 @@ describe('SECURITY (integration): admin secret-write responses are names-only',
.send({ name: 'r1', data: { TOKEN: LEAK } })
.expect(200)
- expect(res.body).toMatchObject({ name: 'r1' })
- expect(Array.isArray(res.body.keys)).toBe(true)
+ // Names-only, and the resulting keyset includes the pre-existing key by NAME
+ // only (never its value) — proving the merge response was trimmed.
+ expect(res.body).toMatchObject({ name: 'r1', keys: ['EXISTING', 'TOKEN'] })
expectNoSecretValues(res.body)
})
diff --git a/control-api/test/services.secretService.test.ts b/control-api/test/services.secretService.test.ts
index 98fa43b09..b42a55abe 100644
--- a/control-api/test/services.secretService.test.ts
+++ b/control-api/test/services.secretService.test.ts
@@ -109,17 +109,19 @@ describe('SecretService — write ops return names-only summaries (no secret val
])
})
- it('removeSecretKey returns names-only', async () => {
- const { svc } = makeService()
+ it('removeSecretKey returns names-only (post-removal keyset, value never surfaced)', async () => {
+ const { svc, core } = makeService()
+ // Realistic post-removal merge-patch response: the removed key is gone; only
+ // the surviving key remains (still base64 in the raw k8s response).
+ core.patchNamespacedSecret.mockResolvedValueOnce(
+ fullSecret('cc-foo-credentials', 'channels', { 'slack-bot-token': OTHER_VALUE })
+ )
const result = await svc.removeSecretKey({
name: 'cc-foo-credentials',
namespace: 'channels',
key: 'telegram-bot-token',
})
- expectNamesOnly(result, 'cc-foo-credentials', 'channels', [
- 'slack-bot-token',
- 'telegram-bot-token',
- ])
+ expectNamesOnly(result, 'cc-foo-credentials', 'channels', ['slack-bot-token'])
})
it('deleteSecret returns {name, namespace, deleted:true}, never a Secret body', async () => {