@coffre/ui 0.3.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} +112 -54
- 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 +112 -93
- 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
|
@@ -0,0 +1,660 @@
|
|
|
1
|
+
import { m as breakAfterUnderscores } from "./ui-DJje3gST.js";
|
|
2
|
+
import { Fragment } from "react";
|
|
3
|
+
import { Link } from "@tanstack/react-router";
|
|
4
|
+
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
5
|
+
import { serviceName, shownMember } from "@coffre/client";
|
|
6
|
+
//#region src/lib/audit-sentences.ts
|
|
7
|
+
var text = (value) => typeof value === "string" && value !== "" ? value : null;
|
|
8
|
+
var number = (value) => typeof value === "number" ? value : null;
|
|
9
|
+
/** The entry's place, as deep as it goes. */
|
|
10
|
+
function place({ project, environment, key }) {
|
|
11
|
+
const path = [
|
|
12
|
+
project,
|
|
13
|
+
environment,
|
|
14
|
+
key
|
|
15
|
+
].filter((part) => part !== null);
|
|
16
|
+
return path.length === 0 ? ["coffre"] : [{ place: path.join("/") }];
|
|
17
|
+
}
|
|
18
|
+
function environmentOf({ project, environment }) {
|
|
19
|
+
return place({
|
|
20
|
+
project,
|
|
21
|
+
environment,
|
|
22
|
+
key: null
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** The member an entry is about: its subject, or the principal a token entry names. */
|
|
26
|
+
function subject(entry) {
|
|
27
|
+
if (entry.subject !== null) return [{ member: entry.subject }];
|
|
28
|
+
const id = text(entry.metadata.principalId);
|
|
29
|
+
if (id === null) return ["someone"];
|
|
30
|
+
return [{ member: `${entry.metadata.principalType === "service" ? "token" : "user"}:${id}` }];
|
|
31
|
+
}
|
|
32
|
+
/** An MCP client, by the name it connected under. */
|
|
33
|
+
function app(entry) {
|
|
34
|
+
return [text(entry.metadata.clientName) ?? "an app"];
|
|
35
|
+
}
|
|
36
|
+
/** A tool's call: its name, and what it named. */
|
|
37
|
+
function tool(entry) {
|
|
38
|
+
const names = Array.isArray(entry.metadata.names) ? entry.metadata.names.filter((name) => typeof name === "string") : [];
|
|
39
|
+
return [text(entry.metadata.tool) ?? "a tool", ...names.length === 0 ? [] : [` on ${names.join(", ")}`]];
|
|
40
|
+
}
|
|
41
|
+
/** The client a request came through, said after what it did: "via Claude". */
|
|
42
|
+
function via(entry) {
|
|
43
|
+
const client = entry.metadata.via?.clientName;
|
|
44
|
+
return typeof client === "string" ? [` via ${client}`] : [];
|
|
45
|
+
}
|
|
46
|
+
/** Why coffre itself ended a connection, said after it. */
|
|
47
|
+
var DISCONNECTED = {
|
|
48
|
+
code_reused: ": its sign-in code was used twice",
|
|
49
|
+
refresh_reused: ": a refresh token it had replaced was used again",
|
|
50
|
+
revocation_endpoint: ", at its own request",
|
|
51
|
+
superseded: ": a connection with more scopes replaced it"
|
|
52
|
+
};
|
|
53
|
+
function plural(count, one, many = `${one}s`) {
|
|
54
|
+
return `${count} ${count === 1 ? one : many}`;
|
|
55
|
+
}
|
|
56
|
+
/** A batch reads as its environment and a count; one entry as its secret. */
|
|
57
|
+
/**
|
|
58
|
+
* The secrets a read or write was about. A read through a reference is a
|
|
59
|
+
* read of its source, "market/prod/DATABASE_URL through
|
|
60
|
+
* billing/prod/DATABASE_URL"; a run that read some that way is a run of
|
|
61
|
+
* the environment that holds them.
|
|
62
|
+
*/
|
|
63
|
+
function secrets(facts) {
|
|
64
|
+
const through = (entry) => text(entry.metadata.via?.path);
|
|
65
|
+
if (facts.batch.length === 1) {
|
|
66
|
+
const held = through(facts.entry);
|
|
67
|
+
return held === null ? place(facts.entry) : [
|
|
68
|
+
...place(facts.entry),
|
|
69
|
+
" through ",
|
|
70
|
+
{ place: held }
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
const own = facts.batch.find((entry) => through(entry) === null);
|
|
74
|
+
const held = facts.batch.map(through).filter((path) => path !== null);
|
|
75
|
+
return [
|
|
76
|
+
...own !== void 0 ? environmentOf(own) : [{ place: held[0].split("/").slice(0, 2).join("/") }],
|
|
77
|
+
facts.refused ? ", " : ": ",
|
|
78
|
+
plural(facts.count, "secret"),
|
|
79
|
+
...held.length === 0 ? [] : [`, ${held.length} through ${held.length === 1 ? "a reference" : "references"}`]
|
|
80
|
+
];
|
|
81
|
+
}
|
|
82
|
+
/** "market/prod/OLD", or "OLD and STALE in market/prod" for an archive of several keys refused. */
|
|
83
|
+
function archivedKeys(entry) {
|
|
84
|
+
const keys = Array.isArray(entry.metadata.keys) ? entry.metadata.keys.filter((key) => text(key) !== null) : [];
|
|
85
|
+
if (entry.key !== null || keys.length === 0) return place(entry);
|
|
86
|
+
return [
|
|
87
|
+
keys.length === 1 ? keys[0] : `${keys.slice(0, -1).join(", ")} and ${keys.at(-1)}`,
|
|
88
|
+
" in ",
|
|
89
|
+
...environmentOf(entry)
|
|
90
|
+
];
|
|
91
|
+
}
|
|
92
|
+
/** "SENTRY_DSN in market/dev", or "3 keys in market/dev" for a Dismiss all. */
|
|
93
|
+
function missingKeys(facts) {
|
|
94
|
+
const key = text(facts.entry.metadata.key);
|
|
95
|
+
return [
|
|
96
|
+
facts.batch.length === 1 && key !== null ? key : plural(facts.count, "key"),
|
|
97
|
+
" in ",
|
|
98
|
+
...environmentOf(facts.entry)
|
|
99
|
+
];
|
|
100
|
+
}
|
|
101
|
+
/** "billing/prod/DATABASE_URL a reference to market/prod/DATABASE_URL", from either author's entry. */
|
|
102
|
+
function referenceTo(entry) {
|
|
103
|
+
const holder = text(entry.metadata.subject);
|
|
104
|
+
const key = text(entry.metadata.key);
|
|
105
|
+
const source = text(entry.metadata.source) ?? text(entry.metadata.source?.path);
|
|
106
|
+
return [...holder !== null ? [{ place: holder }] : key !== null ? place(entry) : environmentOf(entry), ...source === null ? [] : [" a reference to ", { place: source }]];
|
|
107
|
+
}
|
|
108
|
+
var READ_VERBS = {
|
|
109
|
+
reveal: ["revealed", "reveal"],
|
|
110
|
+
run: ["ran", "run"],
|
|
111
|
+
compare: ["compared", "compare"],
|
|
112
|
+
copy: ["copied", "copy"]
|
|
113
|
+
};
|
|
114
|
+
function readVerb({ entry }) {
|
|
115
|
+
return READ_VERBS[text(entry.metadata.purpose) ?? "reveal"] ?? READ_VERBS.reveal;
|
|
116
|
+
}
|
|
117
|
+
var placeTemplates = (kind) => {
|
|
118
|
+
const what = (facts) => [`${kind} `, ...kind === "project" ? place({
|
|
119
|
+
...facts.entry,
|
|
120
|
+
environment: null,
|
|
121
|
+
key: null
|
|
122
|
+
}) : environmentOf(facts.entry)];
|
|
123
|
+
return {
|
|
124
|
+
[`${kind}.create`]: {
|
|
125
|
+
did: "created",
|
|
126
|
+
tried: "create",
|
|
127
|
+
what,
|
|
128
|
+
then: ({ entry }) => text(entry.metadata.from) === null ? [] : [`, a fork of ${text(entry.metadata.from)}`]
|
|
129
|
+
},
|
|
130
|
+
[`${kind}.update`]: {
|
|
131
|
+
did: "changed",
|
|
132
|
+
tried: "change",
|
|
133
|
+
what
|
|
134
|
+
},
|
|
135
|
+
[`${kind}.archive`]: {
|
|
136
|
+
did: "archived",
|
|
137
|
+
tried: "archive",
|
|
138
|
+
what
|
|
139
|
+
},
|
|
140
|
+
[`${kind}.restore`]: {
|
|
141
|
+
did: "restored",
|
|
142
|
+
tried: "restore",
|
|
143
|
+
what
|
|
144
|
+
},
|
|
145
|
+
[`${kind}.delete`]: {
|
|
146
|
+
did: "deleted",
|
|
147
|
+
tried: "delete",
|
|
148
|
+
what
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
};
|
|
152
|
+
var TEMPLATES = {
|
|
153
|
+
"secret.read": {
|
|
154
|
+
did: (facts) => readVerb(facts)[0],
|
|
155
|
+
tried: (facts) => readVerb(facts)[1],
|
|
156
|
+
what: secrets
|
|
157
|
+
},
|
|
158
|
+
"secret.write": {
|
|
159
|
+
did: ({ batch }) => {
|
|
160
|
+
const firsts = batch.filter((entry) => entry.version === 1).length;
|
|
161
|
+
return firsts === batch.length ? "added" : firsts === 0 ? "changed" : "wrote";
|
|
162
|
+
},
|
|
163
|
+
tried: "change",
|
|
164
|
+
what: secrets,
|
|
165
|
+
then: ({ entry, batch }) => batch.length > 1 || entry.version === null || entry.version === 1 ? [] : [`, now version ${entry.version}`]
|
|
166
|
+
},
|
|
167
|
+
"secret.restore": {
|
|
168
|
+
did: "restored",
|
|
169
|
+
tried: "restore",
|
|
170
|
+
what: ({ entry }) => [...place(entry), ...number(entry.metadata.from) === null ? [] : [` to version ${number(entry.metadata.from)}`]],
|
|
171
|
+
then: ({ entry }) => entry.version === null ? [] : [`, now ${entry.version}`]
|
|
172
|
+
},
|
|
173
|
+
"secret.rename": {
|
|
174
|
+
did: "renamed",
|
|
175
|
+
tried: "rename",
|
|
176
|
+
what: ({ entry }) => [...place(entry), ...text(entry.metadata.nextKey) === null ? [] : [` to ${text(entry.metadata.nextKey)}`]]
|
|
177
|
+
},
|
|
178
|
+
"secret.archive": {
|
|
179
|
+
did: "archived",
|
|
180
|
+
tried: "archive",
|
|
181
|
+
what: ({ entry }) => archivedKeys(entry)
|
|
182
|
+
},
|
|
183
|
+
"missing.dismiss": {
|
|
184
|
+
did: "dismissed",
|
|
185
|
+
tried: "dismiss",
|
|
186
|
+
what: (facts) => missingKeys(facts),
|
|
187
|
+
then: () => [" as not needed"]
|
|
188
|
+
},
|
|
189
|
+
"missing.restore": {
|
|
190
|
+
did: "restored",
|
|
191
|
+
tried: "restore",
|
|
192
|
+
what: (facts) => missingKeys(facts),
|
|
193
|
+
then: () => [" to the missing keys"]
|
|
194
|
+
},
|
|
195
|
+
"secret.reference": {
|
|
196
|
+
did: "made",
|
|
197
|
+
tried: "make",
|
|
198
|
+
what: ({ entry }) => referenceTo(entry)
|
|
199
|
+
},
|
|
200
|
+
"reference.create": {
|
|
201
|
+
did: "made",
|
|
202
|
+
tried: "make",
|
|
203
|
+
what: ({ entry }) => referenceTo(entry)
|
|
204
|
+
},
|
|
205
|
+
"reference.end": {
|
|
206
|
+
did: ({ entry }) => entry.metadata.reason === "replaced" ? "gave a value of its own to" : entry.metadata.reason === "abandoned" ? "abandoned" : "broke",
|
|
207
|
+
tried: ({ entry }) => entry.metadata.reason === "replaced" ? "replace" : entry.metadata.reason === "abandoned" ? "abandon" : "break",
|
|
208
|
+
what: ({ entry }) => {
|
|
209
|
+
const source = text(entry.metadata.source?.path);
|
|
210
|
+
const holder = text(entry.metadata.subject);
|
|
211
|
+
if (entry.metadata.reason === "replaced") return [...holder === null ? ["a reference"] : [{ place: holder }], ...source === null ? [] : [", no longer a reference to ", { place: source }]];
|
|
212
|
+
return [
|
|
213
|
+
"the reference ",
|
|
214
|
+
...holder === null ? [] : [{ place: holder }],
|
|
215
|
+
...source === null ? [] : [" to ", { place: source }]
|
|
216
|
+
];
|
|
217
|
+
},
|
|
218
|
+
then: ({ entry }) => entry.metadata.reason === "abandoned" ? [", which its write never stored"] : []
|
|
219
|
+
},
|
|
220
|
+
"secret.unarchive": {
|
|
221
|
+
did: "brought back",
|
|
222
|
+
tried: "bring back",
|
|
223
|
+
what: (facts) => place(facts.entry)
|
|
224
|
+
},
|
|
225
|
+
"secret.move": {
|
|
226
|
+
did: "moved",
|
|
227
|
+
tried: "move",
|
|
228
|
+
what: (facts) => place(facts.entry),
|
|
229
|
+
then: ({ entry }) => intoFolder(entry)
|
|
230
|
+
},
|
|
231
|
+
...placeTemplates("project"),
|
|
232
|
+
"project.move": {
|
|
233
|
+
did: "moved",
|
|
234
|
+
tried: "move",
|
|
235
|
+
what: ({ entry }) => ["project ", ...place({
|
|
236
|
+
...entry,
|
|
237
|
+
environment: null,
|
|
238
|
+
key: null
|
|
239
|
+
})],
|
|
240
|
+
then: ({ entry }) => intoFolder(entry)
|
|
241
|
+
},
|
|
242
|
+
...placeTemplates("environment"),
|
|
243
|
+
"environment.fork": {
|
|
244
|
+
did: "forked",
|
|
245
|
+
tried: "fork",
|
|
246
|
+
what: ({ entry }) => [...environmentOf(entry), ...text(entry.metadata.slug) === null ? [] : [` into ${text(entry.metadata.slug)}`]]
|
|
247
|
+
},
|
|
248
|
+
"access.grant": {
|
|
249
|
+
did: "gave",
|
|
250
|
+
tried: "give",
|
|
251
|
+
what: ({ entry }) => [
|
|
252
|
+
...subject(entry),
|
|
253
|
+
` ${text(entry.metadata.role) ?? "a role"} on `,
|
|
254
|
+
...placeOnly(entry)
|
|
255
|
+
],
|
|
256
|
+
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)}`]]
|
|
257
|
+
},
|
|
258
|
+
"access.revoke": {
|
|
259
|
+
did: "took",
|
|
260
|
+
tried: "take",
|
|
261
|
+
what: ({ entry }) => [
|
|
262
|
+
...text(entry.metadata.previousRole ?? entry.metadata.role) === null ? ["access to "] : [`${text(entry.metadata.previousRole ?? entry.metadata.role)} on `],
|
|
263
|
+
...placeOnly(entry),
|
|
264
|
+
" from ",
|
|
265
|
+
...subject(entry)
|
|
266
|
+
]
|
|
267
|
+
},
|
|
268
|
+
"member.add": {
|
|
269
|
+
did: "added",
|
|
270
|
+
tried: "add",
|
|
271
|
+
what: ({ entry }) => [...subject(entry), ...entry.metadata.rootAdmin === true ? [" as a root admin"] : entry.metadata.owner === true ? [" as an owner"] : []]
|
|
272
|
+
},
|
|
273
|
+
"member.remove": {
|
|
274
|
+
did: "removed",
|
|
275
|
+
tried: "remove",
|
|
276
|
+
what: (facts) => subject(facts.entry),
|
|
277
|
+
then: ({ entry }) => number(entry.metadata.revoked) === null ? [] : [`, who held ${plural(number(entry.metadata.revoked), "grant")}`]
|
|
278
|
+
},
|
|
279
|
+
"member.restore": {
|
|
280
|
+
did: "brought back",
|
|
281
|
+
tried: "bring back",
|
|
282
|
+
what: (facts) => subject(facts.entry)
|
|
283
|
+
},
|
|
284
|
+
"member.owner": {
|
|
285
|
+
did: ({ entry }) => entry.metadata.owner === false ? "took owner from" : "made",
|
|
286
|
+
tried: ({ entry }) => entry.metadata.owner === false ? "take owner from" : "make",
|
|
287
|
+
what: ({ entry }) => [...subject(entry), ...entry.metadata.owner === false ? [] : [" an owner"]]
|
|
288
|
+
},
|
|
289
|
+
"token.bind": {
|
|
290
|
+
did: "trusted CI runs to sign in as",
|
|
291
|
+
tried: "trust CI runs to sign in as",
|
|
292
|
+
what: (facts) => subject(facts.entry)
|
|
293
|
+
},
|
|
294
|
+
"token.unbind": {
|
|
295
|
+
did: "stopped trusting CI runs to sign in as",
|
|
296
|
+
tried: "stop trusting CI runs to sign in as",
|
|
297
|
+
what: (facts) => subject(facts.entry)
|
|
298
|
+
},
|
|
299
|
+
"vault.tampered": {
|
|
300
|
+
did: "found",
|
|
301
|
+
tried: "check",
|
|
302
|
+
what: ({ entry }) => [...entry.subject === null ? ["an entry"] : [...subject(entry), "'s record"], ` tampered with: ${TAMPERING[entry.reason ?? ""] ?? "it fails its seal"}`]
|
|
303
|
+
},
|
|
304
|
+
"key.rotate": {
|
|
305
|
+
did: "rotated its key",
|
|
306
|
+
tried: "rotate its key",
|
|
307
|
+
what: () => []
|
|
308
|
+
},
|
|
309
|
+
"mcp.connect": {
|
|
310
|
+
did: "connected",
|
|
311
|
+
tried: "connect",
|
|
312
|
+
what: ({ entry }) => app(entry)
|
|
313
|
+
},
|
|
314
|
+
"mcp.call": {
|
|
315
|
+
did: "used",
|
|
316
|
+
tried: "use",
|
|
317
|
+
what: ({ entry }) => tool(entry),
|
|
318
|
+
then: ({ entry }) => via(entry)
|
|
319
|
+
},
|
|
320
|
+
"mcp.approve": {
|
|
321
|
+
did: "approved",
|
|
322
|
+
tried: "approve",
|
|
323
|
+
what: ({ entry }) => tool(entry),
|
|
324
|
+
then: ({ entry }) => [` for ${text(entry.metadata.clientName) ?? "an app"}`]
|
|
325
|
+
},
|
|
326
|
+
"mcp.deny": {
|
|
327
|
+
did: "turned down",
|
|
328
|
+
tried: "turn down",
|
|
329
|
+
what: ({ entry }) => tool(entry),
|
|
330
|
+
then: ({ entry }) => [` for ${text(entry.metadata.clientName) ?? "an app"}`]
|
|
331
|
+
},
|
|
332
|
+
"mcp.view": {
|
|
333
|
+
did: "opened an approval",
|
|
334
|
+
tried: "open an approval",
|
|
335
|
+
what: () => []
|
|
336
|
+
},
|
|
337
|
+
"mcp.disconnect": {
|
|
338
|
+
did: "disconnected",
|
|
339
|
+
tried: "disconnect",
|
|
340
|
+
what: ({ entry }) => [...app(entry), ...entry.metadata.principalId === void 0 ? [] : [" of ", ...subject(entry)]],
|
|
341
|
+
then: ({ entry }) => [DISCONNECTED[text(entry.metadata.reason) ?? ""] ?? ""]
|
|
342
|
+
},
|
|
343
|
+
sign_in: {
|
|
344
|
+
did: ({ entry }) => entry.metadata.kind === "cli" ? "signed in to the CLI" : "signed in",
|
|
345
|
+
tried: "sign in",
|
|
346
|
+
what: ({ entry }) => text(entry.metadata.provider) === null ? [] : [`with ${text(entry.metadata.provider)}`]
|
|
347
|
+
},
|
|
348
|
+
sign_out: {
|
|
349
|
+
did: "signed out",
|
|
350
|
+
tried: "sign out",
|
|
351
|
+
what: () => []
|
|
352
|
+
},
|
|
353
|
+
"token.create": {
|
|
354
|
+
did: "issued a bearer token to",
|
|
355
|
+
tried: "issue a bearer token to",
|
|
356
|
+
what: (facts) => subject(facts.entry)
|
|
357
|
+
},
|
|
358
|
+
"token.revoke": {
|
|
359
|
+
did: "revoked a bearer token of",
|
|
360
|
+
tried: "revoke a bearer token of",
|
|
361
|
+
what: (facts) => subject(facts.entry)
|
|
362
|
+
},
|
|
363
|
+
"device.approve": {
|
|
364
|
+
did: "approved a CLI sign-in",
|
|
365
|
+
tried: "approve a CLI sign-in",
|
|
366
|
+
what: () => []
|
|
367
|
+
},
|
|
368
|
+
"device.deny": {
|
|
369
|
+
did: "turned down a CLI sign-in",
|
|
370
|
+
tried: "turn down a CLI sign-in",
|
|
371
|
+
what: () => []
|
|
372
|
+
},
|
|
373
|
+
"mcp.read": {
|
|
374
|
+
did: "used",
|
|
375
|
+
tried: "use",
|
|
376
|
+
what: ({ entry }) => tool(entry),
|
|
377
|
+
then: ({ entry }) => via(entry)
|
|
378
|
+
},
|
|
379
|
+
"mcp.token": {
|
|
380
|
+
did: ({ entry }) => entry.metadata.grant === "refresh_token" ? "refreshed the tokens of" : "gave its first tokens to",
|
|
381
|
+
tried: "give tokens to",
|
|
382
|
+
what: ({ entry }) => app(entry)
|
|
383
|
+
},
|
|
384
|
+
"account.link": {
|
|
385
|
+
did: "linked",
|
|
386
|
+
tried: "link",
|
|
387
|
+
what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? "sign-in"} account`]
|
|
388
|
+
},
|
|
389
|
+
"account.unlink": {
|
|
390
|
+
did: "unlinked",
|
|
391
|
+
tried: "unlink",
|
|
392
|
+
what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? "sign-in"} account`]
|
|
393
|
+
},
|
|
394
|
+
"key.wrap": {
|
|
395
|
+
did: "sealed the key of",
|
|
396
|
+
tried: "seal the key of",
|
|
397
|
+
what: (facts) => versioned(facts.entry)
|
|
398
|
+
},
|
|
399
|
+
"key.rewrap": {
|
|
400
|
+
did: "resealed the key of",
|
|
401
|
+
tried: "reseal the key of",
|
|
402
|
+
what: (facts) => versioned(facts.entry)
|
|
403
|
+
},
|
|
404
|
+
"key.intent": {
|
|
405
|
+
did: "asked KMS about",
|
|
406
|
+
tried: "ask KMS about",
|
|
407
|
+
what: (facts) => secrets(facts)
|
|
408
|
+
},
|
|
409
|
+
"key.check": {
|
|
410
|
+
did: "recorded the check value of",
|
|
411
|
+
tried: "check",
|
|
412
|
+
what: ({ entry }) => [[
|
|
413
|
+
"the",
|
|
414
|
+
text(entry.metadata.kekProvider) === "local" ? null : text(entry.metadata.kekProvider),
|
|
415
|
+
"vault key",
|
|
416
|
+
text(entry.metadata.kekId)
|
|
417
|
+
].filter((word) => word !== null).join(" ")]
|
|
418
|
+
},
|
|
419
|
+
"audit.heartbeat": {
|
|
420
|
+
did: "checked in",
|
|
421
|
+
tried: "check in",
|
|
422
|
+
what: () => []
|
|
423
|
+
},
|
|
424
|
+
"audit.checkpoint": {
|
|
425
|
+
did: "signed the log",
|
|
426
|
+
tried: "sign the log",
|
|
427
|
+
what: ({ entry }) => number(entry.metadata.seq) === null ? [] : [`through entry ${number(entry.metadata.seq)}`]
|
|
428
|
+
},
|
|
429
|
+
"secret.list": {
|
|
430
|
+
did: "listed",
|
|
431
|
+
tried: "list",
|
|
432
|
+
what: ({ entry }) => environmentOf(entry)
|
|
433
|
+
},
|
|
434
|
+
"secret.history": {
|
|
435
|
+
did: "read the history of",
|
|
436
|
+
tried: "read the history of",
|
|
437
|
+
what: (facts) => place(facts.entry)
|
|
438
|
+
},
|
|
439
|
+
"secret.update": {
|
|
440
|
+
did: "changed",
|
|
441
|
+
tried: "change",
|
|
442
|
+
what: (facts) => place(facts.entry)
|
|
443
|
+
}
|
|
444
|
+
};
|
|
445
|
+
/** " to the folder stripe", or " out of its folder". */
|
|
446
|
+
function intoFolder(entry) {
|
|
447
|
+
const folder = text(entry.metadata.to);
|
|
448
|
+
return [folder === null ? " out of its folder" : ` to the folder ${folder}`];
|
|
449
|
+
}
|
|
450
|
+
function placeOnly(entry) {
|
|
451
|
+
const everywhere = entry.project === null ? text(entry.metadata.place) : null;
|
|
452
|
+
if (everywhere !== null) return [everywhere === "*" ? "every project" : `${everywhere.slice(2)} in every project`];
|
|
453
|
+
return place({
|
|
454
|
+
...entry,
|
|
455
|
+
key: null
|
|
456
|
+
});
|
|
457
|
+
}
|
|
458
|
+
function versioned(entry) {
|
|
459
|
+
return [...place(entry), ...entry.version === null ? [] : [`, version ${entry.version}`]];
|
|
460
|
+
}
|
|
461
|
+
var TAMPERING = {
|
|
462
|
+
mac: "it does not carry the vault's seal",
|
|
463
|
+
stale: "an older copy was put back",
|
|
464
|
+
forged_entry: "the vault did not write it"
|
|
465
|
+
};
|
|
466
|
+
/** Why something was refused, in words. Codes from the vault and the app. */
|
|
467
|
+
var REASONS = {
|
|
468
|
+
no_grant: "no grant",
|
|
469
|
+
bulk_limit: "bulk limit",
|
|
470
|
+
expired: "grant expired",
|
|
471
|
+
removed: "removed from coffre",
|
|
472
|
+
not_a_member: "not a member",
|
|
473
|
+
not_registered: "not invited",
|
|
474
|
+
tampered: "their record was tampered with",
|
|
475
|
+
bad_claim: "the key did not match the secret",
|
|
476
|
+
deleted: "the place was deleted",
|
|
477
|
+
not_allowed: "not allowed",
|
|
478
|
+
root_admin: "root admins are set by the deployment",
|
|
479
|
+
unknown_environment: "no such environment",
|
|
480
|
+
unknown_secret: "no such secret",
|
|
481
|
+
no_value: "it holds no value",
|
|
482
|
+
unknown_project: "no such project",
|
|
483
|
+
not_archived: "it was not archived",
|
|
484
|
+
referenced: "references read it",
|
|
485
|
+
kms_unavailable: "KMS did not answer",
|
|
486
|
+
wrong_kek: "the vault's key is not the one that wrapped the data",
|
|
487
|
+
person_denied: "they said no",
|
|
488
|
+
too_many_connections: "too many connected apps",
|
|
489
|
+
unknown_connection: "no such connected app",
|
|
490
|
+
not_yours: "it was someone else's",
|
|
491
|
+
too_many_approvals: "too many changes waiting for approval",
|
|
492
|
+
request_state: "its retry did not match its call",
|
|
493
|
+
changed: "the change was not the one shown"
|
|
494
|
+
};
|
|
495
|
+
/** What a missing permission meant, from the app's `missing_<permission>`. */
|
|
496
|
+
var MISSING = {
|
|
497
|
+
secret_read: "no grant to read it",
|
|
498
|
+
secret_write: "no grant to write",
|
|
499
|
+
secret_archive: "no grant to archive",
|
|
500
|
+
audit_read: "no grant to read the audit log",
|
|
501
|
+
environment_manage: "no grant to manage environments",
|
|
502
|
+
grant_manage: "no grant to manage access",
|
|
503
|
+
project_manage: "no grant to manage the project"
|
|
504
|
+
};
|
|
505
|
+
function reasonInWords(reason) {
|
|
506
|
+
if (reason === null) return "refused";
|
|
507
|
+
if (reason.startsWith("missing_")) return MISSING[reason.slice(8)] ?? "no grant";
|
|
508
|
+
return REASONS[reason] ?? reason.replace(/_/g, " ");
|
|
509
|
+
}
|
|
510
|
+
/** In a batch of mixed actions, the one the line is named for: a write, not its reads. */
|
|
511
|
+
var LEAD = ["secret.write", "secret.read"];
|
|
512
|
+
function leadOf(batch) {
|
|
513
|
+
for (const action of LEAD) {
|
|
514
|
+
const found = batch.find((entry) => entry.action === action);
|
|
515
|
+
if (found !== void 0) return found;
|
|
516
|
+
}
|
|
517
|
+
return batch[0];
|
|
518
|
+
}
|
|
519
|
+
/** What a line says: one entry, or a batch that shares an operation. */
|
|
520
|
+
function describe(batch) {
|
|
521
|
+
const entry = leadOf(batch);
|
|
522
|
+
const same = batch.filter((other) => other.action === entry.action);
|
|
523
|
+
const denied = same.filter((other) => other.decision === "deny");
|
|
524
|
+
const refused = denied.length === same.length;
|
|
525
|
+
const facts = {
|
|
526
|
+
entry,
|
|
527
|
+
batch: same,
|
|
528
|
+
count: new Set(same.map((other) => `${other.project}/${other.environment}/${other.key}`)).size,
|
|
529
|
+
refused
|
|
530
|
+
};
|
|
531
|
+
const template = TEMPLATES[entry.action];
|
|
532
|
+
if (template === void 0) return {
|
|
533
|
+
parts: [
|
|
534
|
+
entry.action,
|
|
535
|
+
" ",
|
|
536
|
+
...place(entry)
|
|
537
|
+
],
|
|
538
|
+
refused
|
|
539
|
+
};
|
|
540
|
+
const say = (verb) => typeof verb === "string" ? verb : verb(facts);
|
|
541
|
+
const what = template.what(facts);
|
|
542
|
+
const gap = what.length === 0 ? [] : [" "];
|
|
543
|
+
if (refused) {
|
|
544
|
+
const reason = reasonInWords((denied[0] ?? entry).reason);
|
|
545
|
+
return {
|
|
546
|
+
parts: [
|
|
547
|
+
"tried to ",
|
|
548
|
+
say(template.tried),
|
|
549
|
+
...gap,
|
|
550
|
+
...what,
|
|
551
|
+
`: ${reason}`
|
|
552
|
+
],
|
|
553
|
+
refused
|
|
554
|
+
};
|
|
555
|
+
}
|
|
556
|
+
const partly = denied.length === 0 ? [] : [`, ${denied.length} refused: ${reasonInWords(denied[0].reason)}`];
|
|
557
|
+
return {
|
|
558
|
+
parts: [
|
|
559
|
+
say(template.did),
|
|
560
|
+
...gap,
|
|
561
|
+
...what,
|
|
562
|
+
...template.then?.(facts) ?? [],
|
|
563
|
+
...partly
|
|
564
|
+
],
|
|
565
|
+
refused
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
/** Who acted, as a part: a member links to their page; coffre itself is text. */
|
|
569
|
+
function who(entry) {
|
|
570
|
+
if (entry.actorType === "user") return { member: `user:${entry.actorId}` };
|
|
571
|
+
if (entry.actorType === "service") return { member: `token:${entry.actorId}` };
|
|
572
|
+
return SYSTEM[entry.actorId] ?? entry.actorId;
|
|
573
|
+
}
|
|
574
|
+
var SYSTEM = {
|
|
575
|
+
scheduler: "the scheduler",
|
|
576
|
+
cron: "the scheduler",
|
|
577
|
+
vault: "the vault",
|
|
578
|
+
app: "coffre"
|
|
579
|
+
};
|
|
580
|
+
/** Which components wrote the line, the vault first: "vault", "app", "vault, app". */
|
|
581
|
+
function decidedBy(batch) {
|
|
582
|
+
return ["vault", "app"].filter((author) => batch.some((entry) => entry.author === author)).join(", ");
|
|
583
|
+
}
|
|
584
|
+
/**
|
|
585
|
+
* Entries in the order the page shows them, newest first, each batch as one
|
|
586
|
+
* line at its newest entry. The server leaves detail out unless asked.
|
|
587
|
+
*/
|
|
588
|
+
function lines(entries) {
|
|
589
|
+
const shown = [];
|
|
590
|
+
const batches = /* @__PURE__ */ new Map();
|
|
591
|
+
for (const entry of entries) {
|
|
592
|
+
const batch = entry.operationId === null ? void 0 : batches.get(entry.operationId);
|
|
593
|
+
if (batch !== void 0) {
|
|
594
|
+
batch.push(entry);
|
|
595
|
+
continue;
|
|
596
|
+
}
|
|
597
|
+
const fresh = [entry];
|
|
598
|
+
if (entry.operationId !== null) batches.set(entry.operationId, fresh);
|
|
599
|
+
shown.push(fresh);
|
|
600
|
+
}
|
|
601
|
+
return shown;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* The CI run an entry was written for, as its issuer stated it at the
|
|
605
|
+
* exchange: `acme/api run 7001 at 3f2a9c1`, a GitLab pipeline, or the
|
|
606
|
+
* token's subject. Null for an entry no trust binding's credential wrote.
|
|
607
|
+
*/
|
|
608
|
+
function runLabel(run) {
|
|
609
|
+
if (run === null) return null;
|
|
610
|
+
const { claims } = run;
|
|
611
|
+
const text = (name) => typeof claims[name] === "string" || typeof claims[name] === "number" ? String(claims[name]) : null;
|
|
612
|
+
const at = text("sha") === null ? "" : ` at ${text("sha").slice(0, 7)}`;
|
|
613
|
+
if (text("repository") !== null && text("run_id") !== null) return `${text("repository")} run ${text("run_id")}${at}`;
|
|
614
|
+
if (text("project_path") !== null && text("pipeline_id") !== null) return `${text("project_path")} pipeline ${text("pipeline_id")}${at}`;
|
|
615
|
+
return text("sub") === null ? "a CI run" : `CI run ${text("sub")}`;
|
|
616
|
+
}
|
|
617
|
+
//#endregion
|
|
618
|
+
//#region src/components/audit-sentence.tsx
|
|
619
|
+
/** A sentence, its people and places links to their pages. */
|
|
620
|
+
function Sentence({ parts }) {
|
|
621
|
+
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)) });
|
|
622
|
+
}
|
|
623
|
+
function PlaceLink({ path }) {
|
|
624
|
+
const [project, environment] = path.split("/");
|
|
625
|
+
const text = /* @__PURE__ */ jsx("span", {
|
|
626
|
+
className: "mono",
|
|
627
|
+
children: breakAfterUnderscores(path)
|
|
628
|
+
});
|
|
629
|
+
return environment === void 0 ? /* @__PURE__ */ jsx(Link, {
|
|
630
|
+
to: "/projects/$project",
|
|
631
|
+
params: { project },
|
|
632
|
+
children: text
|
|
633
|
+
}) : /* @__PURE__ */ jsx(Link, {
|
|
634
|
+
to: "/projects/$project/$environment",
|
|
635
|
+
params: {
|
|
636
|
+
project,
|
|
637
|
+
environment
|
|
638
|
+
},
|
|
639
|
+
children: text
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
/** A member from the log, which keeps `token:<name>`, shown as people read it: `service:<name>`, to its page. */
|
|
643
|
+
function MemberLink({ member }) {
|
|
644
|
+
return member.startsWith("token:") ? /* @__PURE__ */ jsx(Link, {
|
|
645
|
+
to: "/service-accounts/$account",
|
|
646
|
+
params: { account: serviceName(member) },
|
|
647
|
+
children: shownMember(member)
|
|
648
|
+
}) : /* @__PURE__ */ jsx(Link, {
|
|
649
|
+
to: "/users/$user",
|
|
650
|
+
params: { user: memberName(member) },
|
|
651
|
+
children: memberName(member)
|
|
652
|
+
});
|
|
653
|
+
}
|
|
654
|
+
function memberName(member) {
|
|
655
|
+
return member.startsWith("user:") ? member.slice(5) : shownMember(member);
|
|
656
|
+
}
|
|
657
|
+
//#endregion
|
|
658
|
+
export { lines as a, describe as i, memberName as n, runLabel as o, decidedBy as r, who as s, Sentence as t };
|
|
659
|
+
|
|
660
|
+
//# sourceMappingURL=audit-sentence-BhHmvQX_.js.map
|