@coffre/ui 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +8 -2
- package/dist/client/.assetsignore +2 -0
- package/dist/client/_coffre/assets/account-C3Zo1l5A.js +1 -0
- package/dist/client/_coffre/assets/account-C4bNbeO7.js +2 -0
- package/dist/client/_coffre/assets/affordances-DiuJIiR2.js +1 -0
- package/dist/client/_coffre/assets/audit-1xLyuxGz.js +2 -0
- package/dist/client/_coffre/assets/audit-Dab2GuRj.js +1 -0
- package/dist/client/_coffre/assets/auth.device-BfCfeBWe.js +2 -0
- package/dist/client/_coffre/assets/auth.device-D2pCLF-X.js +1 -0
- package/dist/client/_coffre/assets/coffre-C7qL3HGR.js +1 -0
- package/dist/client/_coffre/assets/directory-C2Ou4SQv.js +1 -0
- package/dist/client/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
- package/dist/client/_coffre/assets/grants-fqTtJ-aW.js +1 -0
- package/dist/client/_coffre/assets/index-BpGwbjmM.js +12 -0
- package/dist/client/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/client/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/client/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/client/_coffre/assets/login-CR9CBXlw.js +2 -0
- package/dist/client/_coffre/assets/login-DZizFxa4.js +1 -0
- package/dist/client/_coffre/assets/offboarding-DOLJQcXU.js +1 -0
- package/dist/client/_coffre/assets/page-BxW2MwaX.js +1 -0
- package/dist/client/_coffre/assets/preload-helper-BHuP8_FL.js +46 -0
- package/dist/client/_coffre/assets/principal-page-xnBZVURr.js +1 -0
- package/dist/client/_coffre/assets/project-environments-CfIH5kFM.js +1 -0
- package/dist/client/_coffre/assets/projects._project._environment-CrWjQmIA.js +2 -0
- package/dist/client/_coffre/assets/projects._project._environment-CwRVG9Ne.js +3 -0
- package/dist/client/_coffre/assets/projects._project.index-CCDEuE-z.js +2 -0
- package/dist/client/_coffre/assets/projects._project.index-DCJsmnD7.js +1 -0
- package/dist/client/_coffre/assets/projects.index-B8eV8JIn.js +1 -0
- package/dist/client/_coffre/assets/projects.index-BNEC7Oz8.js +2 -0
- package/dist/client/_coffre/assets/settings-2BPsenNM.js +2 -0
- package/dist/client/_coffre/assets/settings-BrS0-wEt.js +1 -0
- package/dist/client/_coffre/assets/signin-errors-CroZWZgm.js +1 -0
- package/dist/client/_coffre/assets/tokens._token-B3-YwuKp.js +2 -0
- package/dist/client/_coffre/assets/tokens._token-D_hsbHx6.js +1 -0
- package/dist/client/_coffre/assets/tokens.index-BdKE2Jv8.js +2 -0
- package/dist/client/_coffre/assets/tokens.index-XvA4XRxh.js +1 -0
- package/dist/client/_coffre/assets/unregistered-CTRMtBIy.js +1 -0
- package/dist/client/_coffre/assets/use-action-DgAf-tiX.js +1 -0
- package/dist/client/_coffre/assets/users._user-BFPXcJ4y.js +2 -0
- package/dist/client/_coffre/assets/users._user-DEtMeSoh.js +1 -0
- package/dist/client/_coffre/assets/users.index-B03beUHq.js +1 -0
- package/dist/client/_coffre/assets/users.index-D8hwzM6P.js +2 -0
- package/dist/client/_coffre/assets/validation-9Cl_XS-l.js +1 -0
- package/dist/index.d.ts +19 -0
- package/dist/server/.vite/manifest.json +572 -0
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-B6CZDfrB.js +133 -0
- package/dist/server/_coffre/assets/account-B71_b5xc.js +296 -0
- package/dist/server/_coffre/assets/account-BoO6ZqMc.js +176 -0
- package/dist/server/_coffre/assets/affordances-BNaXjMOb.js +46 -0
- package/dist/server/_coffre/assets/async-local-storage-C0cwgkEr.js +3107 -0
- package/dist/server/_coffre/assets/audit-CwRFnSAY.js +74 -0
- package/dist/server/_coffre/assets/audit-t1sYjtrf.js +964 -0
- package/dist/server/_coffre/assets/auth.device-1IcJ475s.js +208 -0
- package/dist/server/_coffre/assets/auth.device-CJwZYYtn.js +29 -0
- package/dist/server/_coffre/assets/coffre-1hxT2E_U.js +278 -0
- package/dist/server/_coffre/assets/directory-wm_JQUfk.js +396 -0
- package/dist/server/_coffre/assets/empty-plugin-adapters-Cq4--YW-.js +5 -0
- package/dist/server/_coffre/assets/globals-Dgq4Jy0x.css +1 -0
- package/dist/server/_coffre/assets/grants-BmhEY1vz.js +243 -0
- package/dist/server/_coffre/assets/inter-cyrillic-ext-opsz-normal-CfYZpDVp.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-cyrillic-opsz-normal-BFQXbQ-f.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-greek-ext-opsz-normal-BmPQvyvo.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-greek-opsz-normal-BM0NlUE_.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-latin-ext-opsz-normal-DpK-iCPk.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-latin-opsz-normal-BwkfbSeq.woff2 +0 -0
- package/dist/server/_coffre/assets/inter-vietnamese-opsz-normal-Ci9T9ieq.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-ext-wght-normal-EocZY2iu.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-cyrillic-wght-normal-D73BlboJ.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-greek-wght-normal-Bw9x6K1M.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-latin-ext-wght-normal-DBQx-q_a.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-latin-wght-normal-B9CIFXIH.woff2 +0 -0
- package/dist/server/_coffre/assets/jetbrains-mono-vietnamese-wght-normal-Bt-aOZkq.woff2 +0 -0
- package/dist/server/_coffre/assets/login-B5O5LPXV.js +100 -0
- package/dist/server/_coffre/assets/login-Bvc4gp0X.js +22 -0
- package/dist/server/_coffre/assets/offboarding-CvSilnSm.js +330 -0
- package/dist/server/_coffre/assets/page-BjXk0Ehu.js +2003 -0
- package/dist/server/_coffre/assets/principal-page-DkwNGzM2.js +617 -0
- package/dist/server/_coffre/assets/project-environments-lEzFHUt4.js +9 -0
- package/dist/server/_coffre/assets/projects._project._environment-7grhqlgq.js +2227 -0
- package/dist/server/_coffre/assets/projects._project._environment-ByEf6pmz.js +55 -0
- package/dist/server/_coffre/assets/projects._project.index-B1bjowP-.js +932 -0
- package/dist/server/_coffre/assets/projects._project.index-DU8wtoHD.js +22 -0
- package/dist/server/_coffre/assets/projects.index-B0DoHbCz.js +280 -0
- package/dist/server/_coffre/assets/projects.index-kMDA6pMy.js +54 -0
- package/dist/server/_coffre/assets/react-dom-qCTiwGGR.js +1352 -0
- package/dist/server/_coffre/assets/router-ChU_CwCX.js +2028 -0
- package/dist/server/_coffre/assets/settings-CM9-h7in.js +18 -0
- package/dist/server/_coffre/assets/settings-Cg5qOGij.js +60 -0
- package/dist/server/_coffre/assets/signin-errors-BEFlVDbQ.js +28 -0
- package/dist/server/_coffre/assets/start-DR3rN0St.js +4 -0
- package/dist/server/_coffre/assets/tokens._token-CCpaPMAk.js +268 -0
- package/dist/server/_coffre/assets/tokens._token-Di4OZdAA.js +18 -0
- package/dist/server/_coffre/assets/tokens.index-Do3OHR31.js +34 -0
- package/dist/server/_coffre/assets/tokens.index-tDKq4AFh.js +10 -0
- package/dist/server/_coffre/assets/ui-BNzhIAQP.js +15710 -0
- package/dist/server/_coffre/assets/unregistered-BqaWYFJK.js +51 -0
- package/dist/server/_coffre/assets/use-action-BkJXC5JM.js +953 -0
- package/dist/server/_coffre/assets/useStore-DWGPqzXR.js +892 -0
- package/dist/server/_coffre/assets/users._user-BenYva93.js +15 -0
- package/dist/server/_coffre/assets/users._user-Cp039Va-.js +10 -0
- package/dist/server/_coffre/assets/users.index-BrzG1Ecq.js +10 -0
- package/dist/server/_coffre/assets/users.index-DQ_45DQl.js +34 -0
- package/dist/server/_coffre/assets/validation-BQtqPe2V.js +27 -0
- package/dist/server/index.js +13910 -0
- package/package.json +58 -3
- package/src/components/affordances.ts +80 -0
- package/src/components/agentation.tsx +34 -0
- package/src/components/command-palette.tsx +271 -0
- package/src/components/directory.tsx +448 -0
- package/src/components/grants.tsx +204 -0
- package/src/components/icons.tsx +283 -0
- package/src/components/offboarding.tsx +286 -0
- package/src/components/page.tsx +128 -0
- package/src/components/principal-page.tsx +549 -0
- package/src/components/principal-picker.tsx +168 -0
- package/src/components/principal.tsx +53 -0
- package/src/components/route-states.tsx +60 -0
- package/src/components/service-tokens.tsx +212 -0
- package/src/components/shell.tsx +641 -0
- package/src/components/syncs.tsx +581 -0
- package/src/components/theme.tsx +141 -0
- package/src/components/tile.tsx +22 -0
- package/src/components/ui.tsx +440 -0
- package/src/entry.ts +19 -0
- package/src/lib/access-plan.ts +201 -0
- package/src/lib/audit-sentences.ts +468 -0
- package/src/lib/capabilities.ts +45 -0
- package/src/lib/coffre.ts +57 -0
- package/src/lib/project-access.ts +95 -0
- package/src/lib/project-environments.ts +23 -0
- package/src/lib/reveal.ts +21 -0
- package/src/lib/secret-edit-batch.ts +181 -0
- package/src/lib/signin-errors.ts +33 -0
- package/src/lib/use-action.ts +50 -0
- package/src/lib/validation.ts +27 -0
- package/src/routeTree.gen.ts +367 -0
- package/src/router.tsx +84 -0
- package/src/routes/__root.tsx +192 -0
- package/src/routes/access.tsx +11 -0
- package/src/routes/account.tsx +359 -0
- package/src/routes/audit.tsx +545 -0
- package/src/routes/auth.device.tsx +200 -0
- package/src/routes/index.tsx +15 -0
- package/src/routes/login.tsx +129 -0
- package/src/routes/projects.$project.$environment.tsx +1659 -0
- package/src/routes/projects.$project.index.tsx +917 -0
- package/src/routes/projects.index.tsx +353 -0
- package/src/routes/settings.tsx +72 -0
- package/src/routes/tokens.$token.tsx +35 -0
- package/src/routes/tokens.index.tsx +37 -0
- package/src/routes/unregistered.tsx +59 -0
- package/src/routes/users.$user.tsx +13 -0
- package/src/routes/users.index.tsx +37 -0
- package/src/shared/models.ts +55 -0
- package/src/styles/globals.css +4118 -0
- package/src/types.ts +21 -0
|
@@ -0,0 +1,964 @@
|
|
|
1
|
+
import { C as require_react, E as __toESM, o as require_jsx_runtime } from "./useStore-DWGPqzXR.js";
|
|
2
|
+
import { E as Link, d as Toggletip, i as EmptyState, l as Timestamp, p as breakAfterUnderscores, s as Notice } from "./ui-BNzhIAQP.js";
|
|
3
|
+
import { G as SlashCircle, S as Info, T as Ledger, U as ShieldCheck, Z as User, c as AlertTriangle, et as X, f as ChevronRight, i as PageHeader, m as Clock, n as ClosedDoor, o as Activity } from "./page-BjXk0Ehu.js";
|
|
4
|
+
import { t as Route } from "./audit-CwRFnSAY.js";
|
|
5
|
+
//#region src/lib/audit-sentences.ts
|
|
6
|
+
var import_react = /* @__PURE__ */ __toESM(require_react());
|
|
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
|
+
function plural(count, one, many = `${one}s`) {
|
|
33
|
+
return `${count} ${count === 1 ? one : many}`;
|
|
34
|
+
}
|
|
35
|
+
/** A batch reads as its environment and a count; one entry as its secret. */
|
|
36
|
+
function secrets(facts) {
|
|
37
|
+
if (facts.batch.length === 1) return place(facts.entry);
|
|
38
|
+
return [
|
|
39
|
+
...environmentOf(facts.entry),
|
|
40
|
+
facts.refused ? ", " : ": ",
|
|
41
|
+
plural(facts.count, "secret")
|
|
42
|
+
];
|
|
43
|
+
}
|
|
44
|
+
/** " to acme/market", when the entry names where a sync pushes. */
|
|
45
|
+
function toDestination(entry) {
|
|
46
|
+
const where = text(entry.metadata.destination);
|
|
47
|
+
return where === null ? "" : ` to ${where}`;
|
|
48
|
+
}
|
|
49
|
+
function destination(entry) {
|
|
50
|
+
return text(entry.metadata.destination) ?? "its destination";
|
|
51
|
+
}
|
|
52
|
+
var READ_VERBS = {
|
|
53
|
+
reveal: ["revealed", "reveal"],
|
|
54
|
+
run: ["ran", "run"],
|
|
55
|
+
compare: ["compared", "compare"],
|
|
56
|
+
sync: ["read", "read"]
|
|
57
|
+
};
|
|
58
|
+
function readVerb({ entry }) {
|
|
59
|
+
return READ_VERBS[text(entry.metadata.purpose) ?? "reveal"] ?? READ_VERBS.reveal;
|
|
60
|
+
}
|
|
61
|
+
var placeTemplates = (kind) => {
|
|
62
|
+
const what = (facts) => [`${kind} `, ...kind === "project" ? place({
|
|
63
|
+
...facts.entry,
|
|
64
|
+
environment: null,
|
|
65
|
+
key: null
|
|
66
|
+
}) : environmentOf(facts.entry)];
|
|
67
|
+
return {
|
|
68
|
+
[`${kind}.create`]: {
|
|
69
|
+
did: "created",
|
|
70
|
+
tried: "create",
|
|
71
|
+
what
|
|
72
|
+
},
|
|
73
|
+
[`${kind}.update`]: {
|
|
74
|
+
did: "changed",
|
|
75
|
+
tried: "change",
|
|
76
|
+
what
|
|
77
|
+
},
|
|
78
|
+
[`${kind}.archive`]: {
|
|
79
|
+
did: "archived",
|
|
80
|
+
tried: "archive",
|
|
81
|
+
what
|
|
82
|
+
},
|
|
83
|
+
[`${kind}.restore`]: {
|
|
84
|
+
did: "restored",
|
|
85
|
+
tried: "restore",
|
|
86
|
+
what
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
var TEMPLATES = {
|
|
91
|
+
"secret.read": {
|
|
92
|
+
did: (facts) => readVerb(facts)[0],
|
|
93
|
+
tried: (facts) => readVerb(facts)[1],
|
|
94
|
+
what: secrets
|
|
95
|
+
},
|
|
96
|
+
"secret.write": {
|
|
97
|
+
did: ({ batch }) => {
|
|
98
|
+
const firsts = batch.filter((entry) => entry.version === 1).length;
|
|
99
|
+
return firsts === batch.length ? "added" : firsts === 0 ? "changed" : "wrote";
|
|
100
|
+
},
|
|
101
|
+
tried: "change",
|
|
102
|
+
what: secrets,
|
|
103
|
+
then: ({ entry, batch }) => batch.length > 1 || entry.version === null || entry.version === 1 ? [] : [`, now version ${entry.version}`]
|
|
104
|
+
},
|
|
105
|
+
"secret.restore": {
|
|
106
|
+
did: "restored",
|
|
107
|
+
tried: "restore",
|
|
108
|
+
what: ({ entry }) => [...place(entry), ...number(entry.metadata.from) === null ? [] : [` to version ${number(entry.metadata.from)}`]],
|
|
109
|
+
then: ({ entry }) => entry.version === null ? [] : [`, now ${entry.version}`]
|
|
110
|
+
},
|
|
111
|
+
"secret.rename": {
|
|
112
|
+
did: "renamed",
|
|
113
|
+
tried: "rename",
|
|
114
|
+
what: ({ entry }) => [...place(entry), ...text(entry.metadata.nextKey) === null ? [] : [` to ${text(entry.metadata.nextKey)}`]]
|
|
115
|
+
},
|
|
116
|
+
"secret.archive": {
|
|
117
|
+
did: "archived",
|
|
118
|
+
tried: "archive",
|
|
119
|
+
what: (facts) => place(facts.entry)
|
|
120
|
+
},
|
|
121
|
+
"secret.unarchive": {
|
|
122
|
+
did: "brought back",
|
|
123
|
+
tried: "bring back",
|
|
124
|
+
what: (facts) => place(facts.entry)
|
|
125
|
+
},
|
|
126
|
+
...placeTemplates("project"),
|
|
127
|
+
...placeTemplates("environment"),
|
|
128
|
+
"access.grant": {
|
|
129
|
+
did: "gave",
|
|
130
|
+
tried: "give",
|
|
131
|
+
what: ({ entry }) => [
|
|
132
|
+
...subject(entry),
|
|
133
|
+
` ${text(entry.metadata.role) ?? "a role"} on `,
|
|
134
|
+
...placeOnly(entry)
|
|
135
|
+
],
|
|
136
|
+
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)}`]]
|
|
137
|
+
},
|
|
138
|
+
"access.revoke": {
|
|
139
|
+
did: "took",
|
|
140
|
+
tried: "take",
|
|
141
|
+
what: ({ entry }) => [
|
|
142
|
+
...text(entry.metadata.previousRole ?? entry.metadata.role) === null ? ["access to "] : [`${text(entry.metadata.previousRole ?? entry.metadata.role)} on `],
|
|
143
|
+
...placeOnly(entry),
|
|
144
|
+
" from ",
|
|
145
|
+
...subject(entry)
|
|
146
|
+
]
|
|
147
|
+
},
|
|
148
|
+
"member.add": {
|
|
149
|
+
did: "added",
|
|
150
|
+
tried: "add",
|
|
151
|
+
what: ({ entry }) => [...subject(entry), ...entry.metadata.rootAdmin === true ? [" as a root admin"] : entry.metadata.owner === true ? [" as an owner"] : []]
|
|
152
|
+
},
|
|
153
|
+
"member.remove": {
|
|
154
|
+
did: "removed",
|
|
155
|
+
tried: "remove",
|
|
156
|
+
what: (facts) => subject(facts.entry),
|
|
157
|
+
then: ({ entry }) => number(entry.metadata.revoked) === null ? [] : [`, who held ${plural(number(entry.metadata.revoked), "grant")}`]
|
|
158
|
+
},
|
|
159
|
+
"member.restore": {
|
|
160
|
+
did: "brought back",
|
|
161
|
+
tried: "bring back",
|
|
162
|
+
what: (facts) => subject(facts.entry)
|
|
163
|
+
},
|
|
164
|
+
"member.owner": {
|
|
165
|
+
did: ({ entry }) => entry.metadata.owner === false ? "took owner from" : "made",
|
|
166
|
+
tried: ({ entry }) => entry.metadata.owner === false ? "take owner from" : "make",
|
|
167
|
+
what: ({ entry }) => [...subject(entry), ...entry.metadata.owner === false ? [] : [" an owner"]]
|
|
168
|
+
},
|
|
169
|
+
"sync.create": {
|
|
170
|
+
did: "set up a sync of",
|
|
171
|
+
tried: "set up a sync of",
|
|
172
|
+
what: ({ entry }) => [...environmentOf(entry), toDestination(entry)]
|
|
173
|
+
},
|
|
174
|
+
"sync.update": {
|
|
175
|
+
did: ({ entry }) => entry.metadata.paused === true ? "paused the sync of" : entry.metadata.paused === false ? "resumed the sync of" : "changed the sync of",
|
|
176
|
+
tried: "change the sync of",
|
|
177
|
+
what: ({ entry }) => [...environmentOf(entry), toDestination(entry)]
|
|
178
|
+
},
|
|
179
|
+
"sync.delete": {
|
|
180
|
+
did: "removed the sync of",
|
|
181
|
+
tried: "remove the sync of",
|
|
182
|
+
what: ({ entry }) => [...environmentOf(entry), toDestination(entry)]
|
|
183
|
+
},
|
|
184
|
+
"sync.push": {
|
|
185
|
+
did: "pushed",
|
|
186
|
+
tried: "push",
|
|
187
|
+
what: (facts) => facts.batch.length === 1 ? [...place(facts.entry), ` to ${destination(facts.entry)}`] : [...environmentOf(facts.entry), ` to ${destination(facts.entry)}: ${plural(facts.count, "secret")}`]
|
|
188
|
+
},
|
|
189
|
+
"sync.remove": {
|
|
190
|
+
did: "removed",
|
|
191
|
+
tried: "remove",
|
|
192
|
+
what: (facts) => facts.batch.length === 1 ? [...place(facts.entry), ` from ${destination(facts.entry)}`] : [
|
|
193
|
+
plural(facts.count, "secret"),
|
|
194
|
+
" of ",
|
|
195
|
+
...environmentOf(facts.entry),
|
|
196
|
+
` from ${destination(facts.entry)}`
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
"vault.tampered": {
|
|
200
|
+
did: "found",
|
|
201
|
+
tried: "check",
|
|
202
|
+
what: ({ entry }) => [...entry.subject === null ? ["an entry"] : [...subject(entry), "'s record"], ` tampered with: ${TAMPERING[entry.reason ?? ""] ?? "it fails its seal"}`]
|
|
203
|
+
},
|
|
204
|
+
sign_in: {
|
|
205
|
+
did: ({ entry }) => entry.metadata.kind === "cli" ? "signed in to the CLI" : "signed in",
|
|
206
|
+
tried: "sign in",
|
|
207
|
+
what: ({ entry }) => text(entry.metadata.provider) === null ? [] : [`with ${text(entry.metadata.provider)}`]
|
|
208
|
+
},
|
|
209
|
+
sign_out: {
|
|
210
|
+
did: "signed out",
|
|
211
|
+
tried: "sign out",
|
|
212
|
+
what: () => []
|
|
213
|
+
},
|
|
214
|
+
"token.create": {
|
|
215
|
+
did: "issued a token to",
|
|
216
|
+
tried: "issue a token to",
|
|
217
|
+
what: (facts) => subject(facts.entry)
|
|
218
|
+
},
|
|
219
|
+
"token.revoke": {
|
|
220
|
+
did: "revoked a token of",
|
|
221
|
+
tried: "revoke a token of",
|
|
222
|
+
what: (facts) => subject(facts.entry)
|
|
223
|
+
},
|
|
224
|
+
"device.approve": {
|
|
225
|
+
did: "approved a CLI sign-in",
|
|
226
|
+
tried: "approve a CLI sign-in",
|
|
227
|
+
what: () => []
|
|
228
|
+
},
|
|
229
|
+
"device.deny": {
|
|
230
|
+
did: "turned down a CLI sign-in",
|
|
231
|
+
tried: "turn down a CLI sign-in",
|
|
232
|
+
what: () => []
|
|
233
|
+
},
|
|
234
|
+
"account.link": {
|
|
235
|
+
did: "linked",
|
|
236
|
+
tried: "link",
|
|
237
|
+
what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? "sign-in"} account`]
|
|
238
|
+
},
|
|
239
|
+
"account.unlink": {
|
|
240
|
+
did: "unlinked",
|
|
241
|
+
tried: "unlink",
|
|
242
|
+
what: ({ entry }) => [`a ${text(entry.metadata.provider) ?? "sign-in"} account`]
|
|
243
|
+
},
|
|
244
|
+
"key.wrap": {
|
|
245
|
+
did: "sealed the key of",
|
|
246
|
+
tried: "seal the key of",
|
|
247
|
+
what: (facts) => versioned(facts.entry)
|
|
248
|
+
},
|
|
249
|
+
"key.rewrap": {
|
|
250
|
+
did: "resealed the key of",
|
|
251
|
+
tried: "reseal the key of",
|
|
252
|
+
what: (facts) => versioned(facts.entry)
|
|
253
|
+
},
|
|
254
|
+
"key.intent": {
|
|
255
|
+
did: "asked KMS about",
|
|
256
|
+
tried: "ask KMS about",
|
|
257
|
+
what: (facts) => secrets(facts)
|
|
258
|
+
},
|
|
259
|
+
"key.check": {
|
|
260
|
+
did: "recorded the check value of",
|
|
261
|
+
tried: "check",
|
|
262
|
+
what: ({ entry }) => [[
|
|
263
|
+
"the",
|
|
264
|
+
text(entry.metadata.kekProvider),
|
|
265
|
+
"KEK",
|
|
266
|
+
text(entry.metadata.kekId)
|
|
267
|
+
].filter((word) => word !== null).join(" ")]
|
|
268
|
+
},
|
|
269
|
+
"sync.run": {
|
|
270
|
+
did: "ran the sync of",
|
|
271
|
+
tried: "run the sync of",
|
|
272
|
+
what: ({ entry }) => [...environmentOf(entry), toDestination(entry)]
|
|
273
|
+
},
|
|
274
|
+
"audit.heartbeat": {
|
|
275
|
+
did: "checked in",
|
|
276
|
+
tried: "check in",
|
|
277
|
+
what: () => []
|
|
278
|
+
},
|
|
279
|
+
"audit.checkpoint": {
|
|
280
|
+
did: "signed the log",
|
|
281
|
+
tried: "sign the log",
|
|
282
|
+
what: ({ entry }) => number(entry.metadata.seq) === null ? [] : [`through entry ${number(entry.metadata.seq)}`]
|
|
283
|
+
},
|
|
284
|
+
"secret.list": {
|
|
285
|
+
did: "listed",
|
|
286
|
+
tried: "list",
|
|
287
|
+
what: ({ entry }) => environmentOf(entry)
|
|
288
|
+
},
|
|
289
|
+
"secret.history": {
|
|
290
|
+
did: "read the history of",
|
|
291
|
+
tried: "read the history of",
|
|
292
|
+
what: (facts) => place(facts.entry)
|
|
293
|
+
},
|
|
294
|
+
"secret.update": {
|
|
295
|
+
did: "changed",
|
|
296
|
+
tried: "change",
|
|
297
|
+
what: (facts) => place(facts.entry)
|
|
298
|
+
},
|
|
299
|
+
"sync.list": {
|
|
300
|
+
did: "listed the syncs of",
|
|
301
|
+
tried: "list the syncs of",
|
|
302
|
+
what: ({ entry }) => environmentOf(entry)
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
function placeOnly(entry) {
|
|
306
|
+
return place({
|
|
307
|
+
...entry,
|
|
308
|
+
key: null
|
|
309
|
+
});
|
|
310
|
+
}
|
|
311
|
+
function versioned(entry) {
|
|
312
|
+
return [...place(entry), ...entry.version === null ? [] : [`, version ${entry.version}`]];
|
|
313
|
+
}
|
|
314
|
+
var TAMPERING = {
|
|
315
|
+
mac: "it does not carry the vault's seal",
|
|
316
|
+
stale: "an older copy was put back",
|
|
317
|
+
forged_entry: "the vault did not write it"
|
|
318
|
+
};
|
|
319
|
+
/** Why something was refused, in words. Codes from the vault and the app. */
|
|
320
|
+
var REASONS = {
|
|
321
|
+
no_grant: "no grant",
|
|
322
|
+
bulk_limit: "bulk limit",
|
|
323
|
+
expired: "grant expired",
|
|
324
|
+
removed: "removed from coffre",
|
|
325
|
+
not_a_member: "not a member",
|
|
326
|
+
not_registered: "not invited",
|
|
327
|
+
tampered: "their record was tampered with",
|
|
328
|
+
bad_claim: "the key did not match the secret",
|
|
329
|
+
not_allowed: "not allowed",
|
|
330
|
+
root_admin: "root admins are set by the deployment",
|
|
331
|
+
unknown_environment: "no such environment",
|
|
332
|
+
unknown_secret: "no such secret",
|
|
333
|
+
unknown_project: "no such project",
|
|
334
|
+
unusable_credential: "its token is not a secret they can read",
|
|
335
|
+
duplicate_destination: "already synced from elsewhere",
|
|
336
|
+
cannot_grant_sync: "cannot grant the sync its reads",
|
|
337
|
+
kms_unavailable: "KMS did not answer",
|
|
338
|
+
wrong_kek: "the vault's KEK is not the one that wrapped the data"
|
|
339
|
+
};
|
|
340
|
+
/** What a missing permission meant, from the app's `missing_<permission>`. */
|
|
341
|
+
var MISSING = {
|
|
342
|
+
secret_read: "no grant to read it",
|
|
343
|
+
secret_write: "no grant to write",
|
|
344
|
+
secret_archive: "no grant to archive",
|
|
345
|
+
audit_read: "no grant to read the audit log",
|
|
346
|
+
environment_manage: "no grant to manage environments",
|
|
347
|
+
grant_manage: "no grant to manage access",
|
|
348
|
+
project_manage: "no grant to manage the project"
|
|
349
|
+
};
|
|
350
|
+
function reasonInWords(reason) {
|
|
351
|
+
if (reason === null) return "refused";
|
|
352
|
+
if (reason.startsWith("missing_")) return MISSING[reason.slice(8)] ?? "no grant";
|
|
353
|
+
return REASONS[reason] ?? reason.replace(/_/g, " ");
|
|
354
|
+
}
|
|
355
|
+
/** In a batch of mixed actions, the one the line is named for: a sync's push, not its reads. */
|
|
356
|
+
var LEAD = [
|
|
357
|
+
"sync.push",
|
|
358
|
+
"sync.remove",
|
|
359
|
+
"secret.write",
|
|
360
|
+
"secret.read"
|
|
361
|
+
];
|
|
362
|
+
function leadOf(batch) {
|
|
363
|
+
for (const action of LEAD) {
|
|
364
|
+
const found = batch.find((entry) => entry.action === action);
|
|
365
|
+
if (found !== void 0) return found;
|
|
366
|
+
}
|
|
367
|
+
return batch[0];
|
|
368
|
+
}
|
|
369
|
+
/** What a line says: one entry, or a batch that shares an operation. */
|
|
370
|
+
function describe(batch) {
|
|
371
|
+
const entry = leadOf(batch);
|
|
372
|
+
const same = batch.filter((other) => other.action === entry.action);
|
|
373
|
+
const denied = same.filter((other) => other.decision === "deny");
|
|
374
|
+
const refused = denied.length === same.length;
|
|
375
|
+
const facts = {
|
|
376
|
+
entry,
|
|
377
|
+
batch: same,
|
|
378
|
+
count: new Set(same.map((other) => `${other.project}/${other.environment}/${other.key}`)).size,
|
|
379
|
+
refused
|
|
380
|
+
};
|
|
381
|
+
const template = TEMPLATES[entry.action];
|
|
382
|
+
if (template === void 0) return {
|
|
383
|
+
parts: [
|
|
384
|
+
entry.action,
|
|
385
|
+
" ",
|
|
386
|
+
...place(entry)
|
|
387
|
+
],
|
|
388
|
+
refused
|
|
389
|
+
};
|
|
390
|
+
const say = (verb) => typeof verb === "string" ? verb : verb(facts);
|
|
391
|
+
const what = template.what(facts);
|
|
392
|
+
const gap = what.length === 0 ? [] : [" "];
|
|
393
|
+
if (refused) {
|
|
394
|
+
const reason = reasonInWords((denied[0] ?? entry).reason);
|
|
395
|
+
return {
|
|
396
|
+
parts: [
|
|
397
|
+
"tried to ",
|
|
398
|
+
say(template.tried),
|
|
399
|
+
...gap,
|
|
400
|
+
...what,
|
|
401
|
+
`: ${reason}`
|
|
402
|
+
],
|
|
403
|
+
refused
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
const partly = denied.length === 0 ? [] : [`, ${denied.length} refused: ${reasonInWords(denied[0].reason)}`];
|
|
407
|
+
return {
|
|
408
|
+
parts: [
|
|
409
|
+
say(template.did),
|
|
410
|
+
...gap,
|
|
411
|
+
...what,
|
|
412
|
+
...template.then?.(facts) ?? [],
|
|
413
|
+
...partly
|
|
414
|
+
],
|
|
415
|
+
refused
|
|
416
|
+
};
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Who acted, as a part: a member links to their page; a sync or coffre
|
|
420
|
+
* itself is text. A sync is named for where it pushes, which any entry of
|
|
421
|
+
* its batch may say.
|
|
422
|
+
*/
|
|
423
|
+
function who(batch) {
|
|
424
|
+
const entry = batch[0];
|
|
425
|
+
if (entry.actorType === "user") return { member: `user:${entry.actorId}` };
|
|
426
|
+
if (entry.actorType === "service") return { member: `token:${entry.actorId}` };
|
|
427
|
+
if (entry.actorId.startsWith("sync:")) {
|
|
428
|
+
const id = batch.map((other) => text(other.metadata.provider)).find((provider) => provider !== null);
|
|
429
|
+
const provider = id === void 0 ? void 0 : PROVIDERS[id] ?? id;
|
|
430
|
+
return provider === void 0 ? "a sync" : `sync to ${provider}`;
|
|
431
|
+
}
|
|
432
|
+
return SYSTEM[entry.actorId] ?? entry.actorId;
|
|
433
|
+
}
|
|
434
|
+
var PROVIDERS = {
|
|
435
|
+
"github-actions": "GitHub",
|
|
436
|
+
vercel: "Vercel",
|
|
437
|
+
railway: "Railway",
|
|
438
|
+
"cloudflare-workers": "Cloudflare"
|
|
439
|
+
};
|
|
440
|
+
var SYSTEM = {
|
|
441
|
+
scheduler: "the scheduler",
|
|
442
|
+
cron: "the scheduler",
|
|
443
|
+
vault: "the vault",
|
|
444
|
+
app: "coffre"
|
|
445
|
+
};
|
|
446
|
+
/** Which components wrote the line, the vault first: "vault", "app", "vault, app". */
|
|
447
|
+
function decidedBy(batch) {
|
|
448
|
+
return ["vault", "app"].filter((author) => batch.some((entry) => entry.author === author)).join(", ");
|
|
449
|
+
}
|
|
450
|
+
/**
|
|
451
|
+
* Entries in the order the page shows them, newest first, each batch as one
|
|
452
|
+
* line at its newest entry. The server leaves detail out unless asked.
|
|
453
|
+
*/
|
|
454
|
+
function lines(entries) {
|
|
455
|
+
const shown = [];
|
|
456
|
+
const batches = /* @__PURE__ */ new Map();
|
|
457
|
+
for (const entry of entries) {
|
|
458
|
+
const batch = entry.operationId === null ? void 0 : batches.get(entry.operationId);
|
|
459
|
+
if (batch !== void 0) {
|
|
460
|
+
batch.push(entry);
|
|
461
|
+
continue;
|
|
462
|
+
}
|
|
463
|
+
const fresh = [entry];
|
|
464
|
+
if (entry.operationId !== null) batches.set(entry.operationId, fresh);
|
|
465
|
+
shown.push(fresh);
|
|
466
|
+
}
|
|
467
|
+
return shown;
|
|
468
|
+
}
|
|
469
|
+
/** What a kind of hidden entry is called, by action or its prefix. */
|
|
470
|
+
var HIDDEN_KINDS = [
|
|
471
|
+
[
|
|
472
|
+
"key.",
|
|
473
|
+
"key operation",
|
|
474
|
+
"key operations"
|
|
475
|
+
],
|
|
476
|
+
[
|
|
477
|
+
"sign_in",
|
|
478
|
+
"sign-in",
|
|
479
|
+
"sign-ins"
|
|
480
|
+
],
|
|
481
|
+
[
|
|
482
|
+
"sign_out",
|
|
483
|
+
"sign-out",
|
|
484
|
+
"sign-outs"
|
|
485
|
+
],
|
|
486
|
+
[
|
|
487
|
+
"token.",
|
|
488
|
+
"token change",
|
|
489
|
+
"token changes"
|
|
490
|
+
],
|
|
491
|
+
[
|
|
492
|
+
"device.",
|
|
493
|
+
"CLI sign-in approval",
|
|
494
|
+
"CLI sign-in approvals"
|
|
495
|
+
],
|
|
496
|
+
[
|
|
497
|
+
"account.",
|
|
498
|
+
"account link",
|
|
499
|
+
"account links"
|
|
500
|
+
],
|
|
501
|
+
[
|
|
502
|
+
"sync.run",
|
|
503
|
+
"sync run",
|
|
504
|
+
"sync runs"
|
|
505
|
+
],
|
|
506
|
+
[
|
|
507
|
+
"audit.heartbeat",
|
|
508
|
+
"heartbeat",
|
|
509
|
+
"heartbeats"
|
|
510
|
+
],
|
|
511
|
+
[
|
|
512
|
+
"audit.checkpoint",
|
|
513
|
+
"checkpoint",
|
|
514
|
+
"checkpoints"
|
|
515
|
+
]
|
|
516
|
+
];
|
|
517
|
+
/**
|
|
518
|
+
* "2 key operations, 3 sign-ins and 12 heartbeats": the detail the server
|
|
519
|
+
* left out of the page, as it counts it, by action.
|
|
520
|
+
*/
|
|
521
|
+
function hiddenInWords(hidden) {
|
|
522
|
+
const counts = /* @__PURE__ */ new Map();
|
|
523
|
+
for (const { action, count } of hidden) {
|
|
524
|
+
if (count === 0) continue;
|
|
525
|
+
const [, one, many] = HIDDEN_KINDS.find(([prefix]) => action.startsWith(prefix)) ?? [
|
|
526
|
+
action,
|
|
527
|
+
action,
|
|
528
|
+
action
|
|
529
|
+
];
|
|
530
|
+
const kind = counts.get(one) ?? {
|
|
531
|
+
one,
|
|
532
|
+
many,
|
|
533
|
+
count: 0
|
|
534
|
+
};
|
|
535
|
+
kind.count += count;
|
|
536
|
+
counts.set(one, kind);
|
|
537
|
+
}
|
|
538
|
+
const phrases = [...counts.values()].map(({ one, many, count }) => `${count} ${count === 1 ? one : many}`);
|
|
539
|
+
if (phrases.length === 0) return null;
|
|
540
|
+
return phrases.length === 1 ? phrases[0] : `${phrases.slice(0, -1).join(", ")} and ${phrases.at(-1)}`;
|
|
541
|
+
}
|
|
542
|
+
//#endregion
|
|
543
|
+
//#region src/routes/audit.tsx?tsr-split=component
|
|
544
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
545
|
+
function AuditPage() {
|
|
546
|
+
const { entries: result, chain } = Route.useLoaderData();
|
|
547
|
+
const search = Route.useSearch();
|
|
548
|
+
const { decision, actorId } = search;
|
|
549
|
+
const detail = search.detail === "1";
|
|
550
|
+
const deniedOnly = decision === "deny";
|
|
551
|
+
if (!result.ok) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ClosedDoor, {
|
|
552
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Ledger, { size: 18 }),
|
|
553
|
+
label: "Audit",
|
|
554
|
+
title: "The audit log is closed to you",
|
|
555
|
+
children: result.error
|
|
556
|
+
});
|
|
557
|
+
const broken = chain.integrity === "broken" ? chain : null;
|
|
558
|
+
const breakAt = broken?.failedAtSeq ?? null;
|
|
559
|
+
const shown = lines(result.entries);
|
|
560
|
+
const hiddenText = detail ? null : hiddenInWords(result.hidden ?? []);
|
|
561
|
+
const filters = {
|
|
562
|
+
decision,
|
|
563
|
+
actorId
|
|
564
|
+
};
|
|
565
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
566
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PageHeader, {
|
|
567
|
+
title: "Audit",
|
|
568
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChainStatus, { chain })
|
|
569
|
+
}),
|
|
570
|
+
broken !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
571
|
+
style: { marginBottom: "1.25rem" },
|
|
572
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Notice, {
|
|
573
|
+
tone: "bad",
|
|
574
|
+
children: [
|
|
575
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: "Treat this as an incident." }),
|
|
576
|
+
" ",
|
|
577
|
+
broken.failedAtSeq === null ? `The log does not verify, found by the ${broken.author}'s check: ${broken.reason}.` : `The log breaks at entry ${broken.failedAtSeq}, found by the ${broken.author}'s check: ${broken.reason}.`,
|
|
578
|
+
" ",
|
|
579
|
+
broken.through !== null && `Every entry through ${broken.through} holds. `,
|
|
580
|
+
"Something with direct access to the database has changed what it records",
|
|
581
|
+
broken.failedAtSeq === null ? "" : `, and nothing from entry ${broken.failedAtSeq} on can be relied on`,
|
|
582
|
+
" until that is explained.",
|
|
583
|
+
breakAt !== null && !result.entries.some((entry) => entry.seq === breakAt) && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
584
|
+
" ",
|
|
585
|
+
"Entry ",
|
|
586
|
+
breakAt,
|
|
587
|
+
" is not among the entries below",
|
|
588
|
+
detail ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
589
|
+
"; ",
|
|
590
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", { children: "coffre audit" }),
|
|
591
|
+
" lists them all."
|
|
592
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
593
|
+
": it may be detail,",
|
|
594
|
+
" ",
|
|
595
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
596
|
+
to: "/audit",
|
|
597
|
+
search: {
|
|
598
|
+
...filters,
|
|
599
|
+
detail: "1"
|
|
600
|
+
},
|
|
601
|
+
children: "shown on request"
|
|
602
|
+
}),
|
|
603
|
+
"."
|
|
604
|
+
] })
|
|
605
|
+
] })
|
|
606
|
+
]
|
|
607
|
+
})
|
|
608
|
+
}),
|
|
609
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", {
|
|
610
|
+
className: "section-desc",
|
|
611
|
+
children: "Everything done in coffre, one line per action, refusals included, and who decided it: the app, or the vault, which holds the keys and the access."
|
|
612
|
+
}),
|
|
613
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
614
|
+
className: "toolbar",
|
|
615
|
+
children: [
|
|
616
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", {
|
|
617
|
+
className: "segmented",
|
|
618
|
+
"aria-label": "Filter by decision",
|
|
619
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
620
|
+
to: "/audit",
|
|
621
|
+
search: {
|
|
622
|
+
...filters,
|
|
623
|
+
decision: void 0,
|
|
624
|
+
detail: search.detail
|
|
625
|
+
},
|
|
626
|
+
activeOptions: { exact: true },
|
|
627
|
+
children: "All events"
|
|
628
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
|
|
629
|
+
to: "/audit",
|
|
630
|
+
search: {
|
|
631
|
+
...filters,
|
|
632
|
+
decision: "deny",
|
|
633
|
+
detail: search.detail
|
|
634
|
+
},
|
|
635
|
+
activeOptions: { exact: true },
|
|
636
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlashCircle, { size: 13 }), "Denials only"]
|
|
637
|
+
})]
|
|
638
|
+
}),
|
|
639
|
+
actorId !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
|
|
640
|
+
className: "filter-chip",
|
|
641
|
+
to: "/audit",
|
|
642
|
+
search: {
|
|
643
|
+
...filters,
|
|
644
|
+
actorId: void 0,
|
|
645
|
+
detail: search.detail
|
|
646
|
+
},
|
|
647
|
+
"aria-label": `Stop filtering by ${actorId}`,
|
|
648
|
+
children: [
|
|
649
|
+
"Actor ",
|
|
650
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
651
|
+
className: "mono",
|
|
652
|
+
children: actorId
|
|
653
|
+
}),
|
|
654
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { size: 13 })
|
|
655
|
+
]
|
|
656
|
+
}),
|
|
657
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Link, {
|
|
658
|
+
className: "detail-toggle",
|
|
659
|
+
to: "/audit",
|
|
660
|
+
search: {
|
|
661
|
+
...filters,
|
|
662
|
+
detail: detail ? void 0 : "1"
|
|
663
|
+
},
|
|
664
|
+
"aria-pressed": detail,
|
|
665
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
666
|
+
className: "switch",
|
|
667
|
+
"aria-hidden": "true"
|
|
668
|
+
}), "Show detail"]
|
|
669
|
+
})
|
|
670
|
+
]
|
|
671
|
+
}),
|
|
672
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("section", {
|
|
673
|
+
className: "card",
|
|
674
|
+
"aria-label": "Audit entries",
|
|
675
|
+
children: shown.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, {
|
|
676
|
+
title: deniedOnly ? "No denials recorded" : "Nothing recorded yet",
|
|
677
|
+
children: deniedOnly ? "Every decision reaches this log, refusals included. An empty page means nobody has been turned away." : "The log fills as people read and write secrets and change who has access."
|
|
678
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
679
|
+
className: "dt-wrap",
|
|
680
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", {
|
|
681
|
+
className: "dt audit events stacks",
|
|
682
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
683
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
684
|
+
className: "n",
|
|
685
|
+
title: "Sequence number in the log",
|
|
686
|
+
children: "#"
|
|
687
|
+
}),
|
|
688
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
689
|
+
className: "col-shrink",
|
|
690
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
691
|
+
className: "th",
|
|
692
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Clock, { size: 14 }), "When (UTC)"]
|
|
693
|
+
})
|
|
694
|
+
}),
|
|
695
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
696
|
+
className: "col-shrink",
|
|
697
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
698
|
+
className: "th",
|
|
699
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(User, { size: 14 }), "Who"]
|
|
700
|
+
})
|
|
701
|
+
}),
|
|
702
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
703
|
+
className: "th",
|
|
704
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Activity, { size: 14 }), "What they did"]
|
|
705
|
+
}) }),
|
|
706
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
707
|
+
className: "col-shrink",
|
|
708
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
709
|
+
className: "th",
|
|
710
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShieldCheck, { size: 14 }), "Decided by"]
|
|
711
|
+
})
|
|
712
|
+
})
|
|
713
|
+
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: shown.map((batch) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Line, {
|
|
714
|
+
batch,
|
|
715
|
+
filters,
|
|
716
|
+
detail: search.detail,
|
|
717
|
+
breakAt
|
|
718
|
+
}, batch[0].seq)) })]
|
|
719
|
+
})
|
|
720
|
+
})
|
|
721
|
+
}),
|
|
722
|
+
hiddenText !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
|
|
723
|
+
className: "hint section-foot",
|
|
724
|
+
children: [
|
|
725
|
+
"Hidden: ",
|
|
726
|
+
hiddenText,
|
|
727
|
+
".",
|
|
728
|
+
" ",
|
|
729
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
730
|
+
to: "/audit",
|
|
731
|
+
search: {
|
|
732
|
+
...filters,
|
|
733
|
+
detail: "1"
|
|
734
|
+
},
|
|
735
|
+
children: "Show detail"
|
|
736
|
+
})
|
|
737
|
+
]
|
|
738
|
+
})
|
|
739
|
+
] });
|
|
740
|
+
}
|
|
741
|
+
/** One action: an entry, or a batch of them under one operation, which opens to each. */
|
|
742
|
+
function Line({ batch, filters, detail, breakAt }) {
|
|
743
|
+
const breaksInside = breakAt !== null && batch.some((entry) => entry.seq === breakAt);
|
|
744
|
+
const [open, setOpen] = (0, import_react.useState)(breaksInside);
|
|
745
|
+
const lead = batch[0];
|
|
746
|
+
const sentence = describe(batch);
|
|
747
|
+
const seqs = batch.map((entry) => entry.seq);
|
|
748
|
+
const grouped = batch.length > 1;
|
|
749
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Row, {
|
|
750
|
+
entry: lead,
|
|
751
|
+
seq: grouped ? `${Math.min(...seqs)}–${Math.max(...seqs)}` : String(lead.seq),
|
|
752
|
+
parts: sentence.parts,
|
|
753
|
+
refused: sentence.refused,
|
|
754
|
+
decided: decidedBy(batch),
|
|
755
|
+
filters,
|
|
756
|
+
detail,
|
|
757
|
+
breaks: breaksInside && !grouped,
|
|
758
|
+
marked: breaksInside,
|
|
759
|
+
batch,
|
|
760
|
+
toggle: grouped ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
761
|
+
type: "button",
|
|
762
|
+
className: "batch-toggle",
|
|
763
|
+
"aria-expanded": open,
|
|
764
|
+
"aria-label": open ? "Hide each entry" : `Show each of ${batch.length} entries`,
|
|
765
|
+
onClick: () => setOpen(!open),
|
|
766
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, { size: 14 })
|
|
767
|
+
}) : void 0
|
|
768
|
+
}), grouped && open && batch.map((entry) => {
|
|
769
|
+
const one = describe([entry]);
|
|
770
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Row, {
|
|
771
|
+
entry,
|
|
772
|
+
seq: String(entry.seq),
|
|
773
|
+
parts: one.parts,
|
|
774
|
+
refused: one.refused,
|
|
775
|
+
decided: decidedBy([entry]),
|
|
776
|
+
filters,
|
|
777
|
+
detail,
|
|
778
|
+
breaks: entry.seq === breakAt,
|
|
779
|
+
marked: false,
|
|
780
|
+
child: true
|
|
781
|
+
}, entry.seq);
|
|
782
|
+
})] });
|
|
783
|
+
}
|
|
784
|
+
function Row({ entry, seq, parts, refused, decided, filters, detail, breaks, marked, toggle, child = false, batch }) {
|
|
785
|
+
const actor = who(batch ?? [entry]);
|
|
786
|
+
const classes = [
|
|
787
|
+
refused && "is-denied",
|
|
788
|
+
(breaks || marked) && "is-break",
|
|
789
|
+
child && "is-child",
|
|
790
|
+
entry.detail && "is-detail",
|
|
791
|
+
entry.action === "vault.tampered" && "is-tampered"
|
|
792
|
+
].filter(Boolean);
|
|
793
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", {
|
|
794
|
+
className: classes.length === 0 ? void 0 : classes.join(" "),
|
|
795
|
+
children: [
|
|
796
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
797
|
+
className: "n",
|
|
798
|
+
"data-label": "Sequence",
|
|
799
|
+
children: seq
|
|
800
|
+
}),
|
|
801
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
802
|
+
className: "nowrap cell-mono",
|
|
803
|
+
"data-label": "When (UTC)",
|
|
804
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, {
|
|
805
|
+
iso: entry.occurredAt,
|
|
806
|
+
precise: true
|
|
807
|
+
})
|
|
808
|
+
}),
|
|
809
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
810
|
+
"data-label": "Who",
|
|
811
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
812
|
+
className: "actor",
|
|
813
|
+
children: typeof actor === "string" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
814
|
+
to: "/audit",
|
|
815
|
+
search: {
|
|
816
|
+
...filters,
|
|
817
|
+
actorId: entry.actorId,
|
|
818
|
+
detail
|
|
819
|
+
},
|
|
820
|
+
children: actor
|
|
821
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
822
|
+
to: "/audit",
|
|
823
|
+
search: {
|
|
824
|
+
...filters,
|
|
825
|
+
actorId: entry.actorId,
|
|
826
|
+
detail
|
|
827
|
+
},
|
|
828
|
+
children: memberName(actor.member)
|
|
829
|
+
})
|
|
830
|
+
})
|
|
831
|
+
}),
|
|
832
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
833
|
+
className: "cell-sentence",
|
|
834
|
+
"data-label": "What they did",
|
|
835
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
836
|
+
className: "sentence",
|
|
837
|
+
children: [
|
|
838
|
+
toggle,
|
|
839
|
+
entry.action === "vault.tampered" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTriangle, { size: 13 }),
|
|
840
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Sentence, { parts }),
|
|
841
|
+
breaks && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreakMark, {})
|
|
842
|
+
]
|
|
843
|
+
})
|
|
844
|
+
}),
|
|
845
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
846
|
+
className: "nowrap",
|
|
847
|
+
"data-label": "Decided by",
|
|
848
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
849
|
+
className: refused ? "decided decided-refused" : "decided",
|
|
850
|
+
children: [
|
|
851
|
+
refused && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SlashCircle, { size: 13 }),
|
|
852
|
+
decided,
|
|
853
|
+
refused && ", refused"
|
|
854
|
+
]
|
|
855
|
+
})
|
|
856
|
+
})
|
|
857
|
+
]
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
/** A sentence, its people and places links to their pages. */
|
|
861
|
+
function Sentence({ parts }) {
|
|
862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, { children: parts.map((part, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_react.Fragment, { children: typeof part === "string" ? part : "place" in part ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PlaceLink, { path: part.place }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(MemberLink, { member: part.member }) }, index)) });
|
|
863
|
+
}
|
|
864
|
+
function PlaceLink({ path }) {
|
|
865
|
+
const [project, environment] = path.split("/");
|
|
866
|
+
const text = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
867
|
+
className: "mono",
|
|
868
|
+
children: breakAfterUnderscores(path)
|
|
869
|
+
});
|
|
870
|
+
return environment === void 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
871
|
+
to: "/projects/$project",
|
|
872
|
+
params: { project },
|
|
873
|
+
children: text
|
|
874
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
875
|
+
to: "/projects/$project/$environment",
|
|
876
|
+
params: {
|
|
877
|
+
project,
|
|
878
|
+
environment
|
|
879
|
+
},
|
|
880
|
+
children: text
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
function MemberLink({ member }) {
|
|
884
|
+
return member.startsWith("token:") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
885
|
+
to: "/tokens/$token",
|
|
886
|
+
params: { token: member.slice(6) },
|
|
887
|
+
children: member
|
|
888
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
889
|
+
to: "/users/$user",
|
|
890
|
+
params: { user: memberName(member) },
|
|
891
|
+
children: memberName(member)
|
|
892
|
+
});
|
|
893
|
+
}
|
|
894
|
+
function memberName(member) {
|
|
895
|
+
return member.startsWith("user:") ? member.slice(5) : member;
|
|
896
|
+
}
|
|
897
|
+
/** The entry the log breaks at, said in words as well as in red. */
|
|
898
|
+
function BreakMark() {
|
|
899
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
900
|
+
className: "break-mark",
|
|
901
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTriangle, { size: 11 }), "breaks here"]
|
|
902
|
+
});
|
|
903
|
+
}
|
|
904
|
+
/**
|
|
905
|
+
* Whether the log still verifies, beside the title.
|
|
906
|
+
*
|
|
907
|
+
* This replaced a card with a "Verify chain" button on it. A green result you
|
|
908
|
+
* have to ask for is reassurance rather than evidence: it is checked when
|
|
909
|
+
* someone is already feeling confident, and not on the morning it would have
|
|
910
|
+
* mattered. Recomputing on load makes the claim continuous.
|
|
911
|
+
*/
|
|
912
|
+
function ChainStatus({ chain }) {
|
|
913
|
+
if (chain.integrity === "owners-only") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggletip, {
|
|
914
|
+
align: "end",
|
|
915
|
+
label: "Owners and root admins see whether the log is intact. Checking it means recomputing every entry, and you read only your projects' part of it.",
|
|
916
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
917
|
+
type: "button",
|
|
918
|
+
className: "chain-note",
|
|
919
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Info, { size: 14 }), "Verified by owners"]
|
|
920
|
+
})
|
|
921
|
+
});
|
|
922
|
+
if (chain.integrity === "unknown") return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggletip, {
|
|
923
|
+
align: "end",
|
|
924
|
+
label: `coffre could not check the log: ${chain.problem}. The entries below loaded, but whether they are intact is unknown until it can. Reload to try again.`,
|
|
925
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
926
|
+
type: "button",
|
|
927
|
+
className: "chain-flag chain-flag-warn",
|
|
928
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTriangle, { size: 14 }), "Log not verified"]
|
|
929
|
+
})
|
|
930
|
+
});
|
|
931
|
+
if (chain.integrity === "broken") return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
932
|
+
className: "chain-flag chain-flag-bad",
|
|
933
|
+
role: "status",
|
|
934
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTriangle, { size: 14 }), chain.failedAtSeq === null ? "Log does not verify" : `Log broken at ${chain.failedAtSeq}`]
|
|
935
|
+
});
|
|
936
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
937
|
+
className: "chain",
|
|
938
|
+
children: [chain.pending > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggletip, {
|
|
939
|
+
align: "end",
|
|
940
|
+
label: "Keys released through KMS whose outcome the vault has not logged yet. Each settles within seconds, or is logged as failed.",
|
|
941
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
942
|
+
type: "button",
|
|
943
|
+
className: "chain-note",
|
|
944
|
+
role: "status",
|
|
945
|
+
children: [
|
|
946
|
+
chain.pending,
|
|
947
|
+
" key operation",
|
|
948
|
+
chain.pending === 1 ? "" : "s",
|
|
949
|
+
" in flight"
|
|
950
|
+
]
|
|
951
|
+
})
|
|
952
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Toggletip, {
|
|
953
|
+
align: "end",
|
|
954
|
+
label: `Every entry through ${chain.through ?? 0} holds, under the app's key and the vault's.` + (chain.checkpoint === null ? " The vault has not signed the log yet." : ` The vault last signed it through entry ${chain.checkpoint.seq}, at ${chain.checkpoint.signedAt}.`),
|
|
955
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
956
|
+
type: "button",
|
|
957
|
+
className: "chain-seal",
|
|
958
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShieldCheck, { size: 14 }), chain.through === null ? "Verified" : `Verified through ${chain.through}`]
|
|
959
|
+
})
|
|
960
|
+
})]
|
|
961
|
+
});
|
|
962
|
+
}
|
|
963
|
+
//#endregion
|
|
964
|
+
export { AuditPage as component };
|