@coffre/conformance 0.4.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coffre/conformance",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Checks a coffre deployment from outside: what it must never do, whatever code it runs.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -31,8 +31,8 @@
31
31
  "dependencies": {
32
32
  "jose": "6.2.3",
33
33
  "pg": "8.16.3",
34
- "@coffre/cli": "0.4.0",
35
- "@coffre/db": "0.4.0"
34
+ "@coffre/db": "0.4.1",
35
+ "@coffre/cli": "0.4.1"
36
36
  },
37
37
  "devDependencies": {
38
38
  "@types/node": "26.1.1",
@@ -41,7 +41,7 @@
41
41
  "tsdown": "0.23.0",
42
42
  "typescript": "5.9.3",
43
43
  "vite": "8.1.5",
44
- "@coffre/client": "0.4.0"
44
+ "@coffre/client": "0.4.1"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "tsdown",
@@ -4,6 +4,7 @@ import { bearer } from '../browser.ts';
4
4
  import type { Deployment } from '../harness.ts';
5
5
  import { expect, refused } from '../report.ts';
6
6
  import { BULK, canary, DEV, PROD, PROJECT, signIn, valuesIn, type Canaries, type People } from './people.ts';
7
+ import { connectedApp, discovers } from './mcp.ts';
7
8
  import { pollDevice, startDevice } from './signin.ts';
8
9
 
9
10
  export async function membersOnly(deployment: Deployment, { stranger }: People): Promise<string> {
@@ -90,7 +91,13 @@ export async function offboarding(deployment: Deployment, { admin, leaver, servi
90
91
  await leaver.api.deviceLogins.decide(device.user_code, true);
91
92
  // What they saw is what to rotate once they are gone.
92
93
  await leaver.cli.secrets.reveal(DEV);
93
- const { report } = await admin.api.members.remove(leaver.member);
94
+ // An app they connected is listed to an owner, and removal disconnects it.
95
+ const app = await connectedApp(deployment, leaver);
96
+ const before = await admin.api.members.get(leaver.member);
97
+ expect(before.live.apps === 1 && before.apps.length === 1, "the owner's report does not list the app the leaver connected", before.apps);
98
+ const { revoked, report } = await admin.api.members.remove(leaver.member);
99
+ expect(revoked.apps === 1 && report.live.apps === 0 && report.apps.length === 0, 'removal does not say it disconnected their app', { revoked, apps: report.apps });
100
+ expect(!(await discovers(deployment, app)), "a removed member's app still reaches /mcp");
94
101
  const exposed = report.exposed.map((entry) => `${entry.project}/${entry.environment}/${entry.key}`).sort();
95
102
  const expected = Object.keys(valuesIn(canaries, DEV)).map((key) => `${DEV}/${key}`).sort();
96
103
  expect(same(exposed, expected), 'the offboarding report does not name what they read', report.exposed);
@@ -114,7 +121,7 @@ export async function offboarding(deployment: Deployment, { admin, leaver, servi
114
121
  expect(fresh.ok, 'a fresh provider callback could not sign the re-admitted member in');
115
122
  await admin.api.members.remove(leaver.member);
116
123
  await admin.api.members.remove(service.member);
117
- return `the report names ${exposed.length} values; re-admission revives no old session, token or approval; a fresh provider callback works`;
124
+ return `the report names ${exposed.length} values and their connected app, which removal disconnects; re-admission revives no old session, token or approval; a fresh provider callback works`;
118
125
  }
119
126
 
120
127
  /**
@@ -30,7 +30,6 @@ function pages(people: People): string[] {
30
30
  '/login',
31
31
  '/unregistered',
32
32
  '/account',
33
- '/access',
34
33
  '/audit',
35
34
  '/settings',
36
35
  '/auth/device',
package/src/checks/mcp.ts CHANGED
@@ -101,7 +101,8 @@ async function refused(deployment: Deployment, what: string, fields: Record<stri
101
101
  expect(answer.status === 400 && body.error === 'invalid_grant', `${what} answered ${answer.status}, not invalid_grant`, body);
102
102
  }
103
103
 
104
- async function discovers(deployment: Deployment, access: string): Promise<boolean> {
104
+ /** Whether a connection's access token still reaches /mcp. */
105
+ export async function discovers(deployment: Deployment, access: string): Promise<boolean> {
105
106
  const answer = await mcp(deployment, { authorization: `Bearer ${access}`, 'mcp-protocol-version': '2026-07-28', 'mcp-method': 'server/discover' }, 'server/discover', { _meta: ENVELOPE });
106
107
  if (answer.status === 401) return false;
107
108
  const body = await json(answer);
@@ -232,6 +233,12 @@ async function register(deployment: Deployment): Promise<string> {
232
233
  return registered.client_id as string;
233
234
  }
234
235
 
236
+ /** A client registered and connected as the person, with Browse, for a check of another's: its access token. */
237
+ export async function connectedApp(deployment: Deployment, person: Person): Promise<string> {
238
+ const clientId = await register(deployment);
239
+ return (await redeem(deployment, clientId, await connect(deployment, person, clientId))).access_token;
240
+ }
241
+
235
242
  /**
236
243
  * The Browse tools, as a client calls them (design section 14, checks 1, 4
237
244
  * and 5): on 2026-07-28 and through a 2025-11-25 `initialize`, as the
@@ -119,6 +119,7 @@ export async function pagesInBrowser(deployment: Deployment, admin: Person, brow
119
119
  expect(loaded.dialog?.includes('Removing revokes 0 grants, 0 bearer tokens') === true, `${path}: Remove… does not preview what it would revoke`, loaded.dialog);
120
120
  }
121
121
  if (path === '/settings') expect(loaded.cards.includes('Keys'), '/settings does not show what the keys are checked against', loaded.cards);
122
+ if (path === person) expect(loaded.cards.includes('Connected apps'), `${path} does not show an owner the person's connected apps`, loaded.cards);
122
123
  }
123
124
  // A project's tabs are routes: their links, back and forward move between them in the page.
124
125
  const project = new URL(`/projects/${PROJECT}`, deployment.origin).href;