@coffre/ui 0.10.0 → 0.10.2
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/dist/chunks/{audit-sentence-Bjhg00cn.js → audit-sentence-CtO2oJ4E.js} +7 -3
- package/dist/chunks/{audit-sentence-Bjhg00cn.js.map → audit-sentence-CtO2oJ4E.js.map} +1 -1
- package/dist/chunks/{connected-apps-CZI7xxUq.js → connected-apps-D48SFJsG.js} +4 -4
- package/dist/chunks/{connected-apps-CZI7xxUq.js.map → connected-apps-D48SFJsG.js.map} +1 -1
- package/dist/chunks/{delete-place-D3UQGl3b.js → delete-place-Cg_M6rAq.js} +4 -4
- package/dist/chunks/{delete-place-D3UQGl3b.js.map → delete-place-Cg_M6rAq.js.map} +1 -1
- package/dist/chunks/{directory-CyHmxYP-.js → directory-_LTgdiIM.js} +8 -8
- package/dist/chunks/{directory-CyHmxYP-.js.map → directory-_LTgdiIM.js.map} +1 -1
- package/dist/chunks/{folders-Dw240WMJ.js → folders-D3A1NGpt.js} +2 -2
- package/dist/chunks/{folders-Dw240WMJ.js.map → folders-D3A1NGpt.js.map} +1 -1
- package/dist/chunks/{grants-CEIdNqJU.js → grants-CNM913EY.js} +5 -5
- package/dist/chunks/{grants-CEIdNqJU.js.map → grants-CNM913EY.js.map} +1 -1
- package/dist/chunks/{multi-combobox-CsIXihuc.js → multi-combobox-B0JzP1QN.js} +2 -2
- package/dist/chunks/{multi-combobox-CsIXihuc.js.map → multi-combobox-B0JzP1QN.js.map} +1 -1
- package/dist/chunks/{offboarding-CvGgTmHi.js → offboarding-BeaNM3sf.js} +3 -3
- package/dist/chunks/{offboarding-CvGgTmHi.js.map → offboarding-BeaNM3sf.js.map} +1 -1
- package/dist/chunks/{personal-tokens-BX97oX4a.js → personal-tokens-KsXajpx4.js} +4 -4
- package/dist/chunks/{personal-tokens-BX97oX4a.js.map → personal-tokens-KsXajpx4.js.map} +1 -1
- package/dist/chunks/{principal-page-Bp2O8kIW.js → principal-page-C0U4T6le.js} +13 -13
- package/dist/chunks/{principal-page-Bp2O8kIW.js.map → principal-page-C0U4T6le.js.map} +1 -1
- package/dist/chunks/{project-page-CUXV4FDR.js → project-page-CYZ_MkfX.js} +2 -2
- package/dist/chunks/{project-page-CUXV4FDR.js.map → project-page-CYZ_MkfX.js.map} +1 -1
- package/dist/chunks/{protected-YYW3U-Sq.js → protected-BL_DsZO6.js} +2 -2
- package/dist/chunks/{protected-YYW3U-Sq.js.map → protected-BL_DsZO6.js.map} +1 -1
- package/dist/chunks/{queries-DEOPOpsT.js → queries-Danu0o75.js} +73 -29
- package/dist/chunks/queries-Danu0o75.js.map +1 -0
- package/dist/chunks/{references-DsXkt064.js → references-BK2aPXae.js} +4 -4
- package/dist/chunks/{references-DsXkt064.js.map → references-BK2aPXae.js.map} +1 -1
- package/dist/chunks/{role-field-CCUeZd1a.js → role-field-DIJiRz9B.js} +3 -3
- package/dist/chunks/{role-field-CCUeZd1a.js.map → role-field-DIJiRz9B.js.map} +1 -1
- package/dist/chunks/{row-state-BsIHspy4.js → row-state-xtRGFnDc.js} +2 -2
- package/dist/chunks/{row-state-BsIHspy4.js.map → row-state-xtRGFnDc.js.map} +1 -1
- package/dist/chunks/{theme-3b4DnCow.js → theme-Ck45wzWB.js} +2 -2
- package/dist/chunks/{theme-3b4DnCow.js.map → theme-Ck45wzWB.js.map} +1 -1
- package/dist/chunks/{ui-2kwXXfrX.js → ui-D-blFWfx.js} +29 -5
- package/dist/chunks/{ui-2kwXXfrX.js.map → ui-D-blFWfx.js.map} +1 -1
- package/dist/chunks/{use-action-COW-XFw8.js → use-action-BafZVwux.js} +2 -2
- package/dist/chunks/{use-action-COW-XFw8.js.map → use-action-BafZVwux.js.map} +1 -1
- package/dist/chunks/{use-change-hfqE7baE.js → use-change-DhV6i_Ge.js} +3 -3
- package/dist/chunks/{use-change-hfqE7baE.js.map → use-change-DhV6i_Ge.js.map} +1 -1
- package/dist/chunks/{use-roles-C_Tj5wBH.js → use-roles-Daje0ikO.js} +2 -2
- package/dist/chunks/{use-roles-C_Tj5wBH.js.map → use-roles-Daje0ikO.js.map} +1 -1
- package/dist/chunks/{use-shell-DBLG80kk.js → use-shell-BX9mzfaL.js} +2 -2
- package/dist/chunks/{use-shell-DBLG80kk.js.map → use-shell-BX9mzfaL.js.map} +1 -1
- package/dist/index.js +6 -6
- package/dist/index.js.map +1 -1
- package/dist/pages/account.js +9 -9
- package/dist/pages/approval.js +1 -1
- package/dist/pages/audit.js +96 -34
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +1 -1
- package/dist/pages/environment.js +10 -10
- package/dist/pages/login.js +2 -2
- package/dist/pages/oauth-authorize.js +1 -1
- package/dist/pages/project-access.js +9 -9
- package/dist/pages/project-environments.js +11 -11
- package/dist/pages/project-settings.js +7 -7
- package/dist/pages/project.js +2 -2
- package/dist/pages/projects.js +7 -7
- package/dist/pages/service-account.js +9 -9
- package/dist/pages/service-accounts.js +4 -4
- package/dist/pages/settings.js +6 -6
- package/dist/pages/unregistered.js +1 -1
- package/dist/pages/user.js +5 -5
- package/dist/pages/users.js +4 -4
- package/package.json +3 -3
- package/src/components/ui.tsx +25 -2
- package/src/lib/audit-sentences.ts +6 -2
- package/src/lib/queries.ts +81 -29
- package/src/options.ts +2 -3
- package/src/pages/audit.tsx +99 -26
- package/src/parity.ts +1 -1
- package/dist/chunks/queries-DEOPOpsT.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@coffre/ui",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "coffre's pages, for a deployment's own TanStack Start app: its router, and a Vite plugin for its build.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"@tanstack/router-core": "1.171.15",
|
|
45
45
|
"lucide-react": "1.47.0",
|
|
46
46
|
"sonner": "2.0.7",
|
|
47
|
-
"@coffre/
|
|
48
|
-
"@coffre/
|
|
47
|
+
"@coffre/core": "0.10.2",
|
|
48
|
+
"@coffre/client": "0.10.2"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"@tanstack/react-query": "5.103.1",
|
package/src/components/ui.tsx
CHANGED
|
@@ -356,6 +356,22 @@ export function ConfirmButton({
|
|
|
356
356
|
);
|
|
357
357
|
}
|
|
358
358
|
|
|
359
|
+
const hydrated = () => true;
|
|
360
|
+
const serverRender = () => false;
|
|
361
|
+
const unchanging = () => () => {};
|
|
362
|
+
|
|
363
|
+
/**
|
|
364
|
+
* Whether a dialog's root is drawn: always once the page is the browser's,
|
|
365
|
+
* which closes it with its animation; on the server and while hydrating,
|
|
366
|
+
* only when it is open. Closed, a dialog draws nothing, so the page's HTML
|
|
367
|
+
* is the same either way, and the server skips a root per dialog: four in
|
|
368
|
+
* each row of an environment's table. Its trigger is elsewhere, so mounting
|
|
369
|
+
* it after hydration remounts nothing else.
|
|
370
|
+
*/
|
|
371
|
+
function useHydrated(open: boolean): boolean {
|
|
372
|
+
return useSyncExternalStore(unchanging, hydrated, serverRender) || open;
|
|
373
|
+
}
|
|
374
|
+
|
|
359
375
|
/**
|
|
360
376
|
* The same confirmation, opened from something that is not a trigger.
|
|
361
377
|
*
|
|
@@ -368,6 +384,7 @@ export function ConfirmDialog({
|
|
|
368
384
|
onOpenChange,
|
|
369
385
|
...confirm
|
|
370
386
|
}: ConfirmProps & { open: boolean; onOpenChange: (open: boolean) => void }) {
|
|
387
|
+
if (!useHydrated(open)) return null;
|
|
371
388
|
return (
|
|
372
389
|
<AlertDialog.Root open={open} onOpenChange={onOpenChange}>
|
|
373
390
|
<ConfirmContent {...confirm} />
|
|
@@ -397,6 +414,7 @@ export function Modal({
|
|
|
397
414
|
children: ReactNode;
|
|
398
415
|
}) {
|
|
399
416
|
const { portal } = usePreferences();
|
|
417
|
+
if (!useHydrated(open)) return null;
|
|
400
418
|
return (
|
|
401
419
|
<Dialog.Root open={open} onOpenChange={onOpenChange}>
|
|
402
420
|
<Dialog.Portal container={portal}>
|
|
@@ -431,12 +449,17 @@ const RELATIVE_STEPS: [limit: number, divisor: number, unit: Intl.RelativeTimeFo
|
|
|
431
449
|
[Infinity, 31536000, 'year'],
|
|
432
450
|
];
|
|
433
451
|
|
|
452
|
+
/** One formatter per style, made once: making one costs more than a row of a page renders around it. */
|
|
453
|
+
const RELATIVE = {
|
|
454
|
+
long: new Intl.RelativeTimeFormat('en', { numeric: 'auto', style: 'long' }),
|
|
455
|
+
narrow: new Intl.RelativeTimeFormat('en', { numeric: 'auto', style: 'narrow' }),
|
|
456
|
+
};
|
|
457
|
+
|
|
434
458
|
function relative(iso: string, now: number, style: 'long' | 'narrow' = 'long'): string {
|
|
435
459
|
const delta = (new Date(iso).getTime() - now) / 1000;
|
|
436
460
|
const magnitude = Math.abs(delta);
|
|
437
461
|
const [, divisor, unit] = RELATIVE_STEPS.find(([limit]) => magnitude < limit)!;
|
|
438
|
-
|
|
439
|
-
return formatter.format(Math.round(delta / divisor), unit);
|
|
462
|
+
return RELATIVE[style].format(Math.round(delta / divisor), unit);
|
|
440
463
|
}
|
|
441
464
|
|
|
442
465
|
/** A UTC time as the log writes it: `2026-10-17 08:45:13`, to the millisecond when `precise`. */
|
|
@@ -262,11 +262,15 @@ const TEMPLATES: Record<string, Template> = {
|
|
|
262
262
|
return [...version, ...(level === 'plain' ? [', as a plain value, no secret'] : level === 'sensitive' ? [', as a sensitive value, shown to nobody'] : [])];
|
|
263
263
|
},
|
|
264
264
|
},
|
|
265
|
-
// The credential proxy's own entry beside the vault's read: which credential the keys went into, and
|
|
265
|
+
// The credential proxy's own entry beside the vault's read: which credential the keys went into, where, and by which road.
|
|
266
266
|
'credential.use': {
|
|
267
267
|
did: ({ entry }) => (entry.metadata.purpose === 'expose' ? 'was given the values of' : 'used the credential'),
|
|
268
268
|
tried: ({ entry }) => (entry.metadata.purpose === 'expose' ? 'be given the values of' : 'use the credential'),
|
|
269
|
-
what: ({ entry }) => [
|
|
269
|
+
what: ({ entry }) => [
|
|
270
|
+
text(entry.metadata.credential) ?? '',
|
|
271
|
+
...(text(entry.metadata.host) === null ? [] : [` on ${text(entry.metadata.host)}`]),
|
|
272
|
+
...(entry.metadata.egress === true ? [", through the deployment's egress"] : []),
|
|
273
|
+
],
|
|
270
274
|
},
|
|
271
275
|
'secret.restore': {
|
|
272
276
|
did: 'restored',
|
package/src/lib/queries.ts
CHANGED
|
@@ -17,9 +17,10 @@ import type { DirectoryPrincipal, GrantRow, Me, ProjectSummary } from '../shared
|
|
|
17
17
|
* names what it touches (`affects`), so your own changes always show.
|
|
18
18
|
* Someone else's change shows within that window. Nothing is decided on a
|
|
19
19
|
* cached read: the server authorizes every call, so a stale screen can offer
|
|
20
|
-
* an action the server then refuses, never grant one. The audit log
|
|
21
|
-
*
|
|
22
|
-
*
|
|
20
|
+
* an action the server then refuses, never grant one. The audit log is the
|
|
21
|
+
* exception, read fresh on every visit: its whole point is to be current.
|
|
22
|
+
* The chain's verification is read once a visit like the rest, and again
|
|
23
|
+
* after any change made here.
|
|
23
24
|
*/
|
|
24
25
|
export const FRESH_MS = 10_000;
|
|
25
26
|
|
|
@@ -318,12 +319,15 @@ export const queries = {
|
|
|
318
319
|
}),
|
|
319
320
|
|
|
320
321
|
/**
|
|
321
|
-
* Whether the log holds: verified
|
|
322
|
-
*
|
|
323
|
-
*
|
|
322
|
+
* Whether the log holds: verified with each visit, and rendered with the
|
|
323
|
+
* page, the loader's read to carry to the browser: it is not asked again on
|
|
324
|
+
* mount, and not for a filter change or a hover, which `FRESH_MS` covers.
|
|
325
|
+
* It reads what was written since the newest checkpoint, so it takes as
|
|
326
|
+
* long as five minutes of the log, however long the log. It never rejects:
|
|
327
|
+
* a check that could not run is its verdict (`unknown`).
|
|
324
328
|
*/
|
|
325
329
|
auditChain: (client: CoffreClient) =>
|
|
326
|
-
queryOptions({ queryKey: [...keys.audit, 'chain'],
|
|
330
|
+
queryOptions({ queryKey: [...keys.audit, 'chain'], refetchOnMount: false, queryFn: () => verifyChain(client) }),
|
|
327
331
|
/** What deleting `market` or `market/prod` would take, asked afresh each time it is shown. */
|
|
328
332
|
deletion: (client: CoffreClient, path: string) =>
|
|
329
333
|
queryOptions({
|
|
@@ -348,32 +352,66 @@ export const queries = {
|
|
|
348
352
|
*/
|
|
349
353
|
async function verifyChain(client: CoffreClient) {
|
|
350
354
|
try {
|
|
351
|
-
|
|
352
|
-
return result.ok
|
|
353
|
-
? {
|
|
354
|
-
integrity: 'intact' as const,
|
|
355
|
-
through: result.through,
|
|
356
|
-
entries: result.entries,
|
|
357
|
-
checkpoint: result.checkpoint,
|
|
358
|
-
pending: result.pending ?? 0,
|
|
359
|
-
}
|
|
360
|
-
: {
|
|
361
|
-
integrity: 'broken' as const,
|
|
362
|
-
through: result.through,
|
|
363
|
-
failedAtSeq: result.failedAtSeq,
|
|
364
|
-
author: result.author,
|
|
365
|
-
reason: result.reason,
|
|
366
|
-
};
|
|
355
|
+
return chainResult(await client.audit.verify(), false);
|
|
367
356
|
} catch (error) {
|
|
368
|
-
|
|
369
|
-
if (status === 403) return { integrity: 'owners-only' as const };
|
|
370
|
-
return {
|
|
371
|
-
integrity: 'unknown' as const,
|
|
372
|
-
problem: status === undefined ? 'the request never got an answer' : `the request failed with HTTP ${status}`,
|
|
373
|
-
};
|
|
357
|
+
return chainUnknown(error);
|
|
374
358
|
}
|
|
375
359
|
}
|
|
376
360
|
|
|
361
|
+
/**
|
|
362
|
+
* A verdict as the page shows it: `whole` when it comes from the walk
|
|
363
|
+
* from the first entry, which someone asked for, not from the newest
|
|
364
|
+
* checkpoint's.
|
|
365
|
+
*/
|
|
366
|
+
export function chainResult(result: Awaited<ReturnType<CoffreClient['audit']['verify']>>, whole: boolean) {
|
|
367
|
+
return result.ok
|
|
368
|
+
? {
|
|
369
|
+
integrity: 'intact' as const,
|
|
370
|
+
whole,
|
|
371
|
+
through: result.through,
|
|
372
|
+
entries: result.entries,
|
|
373
|
+
// A server older than 0.10.1 checked from the first entry, and reached the head.
|
|
374
|
+
from: result.from ?? 0,
|
|
375
|
+
remaining: result.remaining ?? 0,
|
|
376
|
+
checkpoint: result.checkpoint,
|
|
377
|
+
pending: result.pending ?? 0,
|
|
378
|
+
}
|
|
379
|
+
: {
|
|
380
|
+
integrity: 'broken' as const,
|
|
381
|
+
through: result.through,
|
|
382
|
+
failedAtSeq: result.failedAtSeq,
|
|
383
|
+
author: result.author,
|
|
384
|
+
reason: result.reason,
|
|
385
|
+
};
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* What the page shows, of the check from the newest checkpoint (`quick`)
|
|
390
|
+
* and the walk from the first entry, once someone ran it (`whole`). A break
|
|
391
|
+
* the walk found stands; otherwise the newer check says how the log is now,
|
|
392
|
+
* broken, partly checked or not checked at all; and only while it found the
|
|
393
|
+
* log whole too does the walk's verdict, which read further back, stand
|
|
394
|
+
* over it.
|
|
395
|
+
*
|
|
396
|
+
* whole broken → whole
|
|
397
|
+
* whole intact, quick intact with 0 remaining → whole
|
|
398
|
+
* whole intact, quick anything else → quick
|
|
399
|
+
*/
|
|
400
|
+
export function shownChain(quick: ChainResult, whole: ChainResult | null): ChainResult {
|
|
401
|
+
if (whole === null || whole.integrity === 'broken') return whole ?? quick;
|
|
402
|
+
return quick.integrity === 'intact' && quick.remaining === 0 && whole.integrity === 'intact' ? whole : quick;
|
|
403
|
+
}
|
|
404
|
+
|
|
405
|
+
/** Why the log's verdict is not known: closed to the caller, or no answer. */
|
|
406
|
+
export function chainUnknown(error: unknown) {
|
|
407
|
+
const status = statusOf(error);
|
|
408
|
+
if (status === 403) return { integrity: 'owners-only' as const };
|
|
409
|
+
return {
|
|
410
|
+
integrity: 'unknown' as const,
|
|
411
|
+
problem: status === undefined ? 'the request never got an answer' : `the request failed with HTTP ${status}`,
|
|
412
|
+
};
|
|
413
|
+
}
|
|
414
|
+
|
|
377
415
|
export type ChainResult = Awaited<ReturnType<typeof verifyChain>>;
|
|
378
416
|
|
|
379
417
|
/**
|
|
@@ -490,6 +528,20 @@ export async function loadEnvironment(queryClient: QueryClient, client: CoffreCl
|
|
|
490
528
|
return secrets;
|
|
491
529
|
}
|
|
492
530
|
|
|
531
|
+
/**
|
|
532
|
+
* What the audit page reads: a page of the log and the verification from
|
|
533
|
+
* the newest checkpoint, asked together and rendered together, so the badge
|
|
534
|
+
* arrives with the page. The verification never fails the load: a check that
|
|
535
|
+
* could not run is its verdict.
|
|
536
|
+
*/
|
|
537
|
+
export async function loadAudit(queryClient: QueryClient, client: CoffreClient, search: AuditSearch) {
|
|
538
|
+
const [entries] = await Promise.all([
|
|
539
|
+
queryClient.fetchQuery(queries.auditEntries(client, search)),
|
|
540
|
+
queryClient.fetchQuery(queries.auditChain(client)),
|
|
541
|
+
]);
|
|
542
|
+
return entries;
|
|
543
|
+
}
|
|
544
|
+
|
|
493
545
|
/** The directory pages' read: the directory, for owners. */
|
|
494
546
|
export async function loadDirectory(queryClient: QueryClient, client: CoffreClient) {
|
|
495
547
|
const shell = await loadShell(queryClient, client);
|
package/src/options.ts
CHANGED
|
@@ -24,6 +24,7 @@ import { memberRef, uiResult } from './lib/coffre';
|
|
|
24
24
|
import { stringsOf } from './lib/search';
|
|
25
25
|
import {
|
|
26
26
|
hasAppsTab,
|
|
27
|
+
loadAudit,
|
|
27
28
|
loadDirectory,
|
|
28
29
|
loadEnvironment,
|
|
29
30
|
loadMember,
|
|
@@ -173,11 +174,9 @@ export const audit = {
|
|
|
173
174
|
detail: search.detail === '1' || search.decision === 'deny' ? '1' : undefined,
|
|
174
175
|
}),
|
|
175
176
|
loaderDeps: ({ search }: { search: AuditSearch }) => search,
|
|
176
|
-
// The entries only: the verification is asked for once the page is up
|
|
177
|
-
// (`ChainStatus`), so the table never waits on it.
|
|
178
177
|
loader: ({ context, deps }: Loader & { deps: AuditSearch }) => {
|
|
179
178
|
const { coffre, queryClient } = coffreOf(context);
|
|
180
|
-
return queryClient
|
|
179
|
+
return loadAudit(queryClient, coffre, deps);
|
|
181
180
|
},
|
|
182
181
|
};
|
|
183
182
|
|
package/src/pages/audit.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { type AuditEntryView } from '@coffre/client';
|
|
2
2
|
import { useState, type ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { useSuspenseQuery } from '@tanstack/react-query';
|
|
4
4
|
import { Link } from '@tanstack/react-router';
|
|
5
5
|
import { useCoffre } from '../lib/coffre';
|
|
6
|
-
import { queries, type AuditSearch, type ChainResult } from '../lib/queries';
|
|
6
|
+
import { chainResult, chainUnknown, queries, shownChain, type AuditSearch, type ChainResult } from '../lib/queries';
|
|
7
7
|
import {
|
|
8
8
|
decidedBy,
|
|
9
9
|
describe,
|
|
@@ -37,9 +37,31 @@ export function AuditPage() {
|
|
|
37
37
|
const search = Route.useSearch();
|
|
38
38
|
const client = useCoffre();
|
|
39
39
|
const { data: result } = useSuspenseQuery(queries.auditEntries(client, search));
|
|
40
|
-
//
|
|
41
|
-
const verification =
|
|
42
|
-
|
|
40
|
+
// Loaded with the entries: the page arrives with its badge.
|
|
41
|
+
const verification = useSuspenseQuery(queries.auditChain(client));
|
|
42
|
+
// The walk from the first entry, once someone ran it, beside the check from the newest checkpoint, which
|
|
43
|
+
// the page reuses for `FRESH_MS` and asks again after that, after a change made here, or on Retry:
|
|
44
|
+
// `shownChain` says which the page shows, until the page is left.
|
|
45
|
+
const [whole, setWhole] = useState<ChainResult | null>(null);
|
|
46
|
+
const chain = shownChain(verification.data, whole);
|
|
47
|
+
// The walk from the first entry, when someone asks for it: how far it has got. Its verdict takes the badge's place.
|
|
48
|
+
const [walked, setWalked] = useState<{ through: number | null } | null>(null);
|
|
49
|
+
const [walkFailed, setWalkFailed] = useState<string | null>(null);
|
|
50
|
+
const walkWhole = async () => {
|
|
51
|
+
setWalked({ through: null });
|
|
52
|
+
setWalkFailed(null);
|
|
53
|
+
setWhole(null);
|
|
54
|
+
let verdict: ChainResult;
|
|
55
|
+
try {
|
|
56
|
+
verdict = chainResult(await client.audit.verifyWhole((stretch) => setWalked({ through: stretch.through })), true);
|
|
57
|
+
} catch (error) {
|
|
58
|
+
verdict = chainUnknown(error);
|
|
59
|
+
}
|
|
60
|
+
// A walk that could not run says nothing of the log: the verdict from the newest checkpoint stands.
|
|
61
|
+
if (verdict.integrity === 'unknown') setWalkFailed(verdict.problem);
|
|
62
|
+
else if (verdict.integrity !== 'owners-only') setWhole(verdict);
|
|
63
|
+
setWalked(null);
|
|
64
|
+
};
|
|
43
65
|
const { decision, actorId } = search;
|
|
44
66
|
const detail = search.detail === '1';
|
|
45
67
|
const deniedOnly = decision === 'deny';
|
|
@@ -64,7 +86,14 @@ export function AuditPage() {
|
|
|
64
86
|
actions={
|
|
65
87
|
// One region for every state, so each change of it is announced.
|
|
66
88
|
<div className="chain-live" aria-live="polite" aria-atomic="true">
|
|
67
|
-
<ChainStatus
|
|
89
|
+
<ChainStatus
|
|
90
|
+
chain={chain}
|
|
91
|
+
walked={walked}
|
|
92
|
+
walkFailed={walkFailed}
|
|
93
|
+
retrying={verification.isFetching}
|
|
94
|
+
onRetry={() => void verification.refetch()}
|
|
95
|
+
onWalk={() => void walkWhole()}
|
|
96
|
+
/>
|
|
68
97
|
</div>
|
|
69
98
|
}
|
|
70
99
|
/>
|
|
@@ -368,16 +397,35 @@ function BreakMark() {
|
|
|
368
397
|
* someone is already feeling confident, and not on the morning it would have
|
|
369
398
|
* mattered. Recomputing on load makes the claim continuous.
|
|
370
399
|
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
*
|
|
400
|
+
* On load it checks what was written since the newest checkpoint, which
|
|
401
|
+
* vouches for everything before, so it is quick however long the log. The
|
|
402
|
+
* walk from the first entry, which checks again what the checkpoints vouch
|
|
403
|
+
* for, is there to ask for, a stretch a request, with how far it has got.
|
|
404
|
+
* The check on load is rendered with the page, never a loading state; a
|
|
405
|
+
* check that could not run says so and offers to run again, rather than
|
|
406
|
+
* passing for a broken log.
|
|
374
407
|
*/
|
|
375
|
-
function ChainStatus({
|
|
376
|
-
|
|
408
|
+
function ChainStatus({
|
|
409
|
+
chain,
|
|
410
|
+
walked,
|
|
411
|
+
walkFailed,
|
|
412
|
+
retrying,
|
|
413
|
+
onRetry,
|
|
414
|
+
onWalk,
|
|
415
|
+
}: {
|
|
416
|
+
chain: ChainResult;
|
|
417
|
+
walked: { through: number | null } | null;
|
|
418
|
+
walkFailed: string | null;
|
|
419
|
+
/** The check on load is being asked again. */
|
|
420
|
+
retrying: boolean;
|
|
421
|
+
onRetry: () => void;
|
|
422
|
+
onWalk: () => void;
|
|
423
|
+
}) {
|
|
424
|
+
if (walked !== null) {
|
|
377
425
|
return (
|
|
378
|
-
<span className="chain-note">
|
|
426
|
+
<span className="chain-note" role="status">
|
|
379
427
|
<Spinner size={14} />
|
|
380
|
-
Verifying…
|
|
428
|
+
{walked.through === null ? 'Verifying from the first entry…' : `Verified through ${walked.through.toLocaleString('en')}…`}
|
|
381
429
|
</span>
|
|
382
430
|
);
|
|
383
431
|
}
|
|
@@ -408,7 +456,7 @@ function ChainStatus({ chain, onRetry }: { chain: ChainResult | undefined; onRet
|
|
|
408
456
|
Couldn’t verify
|
|
409
457
|
</button>
|
|
410
458
|
</Toggletip>
|
|
411
|
-
<button type="button" className="btn btn-sm" onClick={onRetry}>
|
|
459
|
+
<button type="button" className="btn btn-sm" disabled={retrying} onClick={onRetry}>
|
|
412
460
|
Retry
|
|
413
461
|
</button>
|
|
414
462
|
</div>
|
|
@@ -424,6 +472,12 @@ function ChainStatus({ chain, onRetry }: { chain: ChainResult | undefined; onRet
|
|
|
424
472
|
);
|
|
425
473
|
}
|
|
426
474
|
|
|
475
|
+
const signed = chain.checkpoint === null ? null : `${absolute(chain.checkpoint.signedAt, false)} UTC`;
|
|
476
|
+
const verified = chain.whole
|
|
477
|
+
? `Audit log verified from its first entry by the app and vault keys${signed === null ? ', not signed yet' : `, last signature at ${signed}`}.`
|
|
478
|
+
: signed === null
|
|
479
|
+
? 'Audit log verified by the app and vault keys, not signed yet.'
|
|
480
|
+
: `What was written since the last checkpoint verified by the app and vault keys; the checkpoint, signed at ${signed}, vouches for everything before it, as each was checked when it was written.`;
|
|
427
481
|
return (
|
|
428
482
|
<div className="chain">
|
|
429
483
|
{chain.pending > 0 && (
|
|
@@ -436,19 +490,38 @@ function ChainStatus({ chain, onRetry }: { chain: ChainResult | undefined; onRet
|
|
|
436
490
|
</button>
|
|
437
491
|
</Toggletip>
|
|
438
492
|
)}
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
chain.
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
493
|
+
{chain.remaining > 0 && (
|
|
494
|
+
<Toggletip
|
|
495
|
+
align="end"
|
|
496
|
+
label={`Verified through entry ${chain.through?.toLocaleString('en') ?? 'none'}. The checkpoints are catching up with the log, a stretch every five minutes, and a check goes no further than they have.`}
|
|
497
|
+
>
|
|
498
|
+
<button type="button" className="chain-note" role="status">
|
|
499
|
+
{chain.remaining.toLocaleString('en')} newer {chain.remaining === 1 ? 'entry' : 'entries'} to verify
|
|
500
|
+
</button>
|
|
501
|
+
</Toggletip>
|
|
502
|
+
)}
|
|
503
|
+
{walkFailed !== null && (
|
|
504
|
+
<Toggletip align="end" label={`coffre could not walk the whole log: ${walkFailed}. The verdict beside it, from the newest checkpoint, stands.`}>
|
|
505
|
+
<button type="button" className="chain-flag chain-flag-warn">
|
|
506
|
+
<AlertTriangle size={14} />
|
|
507
|
+
Whole log not checked
|
|
508
|
+
</button>
|
|
509
|
+
</Toggletip>
|
|
510
|
+
)}
|
|
511
|
+
{!chain.whole && chain.remaining === 0 && (
|
|
512
|
+
<button type="button" className="btn btn-sm" onClick={onWalk}>
|
|
513
|
+
Verify whole log
|
|
450
514
|
</button>
|
|
451
|
-
|
|
515
|
+
)}
|
|
516
|
+
{/* No seal over a log verified only in part: what is left could be anything. */}
|
|
517
|
+
{chain.remaining === 0 && (
|
|
518
|
+
<Toggletip align="end" label={verified}>
|
|
519
|
+
<button type="button" className="chain-seal">
|
|
520
|
+
<ShieldCheck size={14} />
|
|
521
|
+
Verified
|
|
522
|
+
</button>
|
|
523
|
+
</Toggletip>
|
|
524
|
+
)}
|
|
452
525
|
</div>
|
|
453
526
|
);
|
|
454
527
|
}
|
package/src/parity.ts
CHANGED
|
@@ -184,7 +184,7 @@ export const UI_PARITY: { [K in RouteKey]: Reach } = {
|
|
|
184
184
|
{ does: "a user's or service account's page › Activity", in: 'components/actions-log.tsx', call: 'audit.list' },
|
|
185
185
|
],
|
|
186
186
|
},
|
|
187
|
-
'GET /audit/verification': { ui: [{ does: "Audit: the log's seal, verified
|
|
187
|
+
'GET /audit/verification': { ui: [{ does: "Audit: the log's seal, verified with every visit", in: 'pages/audit.tsx', call: 'audit.verify' }] },
|
|
188
188
|
'GET /roles': {
|
|
189
189
|
ui: [
|
|
190
190
|
{ does: 'Settings › Roles and Instance roles; every grant picker, for the roles it offers', in: 'lib/queries.ts', call: 'roles.list' },
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"queries-DEOPOpsT.js","names":[],"sources":["../../src/lib/project-environments.ts","../../src/lib/capabilities.ts","../../src/lib/queries.ts"],"sourcesContent":["import type { ProjectSummary } from '../shared/models';\n\nexport type ProjectEnvironment = ProjectSummary['environments'][number];\nexport type DetailedProjectEnvironment = ProjectEnvironment & {\n details: NonNullable<ProjectEnvironment['details']>;\n};\n\nexport function hasEnvironmentDetails(\n environment: ProjectEnvironment,\n): environment is DetailedProjectEnvironment {\n return environment.details !== null;\n}\n\nexport function isActiveAccessibleEnvironment(\n environment: ProjectEnvironment,\n): environment is ProjectEnvironment & {\n accessible: true;\n details: { archivedAt: null; secretCount: number };\n} {\n return environment.accessible\n && environment.details !== null\n && environment.details.archivedAt === null;\n}\n","import { administers, makesProjects, ownsInstance } from '@coffre/core/access';\n\nimport type { Me, Permission, ProjectSummary } from '../shared/models';\n\n/**\n * The small set of instance-wide decisions the shell has to make.\n *\n * Resource-specific controls still use the permissions returned for that\n * project or environment. These are only the capabilities whose affordances\n * live outside one resource page.\n */\nexport type UiCapabilities = {\n /** Admins and owners, scoped or not: the Users and Service accounts pages. */\n canManageGrants: boolean;\n /**\n * Admins and owners whose scope narrows nothing: adding and removing\n * people and service accounts, instance roles, tokens and trust bindings,\n * offboarding reports, the instance's keys.\n */\n runsInstance: boolean;\n /**\n * Owners whose scope narrows nothing: they alone make someone an Owner,\n * and change or remove one, their own role included.\n */\n ownsInstance: boolean;\n /**\n * Who sets up service accounts: those who run the instance, and a person\n * who holds access somewhere the instance's setting takes in. The Service\n * accounts page lists them the ones they manage.\n */\n setsUpServices: boolean;\n canReadAudit: boolean;\n canCreateProject: boolean;\n};\n\nconst NONE: UiCapabilities = {\n canManageGrants: false,\n runsInstance: false,\n ownsInstance: false,\n setsUpServices: false,\n canReadAudit: false,\n canCreateProject: false,\n};\n\nexport function deriveUiCapabilities(\n me: Me | null,\n projects: readonly ProjectSummary[],\n): UiCapabilities {\n if (me === null) return NONE;\n\n const role = me.instanceRole;\n\n return {\n // Users and Service accounts list the instance's directory, for those\n // who manage access across projects. Project access managers keep their\n // grant controls on each project page.\n canManageGrants: administers(role),\n runsInstance: me.runsInstance,\n ownsInstance: ownsInstance({ role, scope: me.scope }),\n setsUpServices: me.setsUpServices,\n canReadAudit: me.canReadAudit,\n // A new project is one no `only` list names: as the server decides,\n // from the role and the scope, projects by slug.\n canCreateProject: makesProjects({ role, scope: me.scope, grants: [] }),\n };\n}\n\n/** Secret values are available only where the API reports secret.read. */\nexport function canRevealSecrets(permissions: readonly Permission[]): boolean {\n return permissions.includes('secret.read');\n}\n","import type { AuthInfo, CoffreClient, Member } from '@coffre/client';\nimport { EVERYWHERE, INSTANCE_ROLES } from '@coffre/core/access';\nimport { QueryClient, queryOptions, type FetchQueryOptions, type QueryKey } from '@tanstack/react-query';\n\nimport { deriveUiCapabilities } from './capabilities.ts';\nimport { memberRef, statusOf, uiResult } from './coffre.ts';\nimport { isActiveAccessibleEnvironment } from './project-environments.ts';\nimport type { DirectoryPrincipal, GrantRow, Me, ProjectSummary } from '../shared/models';\n\n/**\n * Every read the pages make, cached by TanStack Query: one cache per request\n * on the server, whose reads the page carries to the browser's, and one in the\n * browser for the whole visit.\n *\n * How fresh a page is. A read is reused for `FRESH_MS`, refetched when the\n * window regains focus, and refetched at once by any change made here, which\n * names what it touches (`affects`), so your own changes always show.\n * Someone else's change shows within that window. Nothing is decided on a\n * cached read: the server authorizes every call, so a stale screen can offer\n * an action the server then refuses, never grant one. The audit log and the\n * chain's verification are the exception, read fresh on every visit: their\n * whole point is to be current.\n */\nexport const FRESH_MS = 10_000;\n\nexport function createQueryClient(): QueryClient {\n return new QueryClient({\n defaultOptions: {\n queries: {\n staleTime: FRESH_MS,\n refetchOnWindowFocus: true,\n // A read either answers or says why it cannot (`uiResult`), so a\n // throw is a fault, and asking again would only repeat it.\n retry: false,\n },\n },\n });\n}\n\ntype Place = { project: string; environment: string };\n\n/**\n * The keys, which `affects` names too. A project's keys start with it, so\n * one invalidation covers everything read under it.\n */\nexport const keys = {\n me: ['me'],\n auth: ['auth'],\n projects: ['projects'],\n grants: (project: string) => ['grants', project],\n secrets: ({ project, environment }: Place) => ['secrets', project, environment],\n references: (path: string) => ['references', path],\n missing: ({ project, environment }: Place) => ['missing', project, environment],\n personal: (project: string) => ['personal', project],\n directory: ['directory'],\n report: (member: string) => ['report', member],\n memberAccess: (member: string) => ['member-access', member],\n credentials: (member: string) => ['credentials', member],\n bindings: (member: string) => ['bindings', member],\n githubRepositories: ['github-repositories'],\n identities: ['identities'],\n sessions: ['sessions'],\n apps: ['apps'],\n audit: ['audit'],\n auditKeys: ['audit', 'keys'],\n settings: ['settings'],\n roles: ['roles'],\n} satisfies Record<string, QueryKey | ((...args: never[]) => QueryKey)>;\n\n/** Members' grants, as rows, and a row for each one whose instance role reaches the place listed. */\nfunction grantRows(members: Member[]): GrantRow[] {\n return members.flatMap((member): GrantRow[] => [\n ...(member.reachesByRole\n ? [{\n id: `${member.member}/instance-role`,\n principalType: member.principalType,\n principalId: member.principalId,\n role: member.instanceRole,\n roleName: INSTANCE_ROLES[member.instanceRole].name,\n permissions: [...INSTANCE_ROLES[member.instanceRole].permissions],\n scope: 'instance-role' as const,\n environmentSlug: null,\n expiresAt: null,\n }]\n : []),\n ...member.grants.map((grant) => ({\n id: grant.id,\n principalType: member.principalType,\n principalId: member.principalId,\n role: grant.role,\n roleName: grant.roleName,\n permissions: grant.permissions,\n scope: grant.environment === null ? ('project' as const) : ('environment' as const),\n environmentSlug: grant.environment,\n expiresAt: grant.expiresAt,\n })),\n ]);\n}\n\nfunction listDirectory(client: CoffreClient) {\n return uiResult(async () => {\n const { members, removed } = await client.members.list();\n const principals: DirectoryPrincipal[] = members.map(\n ({ principalType, principalId, instanceRole, scope, tampered, managed, declared, grants }) => ({\n principalType,\n principalId,\n instanceRole,\n scope,\n tampered,\n managed,\n declared,\n grants: grants.map(({ project, environment }) => ({ project, environment })),\n }),\n );\n return { principals, removed };\n });\n}\n\nconst readProjects = (client: CoffreClient) => uiResult(() => client.projects.list());\n\n/** The projects you can see, or why they could not be listed. */\nexport type ProjectsResult = Awaited<ReturnType<typeof readProjects>>;\n\nexport type AuditSearch = { decision?: 'deny'; actorId?: string; detail?: '1' };\n\nexport const AUDIT_PAGE_SIZE = 200;\n\nexport const queries = {\n /** Who is looking; null when nobody is signed in. */\n me: (client: CoffreClient) =>\n queryOptions({\n queryKey: keys.me,\n queryFn: async (): Promise<Me | null> => {\n try {\n return await client.me();\n } catch (error) {\n if (statusOf(error) === 401) return null;\n throw error;\n }\n },\n }),\n\n /** How this instance signs people in. */\n auth: (client: CoffreClient) => queryOptions({ queryKey: keys.auth, queryFn: (): Promise<AuthInfo> => client.auth() }),\n\n /** The projects you can see, each with its distinct secret count. */\n projects: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.projects, queryFn: () => readProjects(client) }),\n\n /**\n * The repositories the deployment's GitHub App is installed on, for the\n * Trust dialog's picker; `{ app: null }` without one. Each listing asks\n * GitHub, so it is kept a minute, and not asked again on focus.\n */\n githubRepositories: (client: CoffreClient) =>\n queryOptions({\n queryKey: keys.githubRepositories,\n queryFn: () => client.bindings.repositories(),\n staleTime: 60_000,\n refetchOnWindowFocus: false,\n }),\n\n /** Who holds what in a project, for those who manage its access. */\n grants: (client: CoffreClient, project: string) =>\n queryOptions({\n queryKey: keys.grants(project),\n queryFn: () => uiResult(async () => ({ grants: grantRows((await client.members.list(project)).members) })),\n }),\n\n secrets: (client: CoffreClient, place: Place) =>\n queryOptions({\n queryKey: keys.secrets(place),\n queryFn: () => uiResult(() => client.secrets.list(`${place.project}/${place.environment}`)),\n }),\n\n /** What an environment lacks of its siblings' keys, read or not, and what its team dismissed. */\n missing: (client: CoffreClient, place: Place) =>\n queryOptions({\n queryKey: keys.missing(place),\n queryFn: () => uiResult(() => client.environments.missing(`${place.project}/${place.environment}`)),\n }),\n\n /** A project's personal configs, for whoever manages its environments: whose, of what, and their key names. */\n personal: (client: CoffreClient, project: string) =>\n queryOptions({\n queryKey: keys.personal(project),\n queryFn: () => uiResult(() => client.environments.personal(project)),\n }),\n\n /** The live references into and out of a place, and who reads through them, for whoever manages its access. */\n references: (client: CoffreClient, path: string) =>\n queryOptions({\n queryKey: keys.references(path),\n queryFn: () => uiResult(() => client.references.list(path)),\n }),\n\n /**\n * Everyone in the directory, and who was removed. The API shows grant\n * managers the members of their projects; the directory pages are admins'\n * and owners', and asking for anyone else would only log a refusal, so\n * nobody else is asked.\n */\n directory: (client: CoffreClient, owner: boolean) =>\n queryOptions({\n queryKey: [...keys.directory, { owner }],\n queryFn: () =>\n owner\n ? listDirectory(client)\n : Promise.resolve({\n ok: false as const,\n error: 'Only admins and owners manage users, and service accounts are set up by those who hold access where the instance lets them.',\n signedOut: false,\n }),\n }),\n\n /**\n * One member's instance role and scope, and the grants you manage, in one\n * read: their page's Access tab. Null for whoever may list nobody, which\n * asking would only log as a refusal.\n */\n memberAccess: (client: CoffreClient, member: string, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.memberAccess(member), { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.members.access(member)) : Promise.resolve(null)),\n }),\n\n /** What one member can reach and has seen; null for anyone but owners, who alone may ask. */\n report: (client: CoffreClient, member: string, owner: boolean) =>\n queryOptions({\n queryKey: [...keys.report(member), { owner }],\n queryFn: () =>\n owner\n ? uiResult(async () => {\n try {\n return { report: await client.members.get(member) };\n } catch (error) {\n // No such member is an answer, not a failure.\n if (statusOf(error) === 404) return { report: null };\n throw error;\n }\n })\n : Promise.resolve(null),\n }),\n\n /**\n * A token's credentials; null where they cannot be listed. Only owners\n * issue and see them, and only coffre's own sign-in issues any.\n */\n credentials: (client: CoffreClient, member: string, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.credentials(member), { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.tokens.list(member)) : Promise.resolve(null)),\n }),\n\n /**\n * A token's trust bindings: the CI runs that may sign in as it. Null for\n * anyone but an owner, and where the deployment trusts no workloads\n * (`features.workloads`), so there is nothing to ask.\n */\n bindings: (client: CoffreClient, member: string, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.bindings(member), { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.bindings.list(member)) : Promise.resolve(null)),\n }),\n\n /** The accounts you sign in with, under coffre's own sign-in. */\n identities: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.identities, queryFn: () => uiResult(() => client.identities.list()) }),\n\n /** Where you are signed in, under coffre's own sign-in. */\n sessions: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.sessions, queryFn: () => uiResult(() => client.sessions.list()) }),\n /** The MCP clients I connected, where the deployment serves MCP (`features.mcp`). */\n apps: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.apps, queryFn: () => uiResult(() => client.apps.list()) }),\n\n /**\n * What the keys an operator keeps are checked against: the vault's ID and\n * the app key's fingerprint, no secret. Null for anyone but owners and root\n * admins, who alone may ask.\n */\n auditKeys: (client: CoffreClient, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.auditKeys, { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.audit.keys()) : Promise.resolve(null)),\n }),\n\n /** The instance's settings: null for anyone but those who run it, who alone may ask. */\n settings: (client: CoffreClient, allowed: boolean) =>\n queryOptions({\n queryKey: [...keys.settings, { allowed }],\n queryFn: () => (allowed ? uiResult(() => client.settings.get()) : Promise.resolve(null)),\n }),\n\n /**\n * The instance's roles and instance roles, as an Owner edited and made\n * them (docs/design/roles.md), and whether the caller edits them. Any\n * member reads them: they are what every grant picker offers.\n */\n roles: (client: CoffreClient) =>\n queryOptions({ queryKey: keys.roles, queryFn: () => uiResult(() => client.roles.list()) }),\n\n /** A page of the log, as filtered: always read fresh. */\n auditEntries: (client: CoffreClient, search: AuditSearch) =>\n queryOptions({\n queryKey: [...keys.audit, 'entries', search],\n staleTime: 0,\n // Detail is left out by the server unless asked for, and counted.\n queryFn: () =>\n uiResult(() =>\n client.audit.list({\n limit: AUDIT_PAGE_SIZE,\n decision: search.decision,\n actor: search.actorId,\n detail: search.detail,\n }),\n ),\n }),\n\n /**\n * Whether the log holds: verified on every visit, and never waited for.\n * It re-reads the whole log, so it takes as long as the log is long; the\n * page shows the entries first and the verdict when it comes.\n */\n auditChain: (client: CoffreClient) =>\n queryOptions({ queryKey: [...keys.audit, 'chain'], staleTime: 0, queryFn: () => verifyChain(client) }),\n /** What deleting `market` or `market/prod` would take, asked afresh each time it is shown. */\n deletion: (client: CoffreClient, path: string) =>\n queryOptions({\n queryKey: ['deletion', path],\n staleTime: 0,\n gcTime: 0,\n queryFn: () =>\n uiResult(async () => {\n const { deletion } = path.includes('/')\n ? await client.environments.previewDelete(path)\n : await client.projects.previewDelete(path);\n return { deletion };\n }),\n }),\n};\n\n/**\n * Whether the log holds, or why that is not known. Verifying is for those\n * who read the whole log (an Auditor, Admin or Owner whose scope narrows\n * nothing): anyone else reads their projects' part of it, and a part cannot be\n * checked as a chain, so for them it is a fact about the page, not a fault.\n */\nasync function verifyChain(client: CoffreClient) {\n try {\n const result = await client.audit.verify();\n return result.ok\n ? {\n integrity: 'intact' as const,\n through: result.through,\n entries: result.entries,\n checkpoint: result.checkpoint,\n pending: result.pending ?? 0,\n }\n : {\n integrity: 'broken' as const,\n through: result.through,\n failedAtSeq: result.failedAtSeq,\n author: result.author,\n reason: result.reason,\n };\n } catch (error) {\n const status = statusOf(error);\n if (status === 403) return { integrity: 'owners-only' as const };\n return {\n integrity: 'unknown' as const,\n problem: status === undefined ? 'the request never got an answer' : `the request failed with HTTP ${status}`,\n };\n }\n}\n\nexport type ChainResult = Awaited<ReturnType<typeof verifyChain>>;\n\n/**\n * Who is looking, how this instance signs people in, and the projects they\n * can see: what the shell needs on every screen. For someone signed out or\n * not yet a member the project list is refused, and they get the sign-in or\n * closed-door page.\n */\nexport function shellOf(\n auth: AuthInfo,\n me: Me | null,\n projects: ProjectsResult,\n) {\n const listed = projects.ok ? projects.projects : [];\n const member: Me | null = me?.registered === true ? me : null;\n return {\n auth,\n principal: me === null ? null : me.principal,\n instanceRole: member?.instanceRole ?? null,\n /** Where their instance role applies, projects by slug. */\n scope: member?.scope ?? EVERYWHERE,\n projects: listed,\n capabilities: deriveUiCapabilities(member, listed),\n registrationRequired: me !== null && !me.registered,\n /** A member the vault refuses: their record failed its integrity check. */\n accessTampered: me?.tampered === true,\n /** What the deployment's configuration turns on: MCP clients, as their endpoint's URL, and CI runs signing in by their ID tokens. */\n features: member?.features ?? { mcp: null, workloads: false },\n /** Every environment you hold something in, and what: what you may give a service account there (`givable`). */\n environments: member?.environments ?? [],\n /** Where you set up service accounts yourself, the instance's setting, projects by slug. */\n serviceSetup: member?.serviceSetup ?? null,\n };\n}\n\nexport type Shell = ReturnType<typeof shellOf>;\n\n/**\n * How a loader reads. `fresh`, a page's own reads: the cached answer within\n * `FRESH_MS`, else the network's, waited for. `cached`, a tab's: its page's\n * layout has read the same, so it takes the cached answer at once, however\n * old, and refetches behind it, and switching tabs never waits on the\n * network. A read the cache lacks is waited for either way.\n */\nexport type Freshness = 'fresh' | 'cached';\n\nfunction read<T, TKey extends QueryKey>(queryClient: QueryClient, options: FetchQueryOptions<T, Error, T, TKey>, freshness: Freshness): Promise<T> {\n return freshness === 'fresh' ? queryClient.fetchQuery(options) : queryClient.ensureQueryData({ ...options, revalidateIfStale: true });\n}\n\n/**\n * Whether a tab may open: from the cache, and where the cache says no, from\n * the network, which a no needs before the tab sends anyone away. A stale\n * no could be an account since added back, or a role since given.\n */\nexport async function tabOpens(opens: (freshness: Freshness) => Promise<boolean>): Promise<boolean> {\n return (await opens('cached')) || opens('fresh');\n}\n\n/**\n * The shell, as every loader reads it: from the cache while fresh, so a\n * child route never asks again for what the root has.\n */\nexport async function loadShell(queryClient: QueryClient, client: CoffreClient, freshness: Freshness = 'fresh'): Promise<Shell> {\n const [auth, me, projects] = await Promise.all([\n read(queryClient, queries.auth(client), freshness),\n read(queryClient, queries.me(client), freshness),\n read(queryClient, queries.projects(client), freshness),\n ]);\n return shellOf(auth, me, projects);\n}\n\n/**\n * One project and, when you manage its access, its grants. A project that is\n * not there for you fails with no message: the page words that itself.\n */\nexport function projectOf(projects: ProjectsResult, slug: string) {\n if (!projects.ok) return projects;\n const project = projects.projects.find((entry) => entry.slug === slug);\n if (project === undefined) return { ok: false as const, error: null };\n return { ok: true as const, project, managesAccess: project.permissions.includes('grant.manage') };\n}\n\n/** What a project page reads: the project list, and its grants when you manage them. */\nexport async function loadProject(queryClient: QueryClient, client: CoffreClient, slug: string) {\n const found = projectOf(await queryClient.fetchQuery(queries.projects(client)), slug);\n if (found.ok && found.managesAccess) await queryClient.fetchQuery(queries.grants(client, slug));\n}\n\n/**\n * What an environment's page reads: its secrets and, for whoever reads them,\n * the references that read them from elsewhere and the keys it lacks,\n * rendered with them. Where the project tree the shell holds says you read\n * it, all three are asked at once, one round trip; elsewhere the others wait\n * for the secrets, so a refused visit is one refusal in the log, not three.\n */\nexport async function loadEnvironment(queryClient: QueryClient, client: CoffreClient, place: Place) {\n const others = () =>\n Promise.all([\n queryClient.fetchQuery(queries.references(client, `${place.project}/${place.environment}`)),\n queryClient.fetchQuery(queries.missing(client, place)),\n ]);\n const found = projectOf(await queryClient.ensureQueryData(queries.projects(client)), place.project);\n // Neither in an archived project nor archived itself: the API serves neither.\n const here = found.ok && found.project.archivedAt === null\n ? found.project.environments.find((environment) => environment.slug === place.environment)\n : undefined;\n if (here !== undefined && isActiveAccessibleEnvironment(here)) {\n const [secrets] = await Promise.all([queryClient.fetchQuery(queries.secrets(client, place)), others()]);\n return secrets;\n }\n const secrets = await queryClient.fetchQuery(queries.secrets(client, place));\n if (secrets.ok) await others();\n return secrets;\n}\n\n/** The directory pages' read: the directory, for owners. */\nexport async function loadDirectory(queryClient: QueryClient, client: CoffreClient) {\n const shell = await loadShell(queryClient, client);\n return queryClient.fetchQuery(queries.directory(client, shell.capabilities.canManageGrants));\n}\n\n/** The instance's settings: the directory's counts, where people set up service accounts, and what its keys are checked against. */\nexport async function loadSettings(queryClient: QueryClient, client: CoffreClient) {\n const shell = await loadShell(queryClient, client);\n await Promise.all([\n loadDirectory(queryClient, client),\n queryClient.fetchQuery(queries.settings(client, shell.capabilities.runsInstance)),\n queryClient.fetchQuery(queries.auditKeys(client, shell.capabilities.runsInstance)),\n queryClient.fetchQuery(queries.roles(client)),\n ]);\n}\n\n/** Whether the Service accounts page lists anyone: to admins and owners, and to whoever sets one up, those they manage. */\nexport function listsServices(shell: Shell): boolean {\n return shell.capabilities.canManageGrants || shell.capabilities.setsUpServices;\n}\n\n/**\n * How the caller may have a service account sign in, from its list entry\n * or its access: bearer tokens under coffre's own sign-in, trusted\n * workloads where the deployment trusts them, each only for an account they\n * manage.\n */\nexport function waysFor(shell: Shell, managed: boolean): { tokens: boolean; workloads: boolean } {\n return { tokens: managed && shell.auth.signin !== null, workloads: managed && shell.features.workloads };\n}\n\n/**\n * The service accounts page: the directory, and each account's bindings and\n * tokens, read here as its own page reads them, so the list shows how each\n * signs in from the first paint and the browser asks for nothing that may be\n * refused (a deployment that trusts no workloads answers bindings with one).\n */\nexport async function loadServiceDirectory(queryClient: QueryClient, client: CoffreClient) {\n const shell = await loadShell(queryClient, client);\n const directory = await queryClient.fetchQuery(queries.directory(client, listsServices(shell)));\n if (!directory.ok) return directory;\n await Promise.all(\n directory.principals\n .filter((principal) => principal.principalType === 'service')\n .flatMap((principal) => {\n const member = memberRef('service', principal.principalId);\n const ways = waysFor(shell, principal.managed === true);\n return [\n queryClient.fetchQuery(queries.credentials(client, member, ways.tokens)),\n queryClient.fetchQuery(queries.bindings(client, member, ways.workloads)),\n ];\n }),\n );\n return directory;\n}\n\n/** Who a user or service account is to the instance, its pages' header: null to anyone who does not run it. */\nexport async function loadMember(queryClient: QueryClient, client: CoffreClient, member: string, freshness: Freshness = 'fresh') {\n const shell = await loadShell(queryClient, client, freshness);\n return read(queryClient, queries.report(client, member, shell.capabilities.runsInstance), freshness);\n}\n\nexport type MemberReport = Awaited<ReturnType<typeof loadMember>>;\n\n/**\n * What a user's or service account's Access tab reads: their role, scope\n * and the grants you manage, in one request, which the server answers in\n * one query, however many projects they hold grants in.\n */\nexport async function loadAccess(queryClient: QueryClient, client: CoffreClient, member: string, freshness: Freshness = 'fresh') {\n const shell = await loadShell(queryClient, client, freshness);\n return read(queryClient, queries.memberAccess(client, member, listsAccess(shell)), freshness);\n}\n\n/**\n * A user's or service account's page: what every tab but Activity shows,\n * read once by its layout, so its tabs open at once. Who they are, what they\n * hold and, for a service account, how it signs in.\n */\nexport async function loadPrincipal(queryClient: QueryClient, client: CoffreClient, principalType: 'user' | 'service', principalId: string) {\n const member = memberRef(principalType, principalId);\n await Promise.all([\n loadMember(queryClient, client, member),\n principalType === 'service' ? loadSignIn(queryClient, client, member) : loadAccess(queryClient, client, member),\n ]);\n}\n\n/**\n * A service account's Sign-in tab: its bearer tokens and trust bindings, as\n * far as its page shows them (`signInWays`), which it returns: null where it\n * shows neither.\n */\nexport async function loadSignIn(queryClient: QueryClient, client: CoffreClient, member: string, freshness: Freshness = 'fresh') {\n const [shell, access] = await Promise.all([\n loadShell(queryClient, client, freshness),\n loadAccess(queryClient, client, member, freshness),\n ]);\n const ways = signInWays(shell, access);\n if (ways !== null) {\n await Promise.all([\n read(queryClient, queries.credentials(client, member, ways.tokens), freshness),\n read(queryClient, queries.bindings(client, member, ways.workloads), freshness),\n ]);\n }\n return ways;\n}\n\n/**\n * Whether the caller may ask what someone holds: admins and owners,\n * whoever manages a project's access, and whoever sets up service accounts,\n * of those they manage.\n */\nexport function listsAccess(shell: Shell): boolean {\n return shell.capabilities.canManageGrants || shell.capabilities.setsUpServices || managedProjects(shell.projects).length > 0;\n}\n\nexport type MemberAccessResult = Awaited<ReturnType<typeof loadAccess>>;\n\n/**\n * How a service account's page lets it sign in: bearer tokens under\n * coffre's own sign-in, trusted workloads where the deployment trusts them.\n * Null where it shows neither: to anyone who does not manage it (its access\n * says, `managed`), and for an account that is not active, which can be\n * issued nothing.\n */\nexport function signInWays(shell: Shell, access: MemberAccessResult): { tokens: boolean; workloads: boolean } | null {\n const managed = access?.ok === true && access.managed && access.status === 'active';\n const ways = waysFor(shell, managed);\n return ways.tokens || ways.workloads ? ways : null;\n}\n\n/**\n * Whether a user has a Connected apps tab: for an owner, where the\n * deployment serves MCP, and while the user is registered and not removed,\n * since removal disconnects every app. The tab, and the route under it,\n * both ask.\n */\nexport function hasAppsTab(shell: Shell, report: MemberReport): boolean {\n const found = report?.ok === true ? report.report : null;\n return Boolean(shell.features.mcp) && shell.capabilities.runsInstance && found !== null && found.status !== 'removed';\n}\n\nexport function managedProjects(projects: ProjectSummary[]): ProjectSummary[] {\n return projects.filter((project) => project.permissions.includes('grant.manage'));\n}\n\n/**\n * What each change touches, which `useAction` refetches when it lands. Every\n * change also lands in the audit log, which is always read fresh.\n */\nexport const affects = {\n /**\n * A project or environment made, renamed or archived: the tree, where you\n * hold access, and the personal configs listed of it, which go with it.\n */\n places: (): QueryKey[] => [keys.projects, keys.me, ['personal']],\n /** Secrets written, renamed, restored or archived: the environment, the counts, and the personal configs' key names. */\n secrets: (place: Place): QueryKey[] => [keys.secrets(place), keys.projects, ['references'], ['missing'], ['personal']],\n /**\n * Someone's access in a project changed: its grants, their report, and, as\n * it may be your own, what you can see.\n */\n access: (project: string, member: string): QueryKey[] => [\n keys.grants(project),\n keys.memberAccess(member),\n keys.report(member),\n keys.projects,\n keys.me,\n ],\n /**\n * Someone let in: the directory, and whatever was read of them before\n * they were there, which said there was no such member: a new service\n * account's row asks how it signs in as soon as it shows.\n */\n admission: (member: string): QueryKey[] => [\n keys.directory,\n keys.report(member),\n keys.memberAccess(member),\n keys.credentials(member),\n keys.bindings(member),\n ],\n /**\n * An instance role changed: the directory, their report, and, as it may be\n * your own, what you can see and do.\n */\n role: (member: string): QueryKey[] => [keys.directory, keys.report(member), keys.memberAccess(member), keys.me, keys.projects],\n /** Someone removed: the directory, their report, and every grant, which removal ends, those on every project too. */\n removal: (member: string): QueryKey[] => [keys.directory, keys.report(member), keys.memberAccess(member), ['grants'], keys.projects],\n /**\n * Where people set up service accounts changed: the setting, and what you\n * may do, which the directory and `/me` say.\n */\n settings: (): QueryKey[] => [keys.settings, keys.me, keys.directory],\n /**\n * A role edited, made, reset or deleted, or an environment protected:\n * what everyone holds may change, so the roles, what you hold, and every\n * grant and environment read with what it holds.\n */\n roles: (): QueryKey[] => [keys.roles, keys.me, keys.projects, ['grants'], ['member-access'], ['secrets']],\n credentials: (member: string): QueryKey[] => [keys.credentials(member)],\n bindings: (member: string): QueryKey[] => [keys.bindings(member)],\n /** Unlinking an account also ends the sessions it signed in. */\n identities: (): QueryKey[] => [keys.identities, keys.sessions],\n sessions: (): QueryKey[] => [keys.sessions],\n apps: (): QueryKey[] => [keys.apps],\n};\n\n/**\n * Refetch what a change touched: at once where it is on screen, on next use\n * elsewhere. Every change lands in the audit log, so the log and its\n * verification are always among them.\n */\nexport async function refresh(queryClient: QueryClient, touched: QueryKey[]): Promise<void> {\n await Promise.all([...touched, keys.audit].map((queryKey) => queryClient.invalidateQueries({ queryKey })));\n}\n"],"mappings":";;;;AAOA,SAAgB,sBACd,aAC2C;CAC3C,OAAO,YAAY,YAAY;AACjC;AAEA,SAAgB,8BACd,aAIA;CACA,OAAO,YAAY,cACd,YAAY,YAAY,QACxB,YAAY,QAAQ,eAAe;AAC1C;;;ACaA,IAAM,OAAuB;CAC3B,iBAAiB;CACjB,cAAc;CACd,cAAc;CACd,gBAAgB;CAChB,cAAc;CACd,kBAAkB;AACpB;AAEA,SAAgB,qBACd,IACA,UACgB;CAChB,IAAI,OAAO,MAAM,OAAO;CAExB,MAAM,OAAO,GAAG;CAEhB,OAAO;EAIL,iBAAiB,YAAY,IAAI;EACjC,cAAc,GAAG;EACjB,cAAc,aAAa;GAAE;GAAM,OAAO,GAAG;EAAM,CAAC;EACpD,gBAAgB,GAAG;EACnB,cAAc,GAAG;EAGjB,kBAAkB,cAAc;GAAE;GAAM,OAAO,GAAG;GAAO,QAAQ,CAAC;EAAE,CAAC;CACvE;AACF;;AAGA,SAAgB,iBAAiB,aAA6C;CAC5E,OAAO,YAAY,SAAS,aAAa;AAC3C;;;;;;;;;;;;;;;;;AC/CA,IAAa,WAAW;AAExB,SAAgB,oBAAiC;CAC/C,OAAO,IAAI,YAAY,EACrB,gBAAgB,EACd,SAAS;EACP,WAAW;EACX,sBAAsB;EAGtB,OAAO;CACT,EACF,EACF,CAAC;AACH;;;;;AAQA,IAAa,OAAO;CAClB,IAAI,CAAC,IAAI;CACT,MAAM,CAAC,MAAM;CACb,UAAU,CAAC,UAAU;CACrB,SAAS,YAAoB,CAAC,UAAU,OAAO;CAC/C,UAAU,EAAE,SAAS,kBAAyB;EAAC;EAAW;EAAS;CAAW;CAC9E,aAAa,SAA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