@coffre/ui 0.2.0 → 0.4.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-BhHmvQX_.js +660 -0
- package/dist/chunks/audit-sentence-BhHmvQX_.js.map +1 -0
- package/dist/chunks/delete-place-CRX7ntE8.js +206 -0
- package/dist/chunks/delete-place-CRX7ntE8.js.map +1 -0
- package/dist/chunks/{directory-CSjWWUQ1.js → directory-zr3ek7Mc.js} +175 -60
- package/dist/chunks/directory-zr3ek7Mc.js.map +1 -0
- package/dist/chunks/folders-DoBmCwOi.js +207 -0
- package/dist/chunks/folders-DoBmCwOi.js.map +1 -0
- package/dist/chunks/grants-Cw1FyGID.js +669 -0
- package/dist/chunks/grants-Cw1FyGID.js.map +1 -0
- package/dist/chunks/offboarding-CE6d7um1.js +305 -0
- package/dist/chunks/offboarding-CE6d7um1.js.map +1 -0
- package/dist/chunks/one-time-DXEl9hbg.js +35 -0
- package/dist/chunks/one-time-DXEl9hbg.js.map +1 -0
- package/dist/chunks/page-DvsgZ2Hd.js +391 -0
- package/dist/chunks/page-DvsgZ2Hd.js.map +1 -0
- package/dist/chunks/principal-BIN-xwZw.js +42 -0
- package/dist/chunks/principal-BIN-xwZw.js.map +1 -0
- package/dist/chunks/{principal-page-D_91OA0l.js → principal-page-DhjO76GH.js} +245 -251
- package/dist/chunks/principal-page-DhjO76GH.js.map +1 -0
- package/dist/chunks/project-page-SRCtRe2g.js +17 -0
- package/dist/chunks/project-page-SRCtRe2g.js.map +1 -0
- package/dist/chunks/{queries-CQ81o4so.js → queries-DVR_i3rA.js} +132 -30
- package/dist/chunks/queries-DVR_i3rA.js.map +1 -0
- package/dist/chunks/references-B6pLT1uQ.js +343 -0
- package/dist/chunks/references-B6pLT1uQ.js.map +1 -0
- package/dist/chunks/{row-state-0PsrEzOL.js → row-state-DOPUsjQK.js} +3 -3
- package/dist/chunks/{row-state-0PsrEzOL.js.map → row-state-DOPUsjQK.js.map} +1 -1
- package/dist/chunks/signin-errors--ykMFuqN.js +57 -0
- package/dist/chunks/signin-errors--ykMFuqN.js.map +1 -0
- package/dist/chunks/tabs-BmwKfUeK.js +22 -0
- package/dist/chunks/tabs-BmwKfUeK.js.map +1 -0
- package/dist/chunks/{theme-B2vQolVR.js → theme-DJuz-xLM.js} +3 -3
- package/dist/chunks/{theme-B2vQolVR.js.map → theme-DJuz-xLM.js.map} +1 -1
- package/dist/chunks/{ui-DixXLQvQ.js → ui-DJje3gST.js} +6 -3
- package/dist/chunks/ui-DJje3gST.js.map +1 -0
- package/dist/chunks/{use-change-c6CeLRin.js → use-change-DUiGO19U.js} +52 -21
- package/dist/chunks/use-change-DUiGO19U.js.map +1 -0
- package/dist/chunks/{use-shell-jxd7Tzd-.js → use-shell-rNKfGjdj.js} +3 -3
- package/dist/chunks/{use-shell-jxd7Tzd-.js.map → use-shell-rNKfGjdj.js.map} +1 -1
- package/dist/chunks/validation-D312_NLf.js +87 -0
- package/dist/chunks/validation-D312_NLf.js.map +1 -0
- package/dist/index.d.ts +361 -27
- package/dist/index.js +188 -98
- package/dist/index.js.map +1 -1
- package/dist/pages/account.d.ts +2 -2
- package/dist/pages/account.js +297 -135
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/approval.d.ts +9 -0
- package/dist/pages/approval.js +207 -0
- package/dist/pages/approval.js.map +1 -0
- package/dist/pages/audit.js +17 -542
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +2 -3
- package/dist/pages/device-login.js.map +1 -1
- package/dist/pages/environment.js +647 -257
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +18 -7
- package/dist/pages/login.js.map +1 -1
- package/dist/pages/oauth-authorize.d.ts +10 -0
- package/dist/pages/oauth-authorize.js +249 -0
- package/dist/pages/oauth-authorize.js.map +1 -0
- package/dist/pages/project-access.d.ts +6 -0
- package/dist/pages/project-access.js +370 -0
- package/dist/pages/project-access.js.map +1 -0
- package/dist/pages/project-environments.d.ts +4 -0
- package/dist/pages/project-environments.js +593 -0
- package/dist/pages/project-environments.js.map +1 -0
- package/dist/pages/project-settings.d.ts +4 -0
- package/dist/pages/project-settings.js +242 -0
- package/dist/pages/project-settings.js.map +1 -0
- package/dist/pages/project.d.ts +10 -2
- package/dist/pages/project.js +57 -934
- package/dist/pages/project.js.map +1 -1
- package/dist/pages/projects.js +53 -21
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.d.ts +10 -0
- package/dist/pages/{token.js → service-account.js} +115 -56
- package/dist/pages/service-account.js.map +1 -0
- package/dist/pages/service-accounts.d.ts +3 -0
- package/dist/pages/service-accounts.js +38 -0
- package/dist/pages/service-accounts.js.map +1 -0
- package/dist/pages/settings.d.ts +1 -0
- package/dist/pages/settings.js +104 -42
- package/dist/pages/settings.js.map +1 -1
- package/dist/pages/unregistered.js +2 -3
- package/dist/pages/unregistered.js.map +1 -1
- package/dist/pages/user.d.ts +6 -1
- package/dist/pages/user.js +18 -6
- package/dist/pages/user.js.map +1 -1
- package/dist/pages/users.js +6 -10
- package/dist/pages/users.js.map +1 -1
- package/package.json +3 -3
- package/src/components/actions-log.tsx +117 -0
- package/src/components/audit-sentence.tsx +55 -0
- package/src/components/command-palette.tsx +4 -4
- package/src/components/delete-place.tsx +180 -0
- package/src/components/directory.tsx +259 -110
- package/src/components/every-project.tsx +287 -0
- package/src/components/expiry-field.tsx +42 -0
- package/src/components/folders.tsx +219 -0
- package/src/components/grants.tsx +11 -4
- package/src/components/icons.tsx +2 -0
- package/src/components/missing.tsx +110 -0
- package/src/components/offboarding.tsx +61 -33
- package/src/components/page.tsx +4 -1
- package/src/components/principal-page.tsx +136 -106
- package/src/components/principal-picker.tsx +5 -5
- package/src/components/principal.tsx +4 -4
- package/src/components/references.tsx +323 -0
- package/src/components/service-tokens.tsx +115 -95
- package/src/components/shell.tsx +11 -32
- package/src/components/tabs.tsx +18 -0
- package/src/components/trusted-workloads.tsx +97 -79
- package/src/components/ui.tsx +8 -1
- package/src/index.ts +13 -2
- package/src/layout.tsx +2 -2
- package/src/lib/access-plan.ts +2 -2
- package/src/lib/audit-sentences.ts +161 -77
- package/src/lib/changes.ts +56 -5
- package/src/lib/coffre.ts +3 -2
- package/src/lib/one-time.ts +32 -0
- package/src/lib/project-access.ts +11 -23
- package/src/lib/project-page.ts +14 -0
- package/src/lib/queries.ts +126 -32
- package/src/lib/search.ts +25 -0
- package/src/lib/signin-errors.ts +45 -1
- package/src/lib/validation.ts +14 -0
- package/src/options.ts +187 -35
- package/src/pages/account.tsx +274 -129
- package/src/pages/approval.tsx +197 -0
- package/src/pages/audit.tsx +9 -61
- package/src/pages/environment.tsx +585 -286
- package/src/pages/login.tsx +8 -2
- package/src/pages/oauth-authorize.tsx +233 -0
- package/src/pages/project-access.tsx +219 -0
- package/src/pages/project-environments.tsx +582 -0
- package/src/pages/project-settings.tsx +259 -0
- package/src/pages/project.tsx +52 -879
- package/src/pages/projects.tsx +55 -18
- package/src/pages/service-account.tsx +50 -0
- package/src/pages/{tokens.tsx → service-accounts.tsx} +9 -6
- package/src/pages/settings.tsx +62 -8
- package/src/pages/user.tsx +16 -4
- package/src/pages/users.tsx +2 -2
- package/src/parity.ts +160 -0
- package/src/register.ts +58 -9
- package/src/router.tsx +4 -0
- package/src/shared/models.ts +6 -2
- package/src/styles/globals.css +536 -31
- package/dist/chunks/directory-CSjWWUQ1.js.map +0 -1
- package/dist/chunks/grants-saMQagmG.js +0 -160
- package/dist/chunks/grants-saMQagmG.js.map +0 -1
- package/dist/chunks/icons-D-PfAfnH.js +0 -203
- package/dist/chunks/icons-D-PfAfnH.js.map +0 -1
- package/dist/chunks/offboarding-C6l30DZR.js +0 -263
- package/dist/chunks/offboarding-C6l30DZR.js.map +0 -1
- package/dist/chunks/page-C5HcNqf2.js +0 -190
- package/dist/chunks/page-C5HcNqf2.js.map +0 -1
- package/dist/chunks/principal-page-D_91OA0l.js.map +0 -1
- package/dist/chunks/queries-CQ81o4so.js.map +0 -1
- package/dist/chunks/signin-errors-BEFlVDbQ.js +0 -30
- package/dist/chunks/signin-errors-BEFlVDbQ.js.map +0 -1
- package/dist/chunks/ui-DixXLQvQ.js.map +0 -1
- package/dist/chunks/use-action-CWsg_YWU.js +0 -49
- package/dist/chunks/use-action-CWsg_YWU.js.map +0 -1
- package/dist/chunks/use-change-c6CeLRin.js.map +0 -1
- package/dist/chunks/validation-BQtqPe2V.js +0 -29
- package/dist/chunks/validation-BQtqPe2V.js.map +0 -1
- package/dist/pages/token.d.ts +0 -3
- package/dist/pages/token.js.map +0 -1
- package/dist/pages/tokens.d.ts +0 -3
- package/dist/pages/tokens.js +0 -39
- package/dist/pages/tokens.js.map +0 -1
- package/dist/project-BqIy8gYR.d.ts +0 -5
- package/src/lib/instance.ts +0 -13
- package/src/pages/token.tsx +0 -34
package/dist/pages/audit.js
CHANGED
|
@@ -1,505 +1,12 @@
|
|
|
1
|
-
import { c as Notice, f as Toggletip, i as EmptyState, l as Spinner,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { u as queries } from "../chunks/queries-CQ81o4so.js";
|
|
1
|
+
import { c as Notice, f as Toggletip, i as EmptyState, l as Spinner, u as Timestamp } from "../chunks/ui-DJje3gST.js";
|
|
2
|
+
import { J as ShieldCheck, M as Ledger, X as SlashCircle, f as Activity, i as PageHeader, it as X, k as Info, m as AlertTriangle, n as ClosedDoor, tt as User, u as useCoffre, x as Clock, y as ChevronRight } from "../chunks/page-DvsgZ2Hd.js";
|
|
3
|
+
import { p as queries } from "../chunks/queries-DVR_i3rA.js";
|
|
5
4
|
import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
|
|
6
|
-
import {
|
|
5
|
+
import { a as lines, i as describe, n as memberName, o as runLabel, r as decidedBy, s as who, t as Sentence } from "../chunks/audit-sentence-BhHmvQX_.js";
|
|
6
|
+
import { useState } from "react";
|
|
7
7
|
import { Link } from "@tanstack/react-router";
|
|
8
8
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
10
|
-
//#region src/lib/audit-sentences.ts
|
|
11
|
-
var text = (value) => typeof value === "string" && value !== "" ? value : null;
|
|
12
|
-
var number = (value) => typeof value === "number" ? value : null;
|
|
13
|
-
/** The entry's place, as deep as it goes. */
|
|
14
|
-
function place({ project, environment, key }) {
|
|
15
|
-
const path = [
|
|
16
|
-
project,
|
|
17
|
-
environment,
|
|
18
|
-
key
|
|
19
|
-
].filter((part) => part !== null);
|
|
20
|
-
return path.length === 0 ? ["coffre"] : [{ place: path.join("/") }];
|
|
21
|
-
}
|
|
22
|
-
function environmentOf({ project, environment }) {
|
|
23
|
-
return place({
|
|
24
|
-
project,
|
|
25
|
-
environment,
|
|
26
|
-
key: null
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
/** The member an entry is about: its subject, or the principal a token entry names. */
|
|
30
|
-
function subject(entry) {
|
|
31
|
-
if (entry.subject !== null) return [{ member: entry.subject }];
|
|
32
|
-
const id = text(entry.metadata.principalId);
|
|
33
|
-
if (id === null) return ["someone"];
|
|
34
|
-
return [{ member: `${entry.metadata.principalType === "service" ? "token" : "user"}:${id}` }];
|
|
35
|
-
}
|
|
36
|
-
function plural(count, one, many = `${one}s`) {
|
|
37
|
-
return `${count} ${count === 1 ? one : many}`;
|
|
38
|
-
}
|
|
39
|
-
/** A batch reads as its environment and a count; one entry as its secret. */
|
|
40
|
-
function secrets(facts) {
|
|
41
|
-
if (facts.batch.length === 1) return place(facts.entry);
|
|
42
|
-
return [
|
|
43
|
-
...environmentOf(facts.entry),
|
|
44
|
-
facts.refused ? ", " : ": ",
|
|
45
|
-
plural(facts.count, "secret")
|
|
46
|
-
];
|
|
47
|
-
}
|
|
48
|
-
/** " to acme/market", when the entry names where a sync pushes. */
|
|
49
|
-
function toDestination(entry) {
|
|
50
|
-
const where = text(entry.metadata.destination);
|
|
51
|
-
return where === null ? "" : ` to ${where}`;
|
|
52
|
-
}
|
|
53
|
-
function destination(entry) {
|
|
54
|
-
return text(entry.metadata.destination) ?? "its destination";
|
|
55
|
-
}
|
|
56
|
-
var READ_VERBS = {
|
|
57
|
-
reveal: ["revealed", "reveal"],
|
|
58
|
-
run: ["ran", "run"],
|
|
59
|
-
compare: ["compared", "compare"],
|
|
60
|
-
sync: ["read", "read"]
|
|
61
|
-
};
|
|
62
|
-
function readVerb({ entry }) {
|
|
63
|
-
return READ_VERBS[text(entry.metadata.purpose) ?? "reveal"] ?? READ_VERBS.reveal;
|
|
64
|
-
}
|
|
65
|
-
var placeTemplates = (kind) => {
|
|
66
|
-
const what = (facts) => [`${kind} `, ...kind === "project" ? place({
|
|
67
|
-
...facts.entry,
|
|
68
|
-
environment: null,
|
|
69
|
-
key: null
|
|
70
|
-
}) : environmentOf(facts.entry)];
|
|
71
|
-
return {
|
|
72
|
-
[`${kind}.create`]: {
|
|
73
|
-
did: "created",
|
|
74
|
-
tried: "create",
|
|
75
|
-
what
|
|
76
|
-
},
|
|
77
|
-
[`${kind}.update`]: {
|
|
78
|
-
did: "changed",
|
|
79
|
-
tried: "change",
|
|
80
|
-
what
|
|
81
|
-
},
|
|
82
|
-
[`${kind}.archive`]: {
|
|
83
|
-
did: "archived",
|
|
84
|
-
tried: "archive",
|
|
85
|
-
what
|
|
86
|
-
},
|
|
87
|
-
[`${kind}.restore`]: {
|
|
88
|
-
did: "restored",
|
|
89
|
-
tried: "restore",
|
|
90
|
-
what
|
|
91
|
-
}
|
|
92
|
-
};
|
|
93
|
-
};
|
|
94
|
-
var TEMPLATES = {
|
|
95
|
-
"secret.read": {
|
|
96
|
-
did: (facts) => readVerb(facts)[0],
|
|
97
|
-
tried: (facts) => readVerb(facts)[1],
|
|
98
|
-
what: secrets
|
|
99
|
-
},
|
|
100
|
-
"secret.write": {
|
|
101
|
-
did: ({ batch }) => {
|
|
102
|
-
const firsts = batch.filter((entry) => entry.version === 1).length;
|
|
103
|
-
return firsts === batch.length ? "added" : firsts === 0 ? "changed" : "wrote";
|
|
104
|
-
},
|
|
105
|
-
tried: "change",
|
|
106
|
-
what: secrets,
|
|
107
|
-
then: ({ entry, batch }) => batch.length > 1 || entry.version === null || entry.version === 1 ? [] : [`, now version ${entry.version}`]
|
|
108
|
-
},
|
|
109
|
-
"secret.restore": {
|
|
110
|
-
did: "restored",
|
|
111
|
-
tried: "restore",
|
|
112
|
-
what: ({ entry }) => [...place(entry), ...number(entry.metadata.from) === null ? [] : [` to version ${number(entry.metadata.from)}`]],
|
|
113
|
-
then: ({ entry }) => entry.version === null ? [] : [`, now ${entry.version}`]
|
|
114
|
-
},
|
|
115
|
-
"secret.rename": {
|
|
116
|
-
did: "renamed",
|
|
117
|
-
tried: "rename",
|
|
118
|
-
what: ({ entry }) => [...place(entry), ...text(entry.metadata.nextKey) === null ? [] : [` to ${text(entry.metadata.nextKey)}`]]
|
|
119
|
-
},
|
|
120
|
-
"secret.archive": {
|
|
121
|
-
did: "archived",
|
|
122
|
-
tried: "archive",
|
|
123
|
-
what: (facts) => place(facts.entry)
|
|
124
|
-
},
|
|
125
|
-
"secret.unarchive": {
|
|
126
|
-
did: "brought back",
|
|
127
|
-
tried: "bring back",
|
|
128
|
-
what: (facts) => place(facts.entry)
|
|
129
|
-
},
|
|
130
|
-
...placeTemplates("project"),
|
|
131
|
-
...placeTemplates("environment"),
|
|
132
|
-
"access.grant": {
|
|
133
|
-
did: "gave",
|
|
134
|
-
tried: "give",
|
|
135
|
-
what: ({ entry }) => [
|
|
136
|
-
...subject(entry),
|
|
137
|
-
` ${text(entry.metadata.role) ?? "a role"} on `,
|
|
138
|
-
...placeOnly(entry)
|
|
139
|
-
],
|
|
140
|
-
then: ({ entry }) => [...text(entry.metadata.previousRole) === null ? [] : [`, was ${text(entry.metadata.previousRole)}`], ...text(entry.metadata.expiresAt) === null ? [] : [`, until ${text(entry.metadata.expiresAt).slice(0, 10)}`]]
|
|
141
|
-
},
|
|
142
|
-
"access.revoke": {
|
|
143
|
-
did: "took",
|
|
144
|
-
tried: "take",
|
|
145
|
-
what: ({ entry }) => [
|
|
146
|
-
...text(entry.metadata.previousRole ?? entry.metadata.role) === null ? ["access to "] : [`${text(entry.metadata.previousRole ?? entry.metadata.role)} on `],
|
|
147
|
-
...placeOnly(entry),
|
|
148
|
-
" from ",
|
|
149
|
-
...subject(entry)
|
|
150
|
-
]
|
|
151
|
-
},
|
|
152
|
-
"member.add": {
|
|
153
|
-
did: "added",
|
|
154
|
-
tried: "add",
|
|
155
|
-
what: ({ entry }) => [...subject(entry), ...entry.metadata.rootAdmin === true ? [" as a root admin"] : entry.metadata.owner === true ? [" as an owner"] : []]
|
|
156
|
-
},
|
|
157
|
-
"member.remove": {
|
|
158
|
-
did: "removed",
|
|
159
|
-
tried: "remove",
|
|
160
|
-
what: (facts) => subject(facts.entry),
|
|
161
|
-
then: ({ entry }) => number(entry.metadata.revoked) === null ? [] : [`, who held ${plural(number(entry.metadata.revoked), "grant")}`]
|
|
162
|
-
},
|
|
163
|
-
"member.restore": {
|
|
164
|
-
did: "brought back",
|
|
165
|
-
tried: "bring back",
|
|
166
|
-
what: (facts) => subject(facts.entry)
|
|
167
|
-
},
|
|
168
|
-
"member.owner": {
|
|
169
|
-
did: ({ entry }) => entry.metadata.owner === false ? "took owner from" : "made",
|
|
170
|
-
tried: ({ entry }) => entry.metadata.owner === false ? "take owner from" : "make",
|
|
171
|
-
what: ({ entry }) => [...subject(entry), ...entry.metadata.owner === false ? [] : [" an owner"]]
|
|
172
|
-
},
|
|
173
|
-
"sync.create": {
|
|
174
|
-
did: "set up a sync of",
|
|
175
|
-
tried: "set up a sync of",
|
|
176
|
-
what: ({ entry }) => [...environmentOf(entry), toDestination(entry)]
|
|
177
|
-
},
|
|
178
|
-
"sync.update": {
|
|
179
|
-
did: ({ entry }) => entry.metadata.paused === true ? "paused the sync of" : entry.metadata.paused === false ? "resumed the sync of" : "changed the sync of",
|
|
180
|
-
tried: "change the sync of",
|
|
181
|
-
what: ({ entry }) => [...environmentOf(entry), toDestination(entry)]
|
|
182
|
-
},
|
|
183
|
-
"sync.delete": {
|
|
184
|
-
did: "removed the sync of",
|
|
185
|
-
tried: "remove the sync of",
|
|
186
|
-
what: ({ entry }) => [...environmentOf(entry), toDestination(entry)]
|
|
187
|
-
},
|
|
188
|
-
"sync.push": {
|
|
189
|
-
did: "pushed",
|
|
190
|
-
tried: "push",
|
|
191
|
-
what: (facts) => facts.batch.length === 1 ? [...place(facts.entry), ` to ${destination(facts.entry)}`] : [...environmentOf(facts.entry), ` to ${destination(facts.entry)}: ${plural(facts.count, "secret")}`]
|
|
192
|
-
},
|
|
193
|
-
"sync.remove": {
|
|
194
|
-
did: "removed",
|
|
195
|
-
tried: "remove",
|
|
196
|
-
what: (facts) => facts.batch.length === 1 ? [...place(facts.entry), ` from ${destination(facts.entry)}`] : [
|
|
197
|
-
plural(facts.count, "secret"),
|
|
198
|
-
" of ",
|
|
199
|
-
...environmentOf(facts.entry),
|
|
200
|
-
` from ${destination(facts.entry)}`
|
|
201
|
-
]
|
|
202
|
-
},
|
|
203
|
-
"token.bind": {
|
|
204
|
-
did: "trusted CI runs to sign in as",
|
|
205
|
-
tried: "trust CI runs to sign in as",
|
|
206
|
-
what: (facts) => subject(facts.entry)
|
|
207
|
-
},
|
|
208
|
-
"token.unbind": {
|
|
209
|
-
did: "stopped trusting CI runs to sign in as",
|
|
210
|
-
tried: "stop trusting CI runs to sign in as",
|
|
211
|
-
what: (facts) => subject(facts.entry)
|
|
212
|
-
},
|
|
213
|
-
"vault.tampered": {
|
|
214
|
-
did: "found",
|
|
215
|
-
tried: "check",
|
|
216
|
-
what: ({ entry }) => [...entry.subject === null ? ["an entry"] : [...subject(entry), "'s record"], ` tampered with: ${TAMPERING[entry.reason ?? ""] ?? "it fails its seal"}`]
|
|
217
|
-
},
|
|
218
|
-
"key.rotate": {
|
|
219
|
-
did: "rotated its key",
|
|
220
|
-
tried: "rotate its key",
|
|
221
|
-
what: () => []
|
|
222
|
-
},
|
|
223
|
-
sign_in: {
|
|
224
|
-
did: ({ entry }) => entry.metadata.kind === "cli" ? "signed in to the CLI" : "signed in",
|
|
225
|
-
tried: "sign in",
|
|
226
|
-
what: ({ entry }) => text(entry.metadata.provider) === null ? [] : [`with ${text(entry.metadata.provider)}`]
|
|
227
|
-
},
|
|
228
|
-
sign_out: {
|
|
229
|
-
did: "signed out",
|
|
230
|
-
tried: "sign out",
|
|
231
|
-
what: () => []
|
|
232
|
-
},
|
|
233
|
-
"token.create": {
|
|
234
|
-
did: "issued a token to",
|
|
235
|
-
tried: "issue a token to",
|
|
236
|
-
what: (facts) => subject(facts.entry)
|
|
237
|
-
},
|
|
238
|
-
"token.revoke": {
|
|
239
|
-
did: "revoked a token of",
|
|
240
|
-
tried: "revoke a token of",
|
|
241
|
-
what: (facts) => subject(facts.entry)
|
|
242
|
-
},
|
|
243
|
-
"device.approve": {
|
|
244
|
-
did: "approved a CLI sign-in",
|
|
245
|
-
tried: "approve a CLI sign-in",
|
|
246
|
-
what: () => []
|
|
247
|
-
},
|
|
248
|
-
"device.deny": {
|
|
249
|
-
did: "turned down a CLI sign-in",
|
|
250
|
-
tried: "turn down a CLI sign-in",
|
|
251
|
-
what: () => []
|
|
252
|
-
},
|
|
253
|
-
"account.link": {
|
|
254
|
-
did: "linked",
|
|
255
|
-
tried: "link",
|
|
256
|
-
what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? "sign-in"} account`]
|
|
257
|
-
},
|
|
258
|
-
"account.unlink": {
|
|
259
|
-
did: "unlinked",
|
|
260
|
-
tried: "unlink",
|
|
261
|
-
what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? "sign-in"} account`]
|
|
262
|
-
},
|
|
263
|
-
"key.wrap": {
|
|
264
|
-
did: "sealed the key of",
|
|
265
|
-
tried: "seal the key of",
|
|
266
|
-
what: (facts) => versioned(facts.entry)
|
|
267
|
-
},
|
|
268
|
-
"key.rewrap": {
|
|
269
|
-
did: "resealed the key of",
|
|
270
|
-
tried: "reseal the key of",
|
|
271
|
-
what: (facts) => versioned(facts.entry)
|
|
272
|
-
},
|
|
273
|
-
"key.intent": {
|
|
274
|
-
did: "asked KMS about",
|
|
275
|
-
tried: "ask KMS about",
|
|
276
|
-
what: (facts) => secrets(facts)
|
|
277
|
-
},
|
|
278
|
-
"key.check": {
|
|
279
|
-
did: "recorded the check value of",
|
|
280
|
-
tried: "check",
|
|
281
|
-
what: ({ entry }) => [[
|
|
282
|
-
"the",
|
|
283
|
-
text(entry.metadata.kekProvider) === "local" ? null : text(entry.metadata.kekProvider),
|
|
284
|
-
"vault key",
|
|
285
|
-
text(entry.metadata.kekId)
|
|
286
|
-
].filter((word) => word !== null).join(" ")]
|
|
287
|
-
},
|
|
288
|
-
"sync.run": {
|
|
289
|
-
did: "ran the sync of",
|
|
290
|
-
tried: "run the sync of",
|
|
291
|
-
what: ({ entry }) => [...environmentOf(entry), toDestination(entry)]
|
|
292
|
-
},
|
|
293
|
-
"audit.heartbeat": {
|
|
294
|
-
did: "checked in",
|
|
295
|
-
tried: "check in",
|
|
296
|
-
what: () => []
|
|
297
|
-
},
|
|
298
|
-
"audit.checkpoint": {
|
|
299
|
-
did: "signed the log",
|
|
300
|
-
tried: "sign the log",
|
|
301
|
-
what: ({ entry }) => number(entry.metadata.seq) === null ? [] : [`through entry ${number(entry.metadata.seq)}`]
|
|
302
|
-
},
|
|
303
|
-
"secret.list": {
|
|
304
|
-
did: "listed",
|
|
305
|
-
tried: "list",
|
|
306
|
-
what: ({ entry }) => environmentOf(entry)
|
|
307
|
-
},
|
|
308
|
-
"secret.history": {
|
|
309
|
-
did: "read the history of",
|
|
310
|
-
tried: "read the history of",
|
|
311
|
-
what: (facts) => place(facts.entry)
|
|
312
|
-
},
|
|
313
|
-
"secret.update": {
|
|
314
|
-
did: "changed",
|
|
315
|
-
tried: "change",
|
|
316
|
-
what: (facts) => place(facts.entry)
|
|
317
|
-
},
|
|
318
|
-
"sync.list": {
|
|
319
|
-
did: "listed the syncs of",
|
|
320
|
-
tried: "list the syncs of",
|
|
321
|
-
what: ({ entry }) => environmentOf(entry)
|
|
322
|
-
}
|
|
323
|
-
};
|
|
324
|
-
function placeOnly(entry) {
|
|
325
|
-
return place({
|
|
326
|
-
...entry,
|
|
327
|
-
key: null
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
function versioned(entry) {
|
|
331
|
-
return [...place(entry), ...entry.version === null ? [] : [`, version ${entry.version}`]];
|
|
332
|
-
}
|
|
333
|
-
var TAMPERING = {
|
|
334
|
-
mac: "it does not carry the vault's seal",
|
|
335
|
-
stale: "an older copy was put back",
|
|
336
|
-
forged_entry: "the vault did not write it"
|
|
337
|
-
};
|
|
338
|
-
/** Why something was refused, in words. Codes from the vault and the app. */
|
|
339
|
-
var REASONS = {
|
|
340
|
-
no_grant: "no grant",
|
|
341
|
-
bulk_limit: "bulk limit",
|
|
342
|
-
expired: "grant expired",
|
|
343
|
-
removed: "removed from coffre",
|
|
344
|
-
not_a_member: "not a member",
|
|
345
|
-
not_registered: "not invited",
|
|
346
|
-
tampered: "their record was tampered with",
|
|
347
|
-
bad_claim: "the key did not match the secret",
|
|
348
|
-
not_allowed: "not allowed",
|
|
349
|
-
root_admin: "root admins are set by the deployment",
|
|
350
|
-
unknown_environment: "no such environment",
|
|
351
|
-
unknown_secret: "no such secret",
|
|
352
|
-
unknown_project: "no such project",
|
|
353
|
-
unusable_credential: "its token is not a secret they can read",
|
|
354
|
-
duplicate_destination: "already synced from elsewhere",
|
|
355
|
-
cannot_grant_sync: "cannot grant the sync its reads",
|
|
356
|
-
kms_unavailable: "KMS did not answer",
|
|
357
|
-
wrong_kek: "the vault's key is not the one that wrapped the data"
|
|
358
|
-
};
|
|
359
|
-
/** What a missing permission meant, from the app's `missing_<permission>`. */
|
|
360
|
-
var MISSING = {
|
|
361
|
-
secret_read: "no grant to read it",
|
|
362
|
-
secret_write: "no grant to write",
|
|
363
|
-
secret_archive: "no grant to archive",
|
|
364
|
-
audit_read: "no grant to read the audit log",
|
|
365
|
-
environment_manage: "no grant to manage environments",
|
|
366
|
-
grant_manage: "no grant to manage access",
|
|
367
|
-
project_manage: "no grant to manage the project"
|
|
368
|
-
};
|
|
369
|
-
function reasonInWords(reason) {
|
|
370
|
-
if (reason === null) return "refused";
|
|
371
|
-
if (reason.startsWith("missing_")) return MISSING[reason.slice(8)] ?? "no grant";
|
|
372
|
-
return REASONS[reason] ?? reason.replace(/_/g, " ");
|
|
373
|
-
}
|
|
374
|
-
/** In a batch of mixed actions, the one the line is named for: a sync's push, not its reads. */
|
|
375
|
-
var LEAD = [
|
|
376
|
-
"sync.push",
|
|
377
|
-
"sync.remove",
|
|
378
|
-
"secret.write",
|
|
379
|
-
"secret.read"
|
|
380
|
-
];
|
|
381
|
-
function leadOf(batch) {
|
|
382
|
-
for (const action of LEAD) {
|
|
383
|
-
const found = batch.find((entry) => entry.action === action);
|
|
384
|
-
if (found !== void 0) return found;
|
|
385
|
-
}
|
|
386
|
-
return batch[0];
|
|
387
|
-
}
|
|
388
|
-
/** What a line says: one entry, or a batch that shares an operation. */
|
|
389
|
-
function describe(batch) {
|
|
390
|
-
const entry = leadOf(batch);
|
|
391
|
-
const same = batch.filter((other) => other.action === entry.action);
|
|
392
|
-
const denied = same.filter((other) => other.decision === "deny");
|
|
393
|
-
const refused = denied.length === same.length;
|
|
394
|
-
const facts = {
|
|
395
|
-
entry,
|
|
396
|
-
batch: same,
|
|
397
|
-
count: new Set(same.map((other) => `${other.project}/${other.environment}/${other.key}`)).size,
|
|
398
|
-
refused
|
|
399
|
-
};
|
|
400
|
-
const template = TEMPLATES[entry.action];
|
|
401
|
-
if (template === void 0) return {
|
|
402
|
-
parts: [
|
|
403
|
-
entry.action,
|
|
404
|
-
" ",
|
|
405
|
-
...place(entry)
|
|
406
|
-
],
|
|
407
|
-
refused
|
|
408
|
-
};
|
|
409
|
-
const say = (verb) => typeof verb === "string" ? verb : verb(facts);
|
|
410
|
-
const what = template.what(facts);
|
|
411
|
-
const gap = what.length === 0 ? [] : [" "];
|
|
412
|
-
if (refused) {
|
|
413
|
-
const reason = reasonInWords((denied[0] ?? entry).reason);
|
|
414
|
-
return {
|
|
415
|
-
parts: [
|
|
416
|
-
"tried to ",
|
|
417
|
-
say(template.tried),
|
|
418
|
-
...gap,
|
|
419
|
-
...what,
|
|
420
|
-
`: ${reason}`
|
|
421
|
-
],
|
|
422
|
-
refused
|
|
423
|
-
};
|
|
424
|
-
}
|
|
425
|
-
const partly = denied.length === 0 ? [] : [`, ${denied.length} refused: ${reasonInWords(denied[0].reason)}`];
|
|
426
|
-
return {
|
|
427
|
-
parts: [
|
|
428
|
-
say(template.did),
|
|
429
|
-
...gap,
|
|
430
|
-
...what,
|
|
431
|
-
...template.then?.(facts) ?? [],
|
|
432
|
-
...partly
|
|
433
|
-
],
|
|
434
|
-
refused
|
|
435
|
-
};
|
|
436
|
-
}
|
|
437
|
-
/**
|
|
438
|
-
* Who acted, as a part: a member links to their page; a sync or coffre
|
|
439
|
-
* itself is text. A sync is named for where it pushes, which any entry of
|
|
440
|
-
* its batch may say.
|
|
441
|
-
*/
|
|
442
|
-
function who(batch) {
|
|
443
|
-
const entry = batch[0];
|
|
444
|
-
if (entry.actorType === "user") return { member: `user:${entry.actorId}` };
|
|
445
|
-
if (entry.actorType === "service") return { member: `token:${entry.actorId}` };
|
|
446
|
-
if (entry.actorId.startsWith("sync:")) {
|
|
447
|
-
const id = batch.map((other) => text(other.metadata.provider)).find((provider) => provider !== null);
|
|
448
|
-
const provider = id === void 0 ? void 0 : PROVIDERS[id] ?? id;
|
|
449
|
-
return provider === void 0 ? "a sync" : `sync to ${provider}`;
|
|
450
|
-
}
|
|
451
|
-
return SYSTEM[entry.actorId] ?? entry.actorId;
|
|
452
|
-
}
|
|
453
|
-
var PROVIDERS = {
|
|
454
|
-
"github-actions": "GitHub",
|
|
455
|
-
vercel: "Vercel",
|
|
456
|
-
railway: "Railway",
|
|
457
|
-
"cloudflare-workers": "Cloudflare"
|
|
458
|
-
};
|
|
459
|
-
var SYSTEM = {
|
|
460
|
-
scheduler: "the scheduler",
|
|
461
|
-
cron: "the scheduler",
|
|
462
|
-
vault: "the vault",
|
|
463
|
-
app: "coffre"
|
|
464
|
-
};
|
|
465
|
-
/** Which components wrote the line, the vault first: "vault", "app", "vault, app". */
|
|
466
|
-
function decidedBy(batch) {
|
|
467
|
-
return ["vault", "app"].filter((author) => batch.some((entry) => entry.author === author)).join(", ");
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Entries in the order the page shows them, newest first, each batch as one
|
|
471
|
-
* line at its newest entry. The server leaves detail out unless asked.
|
|
472
|
-
*/
|
|
473
|
-
function lines(entries) {
|
|
474
|
-
const shown = [];
|
|
475
|
-
const batches = /* @__PURE__ */ new Map();
|
|
476
|
-
for (const entry of entries) {
|
|
477
|
-
const batch = entry.operationId === null ? void 0 : batches.get(entry.operationId);
|
|
478
|
-
if (batch !== void 0) {
|
|
479
|
-
batch.push(entry);
|
|
480
|
-
continue;
|
|
481
|
-
}
|
|
482
|
-
const fresh = [entry];
|
|
483
|
-
if (entry.operationId !== null) batches.set(entry.operationId, fresh);
|
|
484
|
-
shown.push(fresh);
|
|
485
|
-
}
|
|
486
|
-
return shown;
|
|
487
|
-
}
|
|
488
|
-
/**
|
|
489
|
-
* The CI run an entry was written for, as its issuer stated it at the
|
|
490
|
-
* exchange: `acme/api run 7001 at 3f2a9c1`, a GitLab pipeline, or the
|
|
491
|
-
* token's subject. Null for an entry no trust binding's credential wrote.
|
|
492
|
-
*/
|
|
493
|
-
function runLabel(run) {
|
|
494
|
-
if (run === null) return null;
|
|
495
|
-
const { claims } = run;
|
|
496
|
-
const text = (name) => typeof claims[name] === "string" || typeof claims[name] === "number" ? String(claims[name]) : null;
|
|
497
|
-
const at = text("sha") === null ? "" : ` at ${text("sha").slice(0, 7)}`;
|
|
498
|
-
if (text("repository") !== null && text("run_id") !== null) return `${text("repository")} run ${text("run_id")}${at}`;
|
|
499
|
-
if (text("project_path") !== null && text("pipeline_id") !== null) return `${text("project_path")} pipeline ${text("pipeline_id")}${at}`;
|
|
500
|
-
return text("sub") === null ? "a CI run" : `CI run ${text("sub")}`;
|
|
501
|
-
}
|
|
502
|
-
//#endregion
|
|
503
10
|
//#region src/pages/audit.tsx
|
|
504
11
|
var Route = pageRoute();
|
|
505
12
|
function AuditPage() {
|
|
@@ -577,7 +84,10 @@ function AuditPage() {
|
|
|
577
84
|
decision: void 0,
|
|
578
85
|
detail: search.detail
|
|
579
86
|
},
|
|
580
|
-
activeOptions: {
|
|
87
|
+
activeOptions: {
|
|
88
|
+
exact: true,
|
|
89
|
+
includeSearch: false
|
|
90
|
+
},
|
|
581
91
|
children: "All events"
|
|
582
92
|
}), /* @__PURE__ */ jsxs(Link, {
|
|
583
93
|
to: "/audit",
|
|
@@ -586,7 +96,10 @@ function AuditPage() {
|
|
|
586
96
|
decision: "deny",
|
|
587
97
|
detail: search.detail
|
|
588
98
|
},
|
|
589
|
-
activeOptions: {
|
|
99
|
+
activeOptions: {
|
|
100
|
+
exact: true,
|
|
101
|
+
includeSearch: false
|
|
102
|
+
},
|
|
590
103
|
children: [/* @__PURE__ */ jsx(SlashCircle, { size: 13 }), "Denials only"]
|
|
591
104
|
})]
|
|
592
105
|
}),
|
|
@@ -624,7 +137,7 @@ function AuditPage() {
|
|
|
624
137
|
]
|
|
625
138
|
}),
|
|
626
139
|
/* @__PURE__ */ jsx("section", {
|
|
627
|
-
className: "card",
|
|
140
|
+
className: "card card-wide",
|
|
628
141
|
"aria-label": "Audit entries",
|
|
629
142
|
children: shown.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
630
143
|
title: deniedOnly ? "No denials recorded" : "Nothing recorded yet",
|
|
@@ -693,7 +206,6 @@ function Line({ batch, filters, detail, breakAt }) {
|
|
|
693
206
|
detail,
|
|
694
207
|
breaks: breaksInside && !grouped,
|
|
695
208
|
marked: breaksInside,
|
|
696
|
-
batch,
|
|
697
209
|
toggle: grouped ? /* @__PURE__ */ jsx("button", {
|
|
698
210
|
type: "button",
|
|
699
211
|
className: "batch-toggle",
|
|
@@ -718,8 +230,8 @@ function Line({ batch, filters, detail, breakAt }) {
|
|
|
718
230
|
}, entry.seq);
|
|
719
231
|
})] });
|
|
720
232
|
}
|
|
721
|
-
function Row({ entry, seq, parts, refused, decided, filters, detail, breaks, marked, toggle, child = false
|
|
722
|
-
const actor = who(
|
|
233
|
+
function Row({ entry, seq, parts, refused, decided, filters, detail, breaks, marked, toggle, child = false }) {
|
|
234
|
+
const actor = who(entry);
|
|
723
235
|
const classes = [
|
|
724
236
|
refused && "is-denied",
|
|
725
237
|
(breaks || marked) && "is-break",
|
|
@@ -798,43 +310,6 @@ function Row({ entry, seq, parts, refused, decided, filters, detail, breaks, mar
|
|
|
798
310
|
]
|
|
799
311
|
});
|
|
800
312
|
}
|
|
801
|
-
/** A sentence, its people and places links to their pages. */
|
|
802
|
-
function Sentence({ parts }) {
|
|
803
|
-
return /* @__PURE__ */ jsx(Fragment$1, { children: parts.map((part, index) => /* @__PURE__ */ jsx(Fragment, { children: typeof part === "string" ? part : "place" in part ? /* @__PURE__ */ jsx(PlaceLink, { path: part.place }) : /* @__PURE__ */ jsx(MemberLink, { member: part.member }) }, index)) });
|
|
804
|
-
}
|
|
805
|
-
function PlaceLink({ path }) {
|
|
806
|
-
const [project, environment] = path.split("/");
|
|
807
|
-
const text = /* @__PURE__ */ jsx("span", {
|
|
808
|
-
className: "mono",
|
|
809
|
-
children: breakAfterUnderscores(path)
|
|
810
|
-
});
|
|
811
|
-
return environment === void 0 ? /* @__PURE__ */ jsx(Link, {
|
|
812
|
-
to: "/projects/$project",
|
|
813
|
-
params: { project },
|
|
814
|
-
children: text
|
|
815
|
-
}) : /* @__PURE__ */ jsx(Link, {
|
|
816
|
-
to: "/projects/$project/$environment",
|
|
817
|
-
params: {
|
|
818
|
-
project,
|
|
819
|
-
environment
|
|
820
|
-
},
|
|
821
|
-
children: text
|
|
822
|
-
});
|
|
823
|
-
}
|
|
824
|
-
function MemberLink({ member }) {
|
|
825
|
-
return member.startsWith("token:") ? /* @__PURE__ */ jsx(Link, {
|
|
826
|
-
to: "/tokens/$token",
|
|
827
|
-
params: { token: member.slice(6) },
|
|
828
|
-
children: member
|
|
829
|
-
}) : /* @__PURE__ */ jsx(Link, {
|
|
830
|
-
to: "/users/$user",
|
|
831
|
-
params: { user: memberName(member) },
|
|
832
|
-
children: memberName(member)
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
function memberName(member) {
|
|
836
|
-
return member.startsWith("user:") ? member.slice(5) : member;
|
|
837
|
-
}
|
|
838
313
|
/** The entry the log breaks at, said in words as well as in red. */
|
|
839
314
|
function BreakMark() {
|
|
840
315
|
return /* @__PURE__ */ jsxs("span", {
|
|
@@ -907,7 +382,7 @@ function ChainStatus({ chain, onRetry }) {
|
|
|
907
382
|
})
|
|
908
383
|
}), /* @__PURE__ */ jsx(Toggletip, {
|
|
909
384
|
align: "end",
|
|
910
|
-
label: `Every entry through ${chain.through ?? 0} holds, under the app's key and the vault's.` + (chain.checkpoint === null ? "
|
|
385
|
+
label: `Every entry through ${chain.through ?? 0} holds, under the app's key and the vault's.` + (chain.checkpoint === null ? " Not checkpointed yet: the vault signs the log every few minutes." : ` The vault last signed it through entry ${chain.checkpoint.seq}, at ${chain.checkpoint.signedAt}.`),
|
|
911
386
|
children: /* @__PURE__ */ jsxs("button", {
|
|
912
387
|
type: "button",
|
|
913
388
|
className: "chain-seal",
|