@coffre/ui 0.6.1 → 0.7.0
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-CUUMshIp.js → audit-sentence-C1_gRxWW.js} +91 -26
- package/dist/chunks/audit-sentence-C1_gRxWW.js.map +1 -0
- package/dist/chunks/{connected-apps-DTpatjge.js → connected-apps-Bn5rEoV2.js} +4 -4
- package/dist/chunks/{connected-apps-DTpatjge.js.map → connected-apps-Bn5rEoV2.js.map} +1 -1
- package/dist/chunks/{delete-place-SOOYVt6A.js → delete-place-CQCDHkne.js} +4 -4
- package/dist/chunks/{delete-place-SOOYVt6A.js.map → delete-place-CQCDHkne.js.map} +1 -1
- package/dist/chunks/{directory-DrtdKny2.js → directory-BQNOdze_.js} +22 -19
- package/dist/chunks/directory-BQNOdze_.js.map +1 -0
- package/dist/chunks/{folders-hR2Lnk0k.js → folders-Dw240WMJ.js} +2 -2
- package/dist/chunks/{folders-hR2Lnk0k.js.map → folders-Dw240WMJ.js.map} +1 -1
- package/dist/chunks/{grants-DDBui9YD.js → grants-CJIBrkod.js} +5 -5
- package/dist/chunks/{grants-DDBui9YD.js.map → grants-CJIBrkod.js.map} +1 -1
- package/dist/chunks/multi-combobox-CsIXihuc.js +99 -0
- package/dist/chunks/multi-combobox-CsIXihuc.js.map +1 -0
- package/dist/chunks/{offboarding-C7ECW5o0.js → offboarding-CrgwaetA.js} +4 -4
- package/dist/chunks/offboarding-CrgwaetA.js.map +1 -0
- package/dist/chunks/personal-tokens-B8rkT-DI.js +138 -0
- package/dist/chunks/personal-tokens-B8rkT-DI.js.map +1 -0
- package/dist/chunks/{principal-page-CB6dAABC.js → principal-page-DDmmV1KQ.js} +37 -27
- package/dist/chunks/principal-page-DDmmV1KQ.js.map +1 -0
- package/dist/chunks/{project-page-BHNUvr2L.js → project-page-BI--vjt3.js} +2 -2
- package/dist/chunks/{project-page-BHNUvr2L.js.map → project-page-BI--vjt3.js.map} +1 -1
- package/dist/chunks/{queries-DgQo3mC-.js → queries-epz4MIuW.js} +103 -18
- package/dist/chunks/queries-epz4MIuW.js.map +1 -0
- package/dist/chunks/{references-BQc35Q9g.js → references-DImfw0cz.js} +4 -4
- package/dist/chunks/{references-BQc35Q9g.js.map → references-DImfw0cz.js.map} +1 -1
- package/dist/chunks/{role-field-BfWRCqzl.js → role-field-C1KhNaIR.js} +2 -2
- package/dist/chunks/{role-field-BfWRCqzl.js.map → role-field-C1KhNaIR.js.map} +1 -1
- package/dist/chunks/{row-state-Zf3kZVhd.js → row-state-BsIHspy4.js} +2 -2
- package/dist/chunks/{row-state-Zf3kZVhd.js.map → row-state-BsIHspy4.js.map} +1 -1
- package/dist/chunks/{theme-B6-V9JvY.js → theme-3b4DnCow.js} +2 -2
- package/dist/chunks/{theme-B6-V9JvY.js.map → theme-3b4DnCow.js.map} +1 -1
- package/dist/chunks/{ui-Br-dNUTc.js → ui-2kwXXfrX.js} +95 -22
- package/dist/chunks/ui-2kwXXfrX.js.map +1 -0
- package/dist/chunks/{use-action-DthL5hL8.js → use-action-BB-RcHo1.js} +2 -2
- package/dist/chunks/{use-action-DthL5hL8.js.map → use-action-BB-RcHo1.js.map} +1 -1
- package/dist/chunks/{use-change-By4cG8bT.js → use-change-CQyDpCqw.js} +323 -31
- package/dist/chunks/use-change-CQyDpCqw.js.map +1 -0
- package/dist/chunks/{use-shell-D6kjSPls.js → use-shell-C_NmvCt_.js} +2 -2
- package/dist/chunks/{use-shell-D6kjSPls.js.map → use-shell-C_NmvCt_.js.map} +1 -1
- package/dist/index.d.ts +46 -164
- package/dist/index.js +143 -129
- package/dist/index.js.map +1 -1
- package/dist/pages/account.d.ts +1 -1
- package/dist/pages/account.js +29 -12
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/approval.js +1 -1
- package/dist/pages/audit.js +96 -90
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +1 -1
- package/dist/pages/environment.js +949 -412
- package/dist/pages/environment.js.map +1 -1
- 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-access.js.map +1 -1
- package/dist/pages/project-environments.js +112 -64
- package/dist/pages/project-environments.js.map +1 -1
- package/dist/pages/project-settings.d.ts +1 -1
- package/dist/pages/project-settings.js +54 -75
- package/dist/pages/project-settings.js.map +1 -1
- package/dist/pages/project.js +3 -7
- package/dist/pages/project.js.map +1 -1
- package/dist/pages/projects.js +50 -77
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.js +284 -160
- package/dist/pages/service-account.js.map +1 -1
- package/dist/pages/service-accounts.js +4 -4
- package/dist/pages/settings.js +5 -5
- 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/actions-log.tsx +3 -2
- package/src/components/command-palette.tsx +4 -5
- package/src/components/directory.tsx +7 -14
- package/src/components/generate-value.tsx +15 -7
- package/src/components/missing.tsx +63 -67
- package/src/components/offboarding.tsx +1 -1
- package/src/components/personal-tokens.tsx +131 -0
- package/src/components/principal-page.tsx +30 -17
- package/src/components/regenerate.tsx +72 -0
- package/src/components/service-tokens.tsx +5 -14
- package/src/components/shell.tsx +79 -75
- package/src/components/trusted-workloads.tsx +179 -19
- package/src/components/ui.tsx +35 -25
- package/src/lib/audit-sentences.ts +100 -12
- package/src/lib/bindings.ts +41 -3
- package/src/lib/changes.ts +215 -29
- package/src/lib/clipboard.ts +40 -0
- package/src/lib/copy-attempts.ts +103 -0
- package/src/lib/dismissal.ts +24 -0
- package/src/lib/generate.ts +3 -146
- package/src/lib/optimistic.ts +3 -1
- package/src/lib/queries.ts +121 -17
- package/src/lib/recipes.ts +63 -0
- package/src/lib/reveal.ts +7 -1
- package/src/lib/row-reads.ts +64 -0
- package/src/lib/secret-edit-batch.ts +64 -5
- package/src/options.ts +43 -51
- package/src/pages/account.tsx +27 -5
- package/src/pages/audit.tsx +38 -31
- package/src/pages/environment.tsx +655 -121
- package/src/pages/project-access.tsx +1 -1
- package/src/pages/project-environments.tsx +92 -45
- package/src/pages/project-settings.tsx +9 -20
- package/src/pages/project.tsx +1 -5
- package/src/pages/projects.tsx +13 -28
- package/src/parity.ts +20 -4
- package/src/styles/globals.css +143 -131
- package/dist/chunks/audit-sentence-CUUMshIp.js.map +0 -1
- package/dist/chunks/directory-DrtdKny2.js.map +0 -1
- package/dist/chunks/offboarding-C7ECW5o0.js.map +0 -1
- package/dist/chunks/principal-page-CB6dAABC.js.map +0 -1
- package/dist/chunks/project-environments-lEzFHUt4.js +0 -11
- package/dist/chunks/project-environments-lEzFHUt4.js.map +0 -1
- package/dist/chunks/queries-DgQo3mC-.js.map +0 -1
- package/dist/chunks/ui-Br-dNUTc.js.map +0 -1
- package/dist/chunks/use-change-By4cG8bT.js.map +0 -1
package/src/options.ts
CHANGED
|
@@ -24,17 +24,20 @@ import { memberRef, uiResult } from './lib/coffre';
|
|
|
24
24
|
import { stringsOf } from './lib/search';
|
|
25
25
|
import {
|
|
26
26
|
hasAppsTab,
|
|
27
|
-
loadAccess,
|
|
28
27
|
loadDirectory,
|
|
28
|
+
loadEnvironment,
|
|
29
29
|
loadMember,
|
|
30
|
+
loadPrincipal,
|
|
30
31
|
loadProject,
|
|
31
32
|
loadServiceDirectory,
|
|
32
33
|
loadSettings,
|
|
34
|
+
loadSignIn,
|
|
33
35
|
loadShell,
|
|
34
36
|
projectOf,
|
|
35
37
|
queries,
|
|
36
|
-
|
|
38
|
+
tabOpens,
|
|
37
39
|
type AuditSearch,
|
|
40
|
+
type Freshness,
|
|
38
41
|
} from './lib/queries';
|
|
39
42
|
import type { Permission } from './shared/models';
|
|
40
43
|
import { loginSearch } from './lib/signin-errors';
|
|
@@ -154,29 +157,20 @@ export const environment = {
|
|
|
154
157
|
validateSearch: (search: Record<string, unknown>): { filter?: string } => ({
|
|
155
158
|
filter: typeof search.filter === 'string' && search.filter !== '' ? search.filter : undefined,
|
|
156
159
|
}),
|
|
157
|
-
loader:
|
|
160
|
+
loader: ({ context, params }: Loader<{ project: string; environment: string }>) => {
|
|
158
161
|
const { coffre, queryClient } = coffreOf(context);
|
|
159
|
-
|
|
160
|
-
// Then, for whoever reads it, the references that read its secrets from
|
|
161
|
-
// elsewhere and the keys it lacks, rendered with them. Asked only then,
|
|
162
|
-
// so a refused visit is one refusal in the log, not three.
|
|
163
|
-
if (secrets.ok) {
|
|
164
|
-
await Promise.all([
|
|
165
|
-
queryClient.fetchQuery(queries.references(coffre, `${params.project}/${params.environment}`)),
|
|
166
|
-
queryClient.fetchQuery(queries.missing(coffre, params)),
|
|
167
|
-
]);
|
|
168
|
-
}
|
|
169
|
-
return secrets;
|
|
162
|
+
return loadEnvironment(queryClient, coffre, params);
|
|
170
163
|
},
|
|
171
164
|
};
|
|
172
165
|
|
|
173
166
|
/** `/audit`. */
|
|
174
167
|
export const audit = {
|
|
175
168
|
// Filters live in the URL so a finding can cite the exact view it came from.
|
|
169
|
+
// Denials always include detail: a refused sign-in is one.
|
|
176
170
|
validateSearch: (search: Record<string, unknown>): AuditSearch => ({
|
|
177
171
|
decision: search.decision === 'deny' ? 'deny' : undefined,
|
|
178
172
|
actorId: typeof search.actorId === 'string' && search.actorId !== '' ? search.actorId : undefined,
|
|
179
|
-
detail: search.detail === '1' ? '1' : undefined,
|
|
173
|
+
detail: search.detail === '1' || search.decision === 'deny' ? '1' : undefined,
|
|
180
174
|
}),
|
|
181
175
|
loaderDeps: ({ search }: { search: AuditSearch }) => search,
|
|
182
176
|
// The entries only: the verification is asked for once the page is up
|
|
@@ -195,28 +189,27 @@ export const users = {
|
|
|
195
189
|
},
|
|
196
190
|
};
|
|
197
191
|
|
|
198
|
-
/**
|
|
192
|
+
/**
|
|
193
|
+
* `/users/$user`, the layout of a user's tabs: who they are to the instance,
|
|
194
|
+
* for owners, and their access, for whoever manages it. Its tabs read what
|
|
195
|
+
* it read from the cache (`Freshness`), so each opens at once.
|
|
196
|
+
*/
|
|
199
197
|
export const user = {
|
|
200
198
|
loader: ({ context, params }: Loader<{ user: string }>) => {
|
|
201
199
|
const { coffre, queryClient } = coffreOf(context);
|
|
202
|
-
return
|
|
200
|
+
return loadPrincipal(queryClient, coffre, 'user', params.user);
|
|
203
201
|
},
|
|
204
202
|
};
|
|
205
203
|
|
|
206
|
-
/** `/users/$user/`, their access on every project where you manage it. */
|
|
207
|
-
export const userAccess = {
|
|
208
|
-
loader: ({ context, params }: Loader<{ user: string }>) => {
|
|
209
|
-
const { coffre, queryClient } = coffreOf(context);
|
|
210
|
-
return loadAccess(queryClient, coffre, memberRef('user', params.user));
|
|
211
|
-
},
|
|
212
|
-
};
|
|
204
|
+
/** `/users/$user/`, their access on every project where you manage it, which its layout reads. */
|
|
205
|
+
export const userAccess = {};
|
|
213
206
|
|
|
214
207
|
/** `/users/$user/activity`, for whoever reads the audit log; the others are sent to the first tab. */
|
|
215
208
|
export const userActivity = {
|
|
216
209
|
loader: async ({ context, params }: Loader<{ user: string }>) => {
|
|
217
210
|
const { coffre, queryClient } = coffreOf(context);
|
|
218
|
-
const
|
|
219
|
-
if (!
|
|
211
|
+
const reads = async (freshness: Freshness) => (await loadShell(queryClient, coffre, freshness)).capabilities.canReadAudit;
|
|
212
|
+
if (!(await tabOpens(reads))) throw redirect({ to: '/users/$user', params });
|
|
220
213
|
},
|
|
221
214
|
};
|
|
222
215
|
|
|
@@ -229,9 +222,14 @@ export const userActivity = {
|
|
|
229
222
|
export const userApps = {
|
|
230
223
|
loader: async ({ context, params }: Loader<{ user: string }>) => {
|
|
231
224
|
const { coffre, queryClient } = coffreOf(context);
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
225
|
+
const has = async (freshness: Freshness) => {
|
|
226
|
+
const [shell, report] = await Promise.all([
|
|
227
|
+
loadShell(queryClient, coffre, freshness),
|
|
228
|
+
loadMember(queryClient, coffre, memberRef('user', params.user), freshness),
|
|
229
|
+
]);
|
|
230
|
+
return hasAppsTab(shell, report);
|
|
231
|
+
};
|
|
232
|
+
if (!(await tabOpens(has))) throw redirect({ to: '/users/$user', params });
|
|
235
233
|
},
|
|
236
234
|
};
|
|
237
235
|
|
|
@@ -245,13 +243,14 @@ export const serviceAccounts = {
|
|
|
245
243
|
|
|
246
244
|
/**
|
|
247
245
|
* `/service-accounts/$account`, the layout of a service account's tabs: who
|
|
248
|
-
* it is to the instance, for owners,
|
|
246
|
+
* it is to the instance, for owners, what it holds, and how it signs in, for
|
|
247
|
+
* whoever manages it. Its tabs read what it read from the cache
|
|
248
|
+
* (`Freshness`), so each opens at once.
|
|
249
249
|
*/
|
|
250
250
|
export const serviceAccount = {
|
|
251
|
-
loader:
|
|
251
|
+
loader: ({ context, params }: Loader<{ account: string }>) => {
|
|
252
252
|
const { coffre, queryClient } = coffreOf(context);
|
|
253
|
-
|
|
254
|
-
await Promise.all([loadMember(queryClient, coffre, member), loadAccess(queryClient, coffre, member)]);
|
|
253
|
+
return loadPrincipal(queryClient, coffre, 'service', params.account);
|
|
255
254
|
},
|
|
256
255
|
};
|
|
257
256
|
|
|
@@ -263,31 +262,20 @@ export const serviceAccount = {
|
|
|
263
262
|
export const serviceAccountSignIn = {
|
|
264
263
|
loader: async ({ context, params }: Loader<{ account: string }>) => {
|
|
265
264
|
const { coffre, queryClient } = coffreOf(context);
|
|
266
|
-
const
|
|
267
|
-
|
|
268
|
-
const ways = signInWays(shell, access);
|
|
269
|
-
if (ways === null) throw redirect({ to: '/service-accounts/$account/access', params });
|
|
270
|
-
await Promise.all([
|
|
271
|
-
queryClient.fetchQuery(queries.credentials(coffre, member, ways.tokens)),
|
|
272
|
-
queryClient.fetchQuery(queries.bindings(coffre, member, ways.workloads)),
|
|
273
|
-
]);
|
|
265
|
+
const shows = async (freshness: Freshness) => (await loadSignIn(queryClient, coffre, memberRef('service', params.account), freshness)) !== null;
|
|
266
|
+
if (!(await tabOpens(shows))) throw redirect({ to: '/service-accounts/$account/access', params });
|
|
274
267
|
},
|
|
275
268
|
};
|
|
276
269
|
|
|
277
|
-
/** `/service-accounts/$account/access
|
|
278
|
-
export const serviceAccountAccess = {
|
|
279
|
-
loader: ({ context, params }: Loader<{ account: string }>) => {
|
|
280
|
-
const { coffre, queryClient } = coffreOf(context);
|
|
281
|
-
return loadAccess(queryClient, coffre, memberRef('service', params.account));
|
|
282
|
-
},
|
|
283
|
-
};
|
|
270
|
+
/** `/service-accounts/$account/access`, which its layout reads. */
|
|
271
|
+
export const serviceAccountAccess = {};
|
|
284
272
|
|
|
285
273
|
/** `/service-accounts/$account/activity`, as a user's. */
|
|
286
274
|
export const serviceAccountActivity = {
|
|
287
275
|
loader: async ({ context, params }: Loader<{ account: string }>) => {
|
|
288
276
|
const { coffre, queryClient } = coffreOf(context);
|
|
289
|
-
const
|
|
290
|
-
if (!
|
|
277
|
+
const reads = async (freshness: Freshness) => (await loadShell(queryClient, coffre, freshness)).capabilities.canReadAudit;
|
|
278
|
+
if (!(await tabOpens(reads))) throw redirect({ to: '/service-accounts/$account', params });
|
|
291
279
|
},
|
|
292
280
|
};
|
|
293
281
|
|
|
@@ -335,7 +323,11 @@ export const accountSessions = {
|
|
|
335
323
|
loader: async ({ context }: Loader) => {
|
|
336
324
|
const { coffre, queryClient } = coffreOf(context);
|
|
337
325
|
if (!(await ownSignIn(context))) throw redirect({ to: '/account' });
|
|
338
|
-
await queryClient
|
|
326
|
+
const { principal } = await loadShell(queryClient, coffre);
|
|
327
|
+
await Promise.all([
|
|
328
|
+
queryClient.fetchQuery(queries.sessions(coffre)),
|
|
329
|
+
...(principal?.type === 'user' ? [queryClient.fetchQuery(queries.credentials(coffre, memberRef('user', principal.id), true))] : []),
|
|
330
|
+
]);
|
|
339
331
|
},
|
|
340
332
|
};
|
|
341
333
|
|
package/src/pages/account.tsx
CHANGED
|
@@ -12,13 +12,14 @@ import { ConfirmButton, CopyButton, EmptyState, ErrorLine, Notice, Timestamp } f
|
|
|
12
12
|
import { Link as LinkIcon, Monitor, ProviderMark, SignOut, Sun, Terminal, User, X } from '../components/icons';
|
|
13
13
|
import { signinErrorMessage } from '../lib/signin-errors';
|
|
14
14
|
import { useOneTime } from '../lib/one-time';
|
|
15
|
-
import { useCoffre } from '../lib/coffre';
|
|
15
|
+
import { memberRef, useCoffre } from '../lib/coffre';
|
|
16
16
|
import { useMounted } from '../lib/mounted';
|
|
17
|
-
import { disconnectApp, endSession, unlinkIdentity } from '../lib/changes';
|
|
17
|
+
import { disconnectApp, endSession, revokeCredential, unlinkIdentity } from '../lib/changes';
|
|
18
18
|
import { queries } from '../lib/queries';
|
|
19
19
|
import { useChange, useChangeStatus } from '../lib/use-change';
|
|
20
20
|
import { RowFailure, RowPending, rowClass } from '../components/row-state';
|
|
21
21
|
import { ConnectedAppsCard } from '../components/connected-apps';
|
|
22
|
+
import { PersonalTokensCard } from '../components/personal-tokens';
|
|
22
23
|
import { pageRoute } from '../lib/page-route';
|
|
23
24
|
import type { accountProfile } from '../options';
|
|
24
25
|
|
|
@@ -107,12 +108,33 @@ export function AccountProfilePage() {
|
|
|
107
108
|
);
|
|
108
109
|
}
|
|
109
110
|
|
|
110
|
-
/** Where you are signed in, browsers and command lines. */
|
|
111
|
+
/** Where you are signed in, browsers and command lines, and the personal tokens that act as you. */
|
|
111
112
|
export function AccountSessionsPage() {
|
|
112
|
-
const { auth } = useShell();
|
|
113
|
+
const { auth, principal } = useShell();
|
|
113
114
|
const { data: sessions } = useSuspenseQuery(queries.sessions(useCoffre()));
|
|
114
115
|
if (!sessions.ok) return <ErrorLine error={sessions.error} />;
|
|
115
|
-
return
|
|
116
|
+
return (
|
|
117
|
+
<>
|
|
118
|
+
<Sessions sessions={sessions.sessions} providers={auth.signin?.providers ?? []} />
|
|
119
|
+
{principal?.type === 'user' && <PersonalTokens email={principal.id} />}
|
|
120
|
+
</>
|
|
121
|
+
);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/** The personal tokens you made, for a script or an agent: each acts as you, within what it reaches, until it expires or you revoke it. */
|
|
125
|
+
function PersonalTokens({ email }: { email: string }) {
|
|
126
|
+
const client = useCoffre();
|
|
127
|
+
const member = memberRef('user', email);
|
|
128
|
+
const { data: tokens } = useSuspenseQuery(queries.credentials(client, member, true));
|
|
129
|
+
return (
|
|
130
|
+
<PersonalTokensCard
|
|
131
|
+
tokens={tokens === null ? [] : tokens.ok ? tokens.tokens : { error: tokens.error }}
|
|
132
|
+
change={revokeCredential(client, member)}
|
|
133
|
+
description="Tokens that act as you, for a script or an agent, within what each reaches and never beyond what you hold. Every entry one makes names it."
|
|
134
|
+
empty="Make one with the CLI, for an hour unless told:"
|
|
135
|
+
emptyActions={<CopyLine value="coffre tokens issue --label cursor-agent --scope <project>/<environment>=viewer --expires-in 4h" label="Copy the command" />}
|
|
136
|
+
/>
|
|
137
|
+
);
|
|
116
138
|
}
|
|
117
139
|
|
|
118
140
|
/** How to connect Claude, then the apps you connected. */
|
package/src/pages/audit.tsx
CHANGED
|
@@ -8,11 +8,12 @@ import {
|
|
|
8
8
|
decidedBy,
|
|
9
9
|
describe,
|
|
10
10
|
lines,
|
|
11
|
+
perSecret,
|
|
11
12
|
runLabel,
|
|
12
13
|
who,
|
|
13
14
|
type Part,
|
|
14
15
|
} from '../lib/audit-sentences';
|
|
15
|
-
import { EmptyState, Notice, Spinner, Timestamp, Toggletip } from '../components/ui';
|
|
16
|
+
import { absolute, EmptyState, Notice, Spinner, Timestamp, Toggletip } from '../components/ui';
|
|
16
17
|
import { memberName, Sentence } from '../components/audit-sentence';
|
|
17
18
|
import { ClosedDoor, PageHeader } from '../components/page';
|
|
18
19
|
import {
|
|
@@ -87,7 +88,7 @@ export function AuditPage() {
|
|
|
87
88
|
; <code>coffre audit</code> lists them all.
|
|
88
89
|
</>
|
|
89
90
|
) : (
|
|
90
|
-
': it may be detail, which
|
|
91
|
+
': it may be detail, which Everything lists.'
|
|
91
92
|
)}
|
|
92
93
|
</>
|
|
93
94
|
)}
|
|
@@ -96,16 +97,18 @@ export function AuditPage() {
|
|
|
96
97
|
)}
|
|
97
98
|
|
|
98
99
|
<div className="toolbar">
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
All events
|
|
100
|
+
{/* One control for what the log lists. `exact` holds each link to the
|
|
101
|
+
whole search, so only the view shown lights up. */}
|
|
102
|
+
<nav className="segmented" aria-label="Show">
|
|
103
|
+
<Link to="/audit" search={{ actorId }} activeOptions={{ exact: true }}>
|
|
104
|
+
Actions
|
|
105
105
|
</Link>
|
|
106
|
-
<Link to="/audit" search={{
|
|
106
|
+
<Link to="/audit" search={{ actorId, detail: '1' }} activeOptions={{ exact: true }}>
|
|
107
|
+
Everything
|
|
108
|
+
</Link>
|
|
109
|
+
<Link to="/audit" search={{ actorId, decision: 'deny', detail: '1' }} activeOptions={{ exact: true }}>
|
|
107
110
|
<SlashCircle size={13} />
|
|
108
|
-
Denials
|
|
111
|
+
Denials
|
|
109
112
|
</Link>
|
|
110
113
|
</nav>
|
|
111
114
|
|
|
@@ -120,16 +123,6 @@ export function AuditPage() {
|
|
|
120
123
|
<X size={13} />
|
|
121
124
|
</Link>
|
|
122
125
|
)}
|
|
123
|
-
|
|
124
|
-
<Link
|
|
125
|
-
className="detail-toggle"
|
|
126
|
-
to="/audit"
|
|
127
|
-
search={{ ...filters, detail: detail ? undefined : '1' }}
|
|
128
|
-
aria-pressed={detail}
|
|
129
|
-
>
|
|
130
|
-
<span className="switch" aria-hidden="true" />
|
|
131
|
-
Show detail
|
|
132
|
-
</Link>
|
|
133
126
|
</div>
|
|
134
127
|
|
|
135
128
|
<section className="card card-wide" aria-label="Audit entries">
|
|
@@ -190,7 +183,11 @@ export function AuditPage() {
|
|
|
190
183
|
type Entry = AuditEntryView;
|
|
191
184
|
type Filters = { decision?: 'deny'; actorId?: string };
|
|
192
185
|
|
|
193
|
-
/**
|
|
186
|
+
/**
|
|
187
|
+
* One action: an entry, or a batch of them under one operation, which opens
|
|
188
|
+
* to each; a read of several secrets, logged as one entry, opens to each
|
|
189
|
+
* secret, under its entry's number.
|
|
190
|
+
*/
|
|
194
191
|
function Line({
|
|
195
192
|
batch,
|
|
196
193
|
filters,
|
|
@@ -207,13 +204,18 @@ function Line({
|
|
|
207
204
|
const lead = batch[0]!;
|
|
208
205
|
const sentence = describe(batch);
|
|
209
206
|
const seqs = batch.map((entry) => entry.seq);
|
|
210
|
-
const
|
|
207
|
+
const each = batch.flatMap(perSecret);
|
|
208
|
+
const grouped = each.length > 1;
|
|
209
|
+
const [unit, units] = each.length === batch.length ? ['entry', 'entries'] : ['secret', 'secrets'];
|
|
210
|
+
// A read of several breaks at its first secret's row.
|
|
211
|
+
const breakRow = each.findIndex((entry) => entry.seq === breakAt);
|
|
212
|
+
const [first, last] = [Math.min(...seqs), Math.max(...seqs)];
|
|
211
213
|
|
|
212
214
|
return (
|
|
213
215
|
<>
|
|
214
216
|
<Row
|
|
215
217
|
entry={lead}
|
|
216
|
-
seq={
|
|
218
|
+
seq={first === last ? String(first) : `${first}–${last}`}
|
|
217
219
|
parts={sentence.parts}
|
|
218
220
|
refused={sentence.refused}
|
|
219
221
|
decided={decidedBy(batch)}
|
|
@@ -227,7 +229,7 @@ function Line({
|
|
|
227
229
|
type="button"
|
|
228
230
|
className="batch-toggle"
|
|
229
231
|
aria-expanded={open}
|
|
230
|
-
aria-label={open ?
|
|
232
|
+
aria-label={open ? `Hide each ${unit}` : `Show each of ${each.length} ${units}`}
|
|
231
233
|
onClick={() => setOpen(!open)}
|
|
232
234
|
>
|
|
233
235
|
<ChevronRight size={14} />
|
|
@@ -237,11 +239,11 @@ function Line({
|
|
|
237
239
|
/>
|
|
238
240
|
{grouped &&
|
|
239
241
|
open &&
|
|
240
|
-
|
|
242
|
+
each.map((entry, i) => {
|
|
241
243
|
const one = describe([entry]);
|
|
242
244
|
return (
|
|
243
245
|
<Row
|
|
244
|
-
key={entry.seq}
|
|
246
|
+
key={`${entry.seq}:${i}`}
|
|
245
247
|
entry={entry}
|
|
246
248
|
seq={String(entry.seq)}
|
|
247
249
|
parts={one.parts}
|
|
@@ -249,7 +251,7 @@ function Line({
|
|
|
249
251
|
decided={decidedBy([entry])}
|
|
250
252
|
filters={filters}
|
|
251
253
|
detail={detail}
|
|
252
|
-
breaks={
|
|
254
|
+
breaks={i === breakRow}
|
|
253
255
|
marked={false}
|
|
254
256
|
child
|
|
255
257
|
/>
|
|
@@ -322,6 +324,12 @@ function Row({
|
|
|
322
324
|
{runLabel(entry.run)}
|
|
323
325
|
</small>
|
|
324
326
|
)}
|
|
327
|
+
{entry.token != null && (
|
|
328
|
+
// The personal token the person made the request with, by the label it was made with.
|
|
329
|
+
<small className="actor-run" title={`Personal token ${entry.token.id}`}>
|
|
330
|
+
via token “{entry.token.label}”
|
|
331
|
+
</small>
|
|
332
|
+
)}
|
|
325
333
|
</td>
|
|
326
334
|
<td className="cell-sentence" data-label="What they did">
|
|
327
335
|
<span className="sentence">
|
|
@@ -431,10 +439,9 @@ function ChainStatus({ chain, onRetry }: { chain: ChainResult | undefined; onRet
|
|
|
431
439
|
<Toggletip
|
|
432
440
|
align="end"
|
|
433
441
|
label={
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
: ` The vault last signed it through entry ${chain.checkpoint.seq}, at ${chain.checkpoint.signedAt}.`)
|
|
442
|
+
chain.checkpoint === null
|
|
443
|
+
? 'Audit log verified by the app and vault keys, not signed yet.'
|
|
444
|
+
: `Audit log verified by the app and vault keys, last signature at ${absolute(chain.checkpoint.signedAt, false)} UTC.`
|
|
438
445
|
}
|
|
439
446
|
>
|
|
440
447
|
<button type="button" className="chain-seal">
|