Skip to content

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

TypeScript

fix(oauth): correct install-identity guarantees in test docs (R6-M1)

Diego Zacarias9c086b3b5c94
diff --git a/control-api/package-lock.json b/control-api/package-lock.json
index 15077dae6..817e575a9 100644
--- a/control-api/package-lock.json
+++ b/control-api/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-api",
- "version": "0.1.679",
+ "version": "0.1.680",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-api",
- "version": "0.1.679",
+ "version": "0.1.680",
"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.json
index bdd4a7744..ab5a7cfd6 100644
--- a/control-api/package.json
+++ b/control-api/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-api",
- "version": "0.1.679",
+ "version": "0.1.680",
"description": "Internal Clerum control plane REST API + UI for managing CRDs and secrets",
"main": "dist/main.js",
"engines": {
diff --git a/control-api/src/oauth/__tests__/callbackMcpMembership.test.ts b/control-api/src/oauth/__tests__/callbackMcpMembership.test.ts
index f72d0b0d6..acf802ebe 100644
--- a/control-api/src/oauth/__tests__/callbackMcpMembership.test.ts
+++ b/control-api/src/oauth/__tests__/callbackMcpMembership.test.ts
@@ -241,9 +241,11 @@ describe('handleOAuthCallback — mcp context membership guard (R3-L1)', () => {
expect((values as unknown[]).at(-1)).toBe('uid-live-cr')
})
- // A grant with NO subject cr_uid (a legacy/authorize-url path that never read a
- // live CR) persists cr_uid NULL — never crashes, and stays purgeable by any teardown.
- it('persists cr_uid NULL when the subject carries no uid', async () => {
+ // Pins current behaviour for a subject read from a CR without `metadata.uid`,
+ // which a real apiserver never returns: the callback persists cr_uid NULL
+ // instead of failing closed. Such a row is still purgeable by any teardown, but
+ // the readers only serve it to a baked key of the same provider.
+ it('persists cr_uid NULL for a subject read from a CR without a uid (current behaviour)', async () => {
const deps = buildDeps({
subject: mcpSubject({ grantScope: 'user', contextRef: undefined, crUid: undefined }),
userContextsReader: vi.fn(async () => ({ contextIds: [] })),
diff --git a/control-api/test/oauth.store.installIdentityFence.realPostgres.integration.test.ts b/control-api/test/oauth.store.installIdentityFence.realPostgres.integration.test.ts
index 113dd7315..3d14de756 100644
--- a/control-api/test/oauth.store.installIdentityFence.realPostgres.integration.test.ts
+++ b/control-api/test/oauth.store.installIdentityFence.realPostgres.integration.test.ts
@@ -2,10 +2,13 @@
* Installation-identity fence on the grant READERS, on a real Postgres.
*
* A same-name reinstall of an OAuth McpServer gets a new `metadata.uid`. Grants
- * consented against the previous installation must be invisible to the readers
- * of the new one (`getOAuthGrant` / `oauthGrantExists`), even if the uninstall
- * never purged them — otherwise a reinstall that reuses the same `oauth.id`
- * silently re-authorizes every previous user.
+ * SEALED against the previous installation must be invisible to the readers of
+ * the new one (`getOAuthGrant` / `oauthGrantExists`), even if the uninstall never
+ * purged them — otherwise a reinstall that reuses the same `oauth.id` silently
+ * re-authorizes every previous user. An unsealed (legacy) grant, written by a pod
+ * without install identity, is visible only to a baked installation of the same
+ * provider; other lanes and providers are covered by
+ * `oauth.legacyGrantLaneFence.realPostgres.integration.test.ts`.
*
* Fixtures come from the real producers (T1): the two installations are created
* in the gateway (which assigns each its uid, as the apiserver does), the reader
@@ -176,7 +179,7 @@ describeRealPostgres('grant readers fenced by the live installation uid (real Po
expect((await getOAuthGrant(db, KEY, readerKey(old, name)))?.accessToken).toBe('at-shared')
})
- it('an unsealed (legacy) grant stays visible to the live installation', async () => {
+ it('an unsealed (legacy) grant stays visible to a baked installation of the same provider', async () => {
const name = `fence-legacy-${randomUUID().slice(0, 8)}`
const { live } = await installThenReinstall(name, 'user')
await consentUser(name, 'user-1', undefined)
diff --git a/control-api/test/services.oauthProactiveRefreshCron.installIdentity.realPostgres.integration.test.ts b/control-api/test/services.oauthProactiveRefreshCron.installIdentity.realPostgres.integration.test.ts
index f1333b46b..7fd0c2705 100644
--- a/control-api/test/services.oauthProactiveRefreshCron.installIdentity.realPostgres.integration.test.ts
+++ b/control-api/test/services.oauthProactiveRefreshCron.installIdentity.realPostgres.integration.test.ts
@@ -246,7 +246,7 @@ describeRealPostgres('proactive refresh sweep — installation identity (real Po
expect(dead?.refreshToken).toBe('RT-DEAD')
})
- it('leaves an unsealed (legacy) grant to the reactive path: not enumerated, not POSTed', async () => {
+ it('never touches an unsealed (legacy) remote grant: not enumerated, not POSTed', async () => {
await dbPool.query('DELETE FROM oauth_grants')
const gateway = new MockGateway(NS)
await createCr(gateway, 'cron-legacy')