@coffre/ui 0.1.15 → 0.1.17
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/client/_coffre/assets/{account-DqjL4kP9.js → account-BoLGAxbD.js} +2 -2
- package/dist/client/_coffre/assets/{account-DGGcVkqt.js → account-CnnuRTDB.js} +1 -1
- package/dist/client/_coffre/assets/{affordances-B9nFwqIv.js → affordances-CEafRJcN.js} +1 -1
- package/dist/client/_coffre/assets/audit-CHSvKLWX.js +1 -0
- package/dist/client/_coffre/assets/audit-Cn4hmS4u.js +2 -0
- package/dist/client/_coffre/assets/{auth.device-CHHcm089.js → auth.device-Co5vrpaA.js} +2 -2
- package/dist/client/_coffre/assets/{auth.device-CFCn1DXA.js → auth.device-DAlqWacc.js} +1 -1
- package/dist/client/_coffre/assets/{directory-skRBmF1Y.js → directory-H8Eh3MnS.js} +1 -1
- package/dist/client/_coffre/assets/{dist-BHhATf1q.js → dist-Braunv_x.js} +1 -1
- package/dist/client/_coffre/assets/globals-CpMrgkV6.css +1 -0
- package/dist/client/_coffre/assets/{grants-BEmVXYg5.js → grants-DPDxJXU1.js} +1 -1
- package/dist/client/_coffre/assets/icons-Dc_-t0lp.js +1 -0
- package/dist/client/_coffre/assets/{index-Bo6udWLL.js → index-sUCIXRgJ.js} +3 -3
- package/dist/client/_coffre/assets/{link-Bg_PHv45.js → link-DBINMwm6.js} +1 -1
- package/dist/client/_coffre/assets/{login-GV0ZjCQy.js → login-BZFYfL1Y.js} +1 -1
- package/dist/client/_coffre/assets/login-CYCKWTOD.js +2 -0
- package/dist/client/_coffre/assets/{offboarding-CXV0KyMt.js → offboarding-Bwpftp3g.js} +1 -1
- package/dist/client/_coffre/assets/page-C_hnzdaR.js +1 -0
- package/dist/client/_coffre/assets/{preload-helper-CYFH1xAV.js → preload-helper-CLkO85Nq.js} +1 -1
- package/dist/client/_coffre/assets/{principal-page-BmgkTnAl.js → principal-page-DLho8TSJ.js} +1 -1
- package/dist/client/_coffre/assets/projects._project._environment-DHRRvQw0.js +3 -0
- package/dist/client/_coffre/assets/projects._project._environment-TLI-RjBZ.js +2 -0
- package/dist/client/_coffre/assets/projects._project.index-BO-8FZIY.js +2 -0
- package/dist/client/_coffre/assets/{projects._project.index-wjtfc8E6.js → projects._project.index-DGl921dP.js} +1 -1
- package/dist/client/_coffre/assets/{projects.index-dl7dfnGW.js → projects.index-BDn7Bhoo.js} +1 -1
- package/dist/client/_coffre/assets/{row-state-BzGdu73b.js → row-state-DJ-KLamZ.js} +1 -1
- package/dist/client/_coffre/assets/{settings-DnENNWn8.js → settings-q9G1QvR_.js} +1 -1
- package/dist/client/_coffre/assets/{suspense-Cnh1cNc1.js → suspense-O8sP0mEC.js} +1 -1
- package/dist/client/_coffre/assets/tokens._token-B_qczpT9.js +2 -0
- package/dist/client/_coffre/assets/tokens._token-T-sqwMbz.js +2 -0
- package/dist/client/_coffre/assets/{tokens.index-D4HYaFJl.js → tokens.index-CcXSZnAG.js} +1 -1
- package/dist/client/_coffre/assets/{ui-Ch0beQy-.js → ui-BXP2IqrW.js} +2 -2
- package/dist/client/_coffre/assets/{unregistered-wV1yqr9t.js → unregistered-D2JXJ90x.js} +1 -1
- package/dist/client/_coffre/assets/{use-action-cgaBRBBH.js → use-action-BpzKWhgg.js} +1 -1
- package/dist/client/_coffre/assets/use-change-CKj3Inq9.js +1 -0
- package/dist/client/_coffre/assets/{use-shell-BJwawvkh.js → use-shell-W0SusPkz.js} +1 -1
- package/dist/client/_coffre/assets/useQuery-B-lxFSES.js +1 -0
- package/dist/client/_coffre/assets/{useSuspenseQuery-BfnNEmf7.js → useSuspenseQuery-BZ-nzHST.js} +1 -1
- package/dist/client/_coffre/assets/users._user-Bb3BGYHl.js +1 -0
- package/dist/client/_coffre/assets/users._user-DXmvKrzE.js +2 -0
- package/dist/client/_coffre/assets/{users.index-C7_aZ0jb.js → users.index-BvzP3qwW.js} +1 -1
- package/dist/server/.vite/manifest.json +205 -205
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-GsKnGGRy.js +162 -0
- package/dist/server/_coffre/assets/{account-BJtaf5d7.js → account-CV-a2IU2.js} +8 -8
- package/dist/server/_coffre/assets/{account-CL3AX6kY.js → account-hk6wcIXU.js} +4 -4
- package/dist/server/_coffre/assets/{audit-DiHTzVVe.js → audit-C1_Ej6YB.js} +2 -2
- package/dist/server/_coffre/assets/{audit-BtjuffEH.js → audit-qB9G2AQJ.js} +37 -9
- package/dist/server/_coffre/assets/{auth.device-8RMD0nyz.js → auth.device-6JRrWbSV.js} +4 -4
- package/dist/server/_coffre/assets/{auth.device-dUMx6Srl.js → auth.device-CLoAxC2T.js} +2 -2
- package/dist/server/_coffre/assets/{directory-9Jc5MEra.js → directory-B-_rqsPx.js} +5 -5
- package/dist/server/_coffre/assets/globals-CpMrgkV6.css +1 -0
- package/dist/server/_coffre/assets/{grants-D5-q8fXB.js → grants-DdKT11Ny.js} +5 -5
- package/dist/server/_coffre/assets/{icons-CWsTEfpn.js → icons-DOFT-eWB.js} +3 -2
- package/dist/server/_coffre/assets/{login-C80ImEsO.js → login-DRKUKkaW.js} +1 -1
- package/dist/server/_coffre/assets/{login-DmpfrcPB.js → login-DnwxVl4Y.js} +5 -5
- package/dist/server/_coffre/assets/{offboarding-CXIgvZbO.js → offboarding-CRz-K82H.js} +4 -4
- package/dist/server/_coffre/assets/{page-x4nICC9d.js → page-D6n45dcK.js} +28 -0
- package/dist/server/_coffre/assets/{principal-page-BO6Ijpqv.js → principal-page-C-EFwJQw.js} +11 -11
- package/dist/server/_coffre/assets/{projects._project._environment-BMqZsCfi.js → projects._project._environment-C6uybzeU.js} +9 -9
- package/dist/server/_coffre/assets/{projects._project._environment-BeXpetmJ.js → projects._project._environment-CS8DdSMY.js} +2 -2
- package/dist/server/_coffre/assets/{projects._project.index-B74-XdI3.js → projects._project.index-3CXwkyTh.js} +12 -12
- package/dist/server/_coffre/assets/{projects._project.index-DZ1KZvHR.js → projects._project.index-BGfcNpj0.js} +2 -2
- package/dist/server/_coffre/assets/{projects.index-D7F7hiVe.js → projects.index-iSoBpRFz.js} +7 -7
- package/dist/server/_coffre/assets/{router-fxr2e6Ht.js → router-9BTgJhWG.js} +20 -20
- package/dist/server/_coffre/assets/{row-state-CAItu3n_.js → row-state-C2P57xT1.js} +2 -2
- package/dist/server/_coffre/assets/{settings-DO8wvTmo.js → settings-BDQTF5XW.js} +3 -3
- package/dist/server/_coffre/assets/{suspense-WsBv84ga.js → suspense-C-2QfDd2.js} +1 -1
- package/dist/server/_coffre/assets/tokens._token-CrBMpcbN.js +988 -0
- package/dist/server/_coffre/assets/{tokens._token-DhcJxsf3.js → tokens._token-rY86Cjgp.js} +2 -2
- package/dist/server/_coffre/assets/{tokens.index-hvPM5IjY.js → tokens.index-Bq5qDW9q.js} +6 -6
- package/dist/server/_coffre/assets/{ui-DvlGkmaH.js → ui-Cc0CGMtr.js} +1 -1
- package/dist/server/_coffre/assets/{unregistered-DKdzrjVr.js → unregistered-D9ZKLOPJ.js} +3 -3
- package/dist/server/_coffre/assets/{use-action-D6KlY-sv.js → use-action-B-xpvVRO.js} +2 -2
- package/dist/server/_coffre/assets/{use-change-CAcOZo-a.js → use-change-C8BCf3oU.js} +20 -4
- package/dist/server/_coffre/assets/{use-shell-C-yuQ1hA.js → use-shell-DwOzEi87.js} +2 -2
- package/dist/server/_coffre/assets/{useQuery-MqmaAeUF.js → useQuery-CTe86qFq.js} +2 -2
- package/dist/server/_coffre/assets/{useSuspenseQuery-BDvlOPB7.js → useSuspenseQuery-CSoHzrMb.js} +2 -2
- package/dist/server/_coffre/assets/{users._user-dCIYuxyZ.js → users._user-BmLKYeo_.js} +2 -2
- package/dist/server/_coffre/assets/{users._user-pLdzKe1F.js → users._user-BmiHwQx3.js} +2 -2
- package/dist/server/_coffre/assets/{users.index-CDCDlQxN.js → users.index-BiEax90r.js} +6 -6
- package/dist/server/index.js +2 -2
- package/package.json +3 -3
- package/src/components/trusted-workloads.tsx +379 -0
- package/src/lib/audit-sentences.ts +26 -0
- package/src/lib/bindings.ts +111 -0
- package/src/lib/changes.ts +16 -0
- package/src/lib/queries.ts +16 -0
- package/src/routes/audit.tsx +7 -0
- package/src/routes/tokens.$token.tsx +3 -0
- package/src/styles/globals.css +43 -0
- package/dist/client/_coffre/assets/audit-CcQmaSan.js +0 -1
- package/dist/client/_coffre/assets/audit-XwuBA4r9.js +0 -2
- package/dist/client/_coffre/assets/globals-DCrHjrpD.css +0 -1
- package/dist/client/_coffre/assets/icons-BFziRUf9.js +0 -1
- package/dist/client/_coffre/assets/login-pzHGDqU5.js +0 -2
- package/dist/client/_coffre/assets/page-CDuo3uft.js +0 -1
- package/dist/client/_coffre/assets/projects._project._environment-5PA9NHET.js +0 -2
- package/dist/client/_coffre/assets/projects._project._environment-B-5I0ZFP.js +0 -3
- package/dist/client/_coffre/assets/projects._project.index-BzJQojbd.js +0 -2
- package/dist/client/_coffre/assets/tokens._token-BJiMX2TJ.js +0 -1
- package/dist/client/_coffre/assets/tokens._token-C2s6HHWK.js +0 -2
- package/dist/client/_coffre/assets/use-change-DIpkq9iI.js +0 -1
- package/dist/client/_coffre/assets/useQuery-BHCBwHtH.js +0 -1
- package/dist/client/_coffre/assets/users._user--OY2srG0.js +0 -1
- package/dist/client/_coffre/assets/users._user-Cj4NY0p5.js +0 -2
- package/dist/server/_coffre/assets/_tanstack-start-manifest_v-C-_y9u60.js +0 -162
- package/dist/server/_coffre/assets/globals-DCrHjrpD.css +0 -1
- package/dist/server/_coffre/assets/tokens._token-CVWTFOM-.js +0 -286
|
@@ -0,0 +1,988 @@
|
|
|
1
|
+
import { i as require_react, r as require_jsx_runtime, s as __toESM } from "./useRouter-CaUSUNsw.js";
|
|
2
|
+
import { C as useCoffre, b as memberRef, h as queries, o as affects, t as Card } from "./page-D6n45dcK.js";
|
|
3
|
+
import { b as revokeCredential, g as removeBinding, n as useChangeStatus, t as useChange } from "./use-change-C8BCf3oU.js";
|
|
4
|
+
import { t as useShell } from "./use-shell-DwOzEi87.js";
|
|
5
|
+
import { t as useSuspenseQuery } from "./useSuspenseQuery-CSoHzrMb.js";
|
|
6
|
+
import { a as ErrorLine, c as Spinner, i as EmptyState, l as Timestamp, o as Modal, r as CopyButton, s as Notice, t as ConfirmButton } from "./ui-Cc0CGMtr.js";
|
|
7
|
+
import { G as X, j as Plus, m as GitHub, v as Key, x as Link } from "./icons-DOFT-eWB.js";
|
|
8
|
+
import { a as rowClass, i as RowPending, r as RowFailure } from "./row-state-C2P57xT1.js";
|
|
9
|
+
import { t as Route } from "./tokens._token-rY86Cjgp.js";
|
|
10
|
+
import { t as useAction } from "./use-action-B-xpvVRO.js";
|
|
11
|
+
import { t as PrincipalPage } from "./principal-page-C-EFwJQw.js";
|
|
12
|
+
//#region src/components/service-tokens.tsx
|
|
13
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
14
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
15
|
+
var LIFETIMES = [
|
|
16
|
+
30,
|
|
17
|
+
90,
|
|
18
|
+
180,
|
|
19
|
+
365
|
|
20
|
+
];
|
|
21
|
+
/**
|
|
22
|
+
* The bearer tokens a service presents to the API. A value exists in exactly
|
|
23
|
+
* one place, this dialog, for as long as it stays open: coffre keeps a hash.
|
|
24
|
+
*/
|
|
25
|
+
function ServiceTokens({ serviceId, tokens }) {
|
|
26
|
+
const change = revokeCredential(useCoffre(), serviceId);
|
|
27
|
+
const revoke = useChange(change);
|
|
28
|
+
const { status, dismiss } = useChangeStatus(change.list.queryKey);
|
|
29
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
|
|
30
|
+
labelledBy: "service-tokens",
|
|
31
|
+
title: "Credentials",
|
|
32
|
+
description: "Bearer tokens this service presents to the API. Each is shown once, when it is issued; coffre keeps only a hash.",
|
|
33
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IssueToken, { serviceId }),
|
|
34
|
+
children: tokens.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, {
|
|
35
|
+
title: "No live credentials",
|
|
36
|
+
children: "Nothing can act as this service until a token is issued."
|
|
37
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
38
|
+
className: "dt-wrap",
|
|
39
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", {
|
|
40
|
+
className: "dt",
|
|
41
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
42
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "Token" }),
|
|
43
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
44
|
+
className: "col-shrink",
|
|
45
|
+
children: "Issued (UTC)"
|
|
46
|
+
}),
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
48
|
+
className: "col-shrink",
|
|
49
|
+
children: "Last used"
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
52
|
+
className: "col-shrink",
|
|
53
|
+
children: "Expires"
|
|
54
|
+
}),
|
|
55
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
56
|
+
className: "col-actions",
|
|
57
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
58
|
+
className: "visually-hidden",
|
|
59
|
+
children: "Actions"
|
|
60
|
+
})
|
|
61
|
+
})
|
|
62
|
+
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: tokens.map((token) => {
|
|
63
|
+
const state = status(token.id);
|
|
64
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", {
|
|
65
|
+
className: rowClass(state),
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
68
|
+
className: "cell-account",
|
|
69
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Key, { size: 15 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
70
|
+
className: "cell-stack",
|
|
71
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: token.label ?? "Unlabelled" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
|
|
72
|
+
className: "mono",
|
|
73
|
+
children: token.hint
|
|
74
|
+
})]
|
|
75
|
+
})]
|
|
76
|
+
}) }),
|
|
77
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
78
|
+
className: "nowrap",
|
|
79
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
80
|
+
className: "cell-stack",
|
|
81
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, { iso: token.createdAt }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("small", { children: ["by ", token.createdBy] })]
|
|
82
|
+
})
|
|
83
|
+
}),
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
85
|
+
className: "nowrap cell-muted",
|
|
86
|
+
children: token.lastUsedAt === null ? "Never" : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
87
|
+
className: "cell-stack",
|
|
88
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, {
|
|
89
|
+
iso: token.lastUsedAt,
|
|
90
|
+
display: "relative"
|
|
91
|
+
}), token.lastUsedIp !== null && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", {
|
|
92
|
+
className: "mono",
|
|
93
|
+
children: token.lastUsedIp
|
|
94
|
+
})]
|
|
95
|
+
})
|
|
96
|
+
}),
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
98
|
+
className: "nowrap cell-muted",
|
|
99
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, {
|
|
100
|
+
iso: token.expiresAt,
|
|
101
|
+
display: "relative"
|
|
102
|
+
})
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
105
|
+
className: "col-actions",
|
|
106
|
+
children: state.state === "pending" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowPending, { status: state }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfirmButton, {
|
|
107
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
108
|
+
className: "act",
|
|
109
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { size: 13 }), "Revoke"]
|
|
110
|
+
}),
|
|
111
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
112
|
+
"Revoke ",
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
114
|
+
className: "mono",
|
|
115
|
+
children: token.hint
|
|
116
|
+
}),
|
|
117
|
+
"?"
|
|
118
|
+
] }),
|
|
119
|
+
body: "Whatever uses it is refused from its next request. Issue a new token first if the service should keep working.",
|
|
120
|
+
confirmLabel: "Revoke token",
|
|
121
|
+
onConfirm: () => revoke(token)
|
|
122
|
+
})
|
|
123
|
+
})
|
|
124
|
+
]
|
|
125
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowFailure, {
|
|
126
|
+
status: state,
|
|
127
|
+
columns: 5,
|
|
128
|
+
onDismiss: () => state.state === "failed" && dismiss(state.mutationId)
|
|
129
|
+
})] }, token.id);
|
|
130
|
+
}) })]
|
|
131
|
+
})
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
function IssueToken({ serviceId }) {
|
|
136
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
137
|
+
const [label, setLabel] = (0, import_react.useState)("");
|
|
138
|
+
const [days, setDays] = (0, import_react.useState)(90);
|
|
139
|
+
const [issued, setIssued] = (0, import_react.useState)(null);
|
|
140
|
+
const coffre = useCoffre();
|
|
141
|
+
const { pending, error, setError, run } = useAction();
|
|
142
|
+
function close() {
|
|
143
|
+
setOpen(false);
|
|
144
|
+
setIssued(null);
|
|
145
|
+
setLabel("");
|
|
146
|
+
setError(null);
|
|
147
|
+
}
|
|
148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
149
|
+
className: "btn btn-sm",
|
|
150
|
+
onClick: () => setOpen(true),
|
|
151
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plus, { size: 14 }), "Issue token"]
|
|
152
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Modal, {
|
|
153
|
+
open,
|
|
154
|
+
onOpenChange: (next) => next ? setOpen(true) : close(),
|
|
155
|
+
title: issued === null ? "Issue a token" : "Copy the token now",
|
|
156
|
+
children: issued === null ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
|
|
157
|
+
className: "form",
|
|
158
|
+
onSubmit: (event) => {
|
|
159
|
+
event.preventDefault();
|
|
160
|
+
run(() => coffre.tokens.issue(memberRef("service", serviceId), {
|
|
161
|
+
label: label.trim() === "" ? null : label.trim(),
|
|
162
|
+
expiresInDays: days
|
|
163
|
+
}), {
|
|
164
|
+
affects: affects.credentials(memberRef("service", serviceId)),
|
|
165
|
+
onSuccess: (credential) => setIssued(credential)
|
|
166
|
+
});
|
|
167
|
+
},
|
|
168
|
+
children: [
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
170
|
+
className: "form-row",
|
|
171
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
172
|
+
className: "field",
|
|
173
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
174
|
+
className: "label",
|
|
175
|
+
children: "Label"
|
|
176
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
177
|
+
className: "input",
|
|
178
|
+
value: label,
|
|
179
|
+
maxLength: 120,
|
|
180
|
+
placeholder: "GitHub Actions deploy",
|
|
181
|
+
onChange: (event) => setLabel(event.target.value)
|
|
182
|
+
})]
|
|
183
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
184
|
+
className: "field",
|
|
185
|
+
style: { flex: "0 0 9rem" },
|
|
186
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
187
|
+
className: "label",
|
|
188
|
+
children: "Expires after"
|
|
189
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("select", {
|
|
190
|
+
className: "select",
|
|
191
|
+
value: days,
|
|
192
|
+
onChange: (event) => setDays(Number(event.target.value)),
|
|
193
|
+
children: LIFETIMES.map((lifetime) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("option", {
|
|
194
|
+
value: lifetime,
|
|
195
|
+
children: [lifetime, " days"]
|
|
196
|
+
}, lifetime))
|
|
197
|
+
})]
|
|
198
|
+
})]
|
|
199
|
+
}),
|
|
200
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error }),
|
|
201
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
202
|
+
className: "dialog-actions",
|
|
203
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
204
|
+
className: "btn",
|
|
205
|
+
type: "button",
|
|
206
|
+
onClick: close,
|
|
207
|
+
children: "Cancel"
|
|
208
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
209
|
+
className: "btn btn-primary",
|
|
210
|
+
type: "submit",
|
|
211
|
+
disabled: pending,
|
|
212
|
+
children: [pending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}), "Issue token"]
|
|
213
|
+
})]
|
|
214
|
+
})
|
|
215
|
+
]
|
|
216
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
217
|
+
className: "form",
|
|
218
|
+
children: [
|
|
219
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Notice, {
|
|
220
|
+
tone: "info",
|
|
221
|
+
children: [
|
|
222
|
+
"This is the only time the value is shown. Store it where the service reads its configuration, as ",
|
|
223
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
224
|
+
className: "mono",
|
|
225
|
+
children: "COFFRE_TOKEN"
|
|
226
|
+
}),
|
|
227
|
+
"."
|
|
228
|
+
]
|
|
229
|
+
}),
|
|
230
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
231
|
+
className: "token-once",
|
|
232
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("code", {
|
|
233
|
+
className: "mono",
|
|
234
|
+
children: issued.token
|
|
235
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyButton, {
|
|
236
|
+
value: issued.token,
|
|
237
|
+
label: "Copy token"
|
|
238
|
+
})]
|
|
239
|
+
}),
|
|
240
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
|
|
241
|
+
className: "hint",
|
|
242
|
+
children: [
|
|
243
|
+
"Expires ",
|
|
244
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, { iso: issued.expiresAt }),
|
|
245
|
+
". Send it as",
|
|
246
|
+
" ",
|
|
247
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
248
|
+
className: "mono",
|
|
249
|
+
children: "Authorization: Bearer …"
|
|
250
|
+
})
|
|
251
|
+
]
|
|
252
|
+
}),
|
|
253
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
254
|
+
className: "dialog-actions",
|
|
255
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
256
|
+
className: "btn btn-primary",
|
|
257
|
+
type: "button",
|
|
258
|
+
onClick: close,
|
|
259
|
+
children: "Done"
|
|
260
|
+
})
|
|
261
|
+
})
|
|
262
|
+
]
|
|
263
|
+
})
|
|
264
|
+
})] });
|
|
265
|
+
}
|
|
266
|
+
//#endregion
|
|
267
|
+
//#region ../core/dist/workloads.js
|
|
268
|
+
/**
|
|
269
|
+
* Events triggered by someone with write access, at a ref the binding names
|
|
270
|
+
* exactly. `pull_request`, `pull_request_target`, `workflow_run` and the
|
|
271
|
+
* rest are refused, even when their ref happens to match: their runs can
|
|
272
|
+
* carry a stranger's code.
|
|
273
|
+
*/
|
|
274
|
+
var GITHUB_EVENTS = [
|
|
275
|
+
"push",
|
|
276
|
+
"workflow_dispatch",
|
|
277
|
+
"schedule",
|
|
278
|
+
"release"
|
|
279
|
+
];
|
|
280
|
+
/** Pipelines that run the project's own code, at its own ref: never a merge request's. */
|
|
281
|
+
var GITLAB_PIPELINE_SOURCES = [
|
|
282
|
+
"push",
|
|
283
|
+
"web",
|
|
284
|
+
"schedule"
|
|
285
|
+
];
|
|
286
|
+
/** `refs/heads/main`, or `refs/tags/v1`, as GitHub names a ref. */
|
|
287
|
+
function fullRef(kind, name) {
|
|
288
|
+
return `refs/${kind === "branch" ? "heads" : "tags"}/${name}`;
|
|
289
|
+
}
|
|
290
|
+
/** A workflow file at a ref, as GitHub's tokens name it: `acme/api/.github/workflows/deploy.yml@refs/heads/main`. */
|
|
291
|
+
function workflowRef(repository, file, ref) {
|
|
292
|
+
return `${repository}/.github/workflows/${file.replace(/^\.github\/workflows\//, "")}@${ref}`;
|
|
293
|
+
}
|
|
294
|
+
/** A workflow of the repository, run by `event` at `ref`. */
|
|
295
|
+
function githubWorkflow(input) {
|
|
296
|
+
return {
|
|
297
|
+
profile: "github",
|
|
298
|
+
claims: {
|
|
299
|
+
repository_owner_id: input.ownerId,
|
|
300
|
+
repository_id: input.repositoryId,
|
|
301
|
+
workflow_ref: workflowRef(input.repository, input.workflow, input.ref),
|
|
302
|
+
ref: input.ref,
|
|
303
|
+
event_name: input.event
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* A reusable workflow at one commit, called at `ref`: from one repository,
|
|
309
|
+
* or, with `repositoryId` null, from any repository of the organization. A
|
|
310
|
+
* `caller` workflow narrows it to one calling workflow.
|
|
311
|
+
*/
|
|
312
|
+
function githubReusable(input) {
|
|
313
|
+
const claims = {
|
|
314
|
+
repository_owner_id: input.ownerId,
|
|
315
|
+
...input.repositoryId === null ? {} : { repository_id: input.repositoryId },
|
|
316
|
+
ref: input.ref,
|
|
317
|
+
event_name: input.event,
|
|
318
|
+
job_workflow_ref: input.called,
|
|
319
|
+
job_workflow_sha: input.sha
|
|
320
|
+
};
|
|
321
|
+
if (input.caller !== void 0) claims.workflow_ref = workflowRef(input.caller.repository, input.caller.workflow, input.ref);
|
|
322
|
+
return {
|
|
323
|
+
profile: input.repositoryId === null ? "github-reusable-organization" : "github-reusable",
|
|
324
|
+
claims
|
|
325
|
+
};
|
|
326
|
+
}
|
|
327
|
+
/** A GitLab project's pipelines from `source`, at a branch or tag. */
|
|
328
|
+
function gitlabProject(input) {
|
|
329
|
+
return {
|
|
330
|
+
profile: "gitlab",
|
|
331
|
+
claims: {
|
|
332
|
+
namespace_id: input.namespaceId,
|
|
333
|
+
project_id: input.projectId,
|
|
334
|
+
ref_type: input.refType,
|
|
335
|
+
ref: input.ref,
|
|
336
|
+
pipeline_source: input.source
|
|
337
|
+
}
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
//#endregion
|
|
341
|
+
//#region src/lib/bindings.ts
|
|
342
|
+
/**
|
|
343
|
+
* Trust bindings as the pages show and make them. A binding is its claims;
|
|
344
|
+
* the presets in core fill them in, and the server holds every one to its
|
|
345
|
+
* profile, whatever built it.
|
|
346
|
+
*/
|
|
347
|
+
/** A binding in a line: what it trusts, and at which ref. */
|
|
348
|
+
function summary(binding) {
|
|
349
|
+
const { claims } = binding;
|
|
350
|
+
const short = (ref) => ref?.replace(/^refs\/(heads|tags)\//, "") ?? "";
|
|
351
|
+
const [workflow, at] = (claims.workflow_ref ?? "").split("@");
|
|
352
|
+
if (binding.profile === "github") {
|
|
353
|
+
const [owner, repository, , , file] = (workflow ?? "").split("/");
|
|
354
|
+
return {
|
|
355
|
+
title: `${owner}/${repository} · ${file}`,
|
|
356
|
+
detail: `${claims.event_name} at ${short(at)}`
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
if (binding.profile.startsWith("github-reusable")) {
|
|
360
|
+
const called = (claims.job_workflow_ref ?? "").split("@")[0].replace("/.github/workflows/", " · ");
|
|
361
|
+
const from = binding.profile === "github-reusable-organization" ? "any repository of the organization" : `repository ${claims.repository_id}`;
|
|
362
|
+
return {
|
|
363
|
+
title: `${called} @ ${claims.job_workflow_sha?.slice(0, 7)}`,
|
|
364
|
+
detail: `${claims.event_name} at ${short(claims.ref)}, from ${from}`
|
|
365
|
+
};
|
|
366
|
+
}
|
|
367
|
+
if (binding.profile === "gitlab") return {
|
|
368
|
+
title: `GitLab project ${claims.project_id}`,
|
|
369
|
+
detail: `${claims.pipeline_source} at ${claims.ref_type} ${claims.ref}`
|
|
370
|
+
};
|
|
371
|
+
return {
|
|
372
|
+
title: new URL(binding.issuer).host,
|
|
373
|
+
detail: `sub ${claims.sub}`
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
var EMPTY_FORM = {
|
|
377
|
+
platform: "github",
|
|
378
|
+
label: "",
|
|
379
|
+
reusable: false,
|
|
380
|
+
repository: "",
|
|
381
|
+
repositoryId: "",
|
|
382
|
+
ownerId: "",
|
|
383
|
+
workflow: "",
|
|
384
|
+
event: "push",
|
|
385
|
+
refKind: "branch",
|
|
386
|
+
refName: "main",
|
|
387
|
+
called: "",
|
|
388
|
+
sha: "",
|
|
389
|
+
anyRepository: false,
|
|
390
|
+
gitlabUrl: "",
|
|
391
|
+
project: "",
|
|
392
|
+
projectId: "",
|
|
393
|
+
namespaceId: "",
|
|
394
|
+
source: "push",
|
|
395
|
+
issuer: "",
|
|
396
|
+
sub: "",
|
|
397
|
+
extra: ""
|
|
398
|
+
};
|
|
399
|
+
/** The binding the form describes, or why it does not describe one yet. The server checks the rest. */
|
|
400
|
+
function bindingOf(form) {
|
|
401
|
+
const needed = (value, what) => {
|
|
402
|
+
if (value.trim() === "") throw new Error(`${what} is needed`);
|
|
403
|
+
return value.trim();
|
|
404
|
+
};
|
|
405
|
+
if (form.platform === "github") {
|
|
406
|
+
const ref = fullRef(form.refKind, needed(form.refName, form.refKind === "branch" ? "The branch" : "The tag"));
|
|
407
|
+
if (form.reusable) {
|
|
408
|
+
const called = needed(form.called, "The called workflow");
|
|
409
|
+
const sha = needed(form.sha, "The called workflow's commit");
|
|
410
|
+
const ownerId = needed(form.ownerId, "The owner's ID");
|
|
411
|
+
const caller = form.workflow.trim() === "" ? void 0 : {
|
|
412
|
+
repository: needed(form.repository, "The repository"),
|
|
413
|
+
workflow: form.workflow.trim()
|
|
414
|
+
};
|
|
415
|
+
return {
|
|
416
|
+
...githubReusable({
|
|
417
|
+
repositoryId: form.anyRepository ? null : needed(form.repositoryId, "The repository's ID"),
|
|
418
|
+
ownerId,
|
|
419
|
+
ref,
|
|
420
|
+
event: form.event,
|
|
421
|
+
called,
|
|
422
|
+
sha,
|
|
423
|
+
caller
|
|
424
|
+
}),
|
|
425
|
+
issuer: null
|
|
426
|
+
};
|
|
427
|
+
}
|
|
428
|
+
return {
|
|
429
|
+
...githubWorkflow({
|
|
430
|
+
repository: needed(form.repository, "The repository"),
|
|
431
|
+
repositoryId: needed(form.repositoryId, "The repository's ID"),
|
|
432
|
+
ownerId: needed(form.ownerId, "The owner's ID"),
|
|
433
|
+
workflow: needed(form.workflow, "The workflow file"),
|
|
434
|
+
ref,
|
|
435
|
+
event: form.event
|
|
436
|
+
}),
|
|
437
|
+
issuer: null
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
if (form.platform === "gitlab") return {
|
|
441
|
+
...gitlabProject({
|
|
442
|
+
namespaceId: needed(form.namespaceId, "The namespace's ID"),
|
|
443
|
+
projectId: needed(form.projectId, "The project's ID"),
|
|
444
|
+
refType: form.refKind,
|
|
445
|
+
ref: needed(form.refName, form.refKind === "branch" ? "The branch" : "The tag"),
|
|
446
|
+
source: form.source
|
|
447
|
+
}),
|
|
448
|
+
issuer: form.gitlabUrl.trim() === "" ? null : form.gitlabUrl.trim()
|
|
449
|
+
};
|
|
450
|
+
const claims = { sub: needed(form.sub, "The subject") };
|
|
451
|
+
for (const line of form.extra.split("\n").map((each) => each.trim()).filter((each) => each !== "")) {
|
|
452
|
+
const at = line.indexOf("=");
|
|
453
|
+
if (at <= 0) throw new Error(`"${line}" is not <claim>=<value>`);
|
|
454
|
+
claims[line.slice(0, at).trim()] = line.slice(at + 1).trim();
|
|
455
|
+
}
|
|
456
|
+
return {
|
|
457
|
+
profile: "custom",
|
|
458
|
+
issuer: needed(form.issuer, "The issuer"),
|
|
459
|
+
claims
|
|
460
|
+
};
|
|
461
|
+
}
|
|
462
|
+
//#endregion
|
|
463
|
+
//#region src/components/trusted-workloads.tsx
|
|
464
|
+
/**
|
|
465
|
+
* The CI runs that may sign in as a service, by the ID token their platform
|
|
466
|
+
* signs for each run (docs/design/oidc.md). A run is trusted only when
|
|
467
|
+
* every claim of a binding matches exactly, so the claims are what the page
|
|
468
|
+
* shows, in full, before anything is saved.
|
|
469
|
+
*/
|
|
470
|
+
function TrustedWorkloads({ serviceId, bindings }) {
|
|
471
|
+
const change = removeBinding(useCoffre(), serviceId);
|
|
472
|
+
const remove = useChange(change);
|
|
473
|
+
const { status, dismiss } = useChangeStatus(change.list.queryKey);
|
|
474
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Card, {
|
|
475
|
+
labelledBy: "trusted-workloads",
|
|
476
|
+
title: "Trusted workloads",
|
|
477
|
+
description: "CI runs that may sign in as this service with the ID token their platform signs, when every claim of a binding matches. Nothing long-lived is stored.",
|
|
478
|
+
actions: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TrustWorkload, { serviceId }),
|
|
479
|
+
children: bindings.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EmptyState, {
|
|
480
|
+
title: "No trusted workloads",
|
|
481
|
+
children: "CI can still use a token. Trust a workflow to let its runs sign in without one."
|
|
482
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
483
|
+
className: "dt-wrap",
|
|
484
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("table", {
|
|
485
|
+
className: "dt",
|
|
486
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [
|
|
487
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "Workload" }),
|
|
488
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
489
|
+
className: "col-shrink",
|
|
490
|
+
children: "Added (UTC)"
|
|
491
|
+
}),
|
|
492
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
493
|
+
className: "col-shrink",
|
|
494
|
+
children: "Last used"
|
|
495
|
+
}),
|
|
496
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
497
|
+
className: "col-actions",
|
|
498
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
499
|
+
className: "visually-hidden",
|
|
500
|
+
children: "Actions"
|
|
501
|
+
})
|
|
502
|
+
})
|
|
503
|
+
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("tbody", { children: bindings.map((binding) => {
|
|
504
|
+
const state = status(binding.id);
|
|
505
|
+
const { title, detail } = summary(binding);
|
|
506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_react.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", {
|
|
507
|
+
className: rowClass(state),
|
|
508
|
+
children: [
|
|
509
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
510
|
+
className: "cell-account",
|
|
511
|
+
children: [binding.profile.startsWith("github") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(GitHub, { size: 15 }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, { size: 15 }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
512
|
+
className: "cell-stack",
|
|
513
|
+
children: [
|
|
514
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: binding.label ?? title }),
|
|
515
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("small", { children: binding.label === null ? detail : `${title} · ${detail}` }),
|
|
516
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", {
|
|
517
|
+
className: "claims",
|
|
518
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: "Claims" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Claims, { binding })]
|
|
519
|
+
})
|
|
520
|
+
]
|
|
521
|
+
})]
|
|
522
|
+
}) }),
|
|
523
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
524
|
+
className: "nowrap",
|
|
525
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
526
|
+
className: "cell-stack",
|
|
527
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, { iso: binding.createdAt }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("small", { children: ["by ", binding.createdBy] })]
|
|
528
|
+
})
|
|
529
|
+
}),
|
|
530
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
531
|
+
className: "nowrap cell-muted",
|
|
532
|
+
children: binding.lastUsedAt === null ? "Never" : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Timestamp, {
|
|
533
|
+
iso: binding.lastUsedAt,
|
|
534
|
+
display: "relative"
|
|
535
|
+
})
|
|
536
|
+
}),
|
|
537
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
538
|
+
className: "col-actions",
|
|
539
|
+
children: state.state === "pending" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowPending, { status: state }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ConfirmButton, {
|
|
540
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
541
|
+
className: "act",
|
|
542
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(X, { size: 13 }), "Remove"]
|
|
543
|
+
}),
|
|
544
|
+
title: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
545
|
+
"Stop trusting ",
|
|
546
|
+
binding.label ?? title,
|
|
547
|
+
"?"
|
|
548
|
+
] }),
|
|
549
|
+
body: "Its runs are refused from their next sign-in, and credentials they hold stop working. A binding removed is never trusted again; to trust the runs again, add a new one.",
|
|
550
|
+
confirmLabel: "Remove binding",
|
|
551
|
+
onConfirm: () => remove(binding)
|
|
552
|
+
})
|
|
553
|
+
})
|
|
554
|
+
]
|
|
555
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RowFailure, {
|
|
556
|
+
status: state,
|
|
557
|
+
columns: 4,
|
|
558
|
+
onDismiss: () => state.state === "failed" && dismiss(state.mutationId)
|
|
559
|
+
})] }, binding.id);
|
|
560
|
+
}) })]
|
|
561
|
+
})
|
|
562
|
+
})
|
|
563
|
+
});
|
|
564
|
+
}
|
|
565
|
+
function Claims({ binding }) {
|
|
566
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("table", {
|
|
567
|
+
className: "claims-table",
|
|
568
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tbody", { children: [
|
|
569
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "iss" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
570
|
+
className: "mono",
|
|
571
|
+
children: binding.issuer
|
|
572
|
+
})] }),
|
|
573
|
+
Object.entries(binding.claims).map(([name, value]) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", {
|
|
574
|
+
className: "mono",
|
|
575
|
+
children: name
|
|
576
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
577
|
+
className: "mono",
|
|
578
|
+
children: value
|
|
579
|
+
})] }, name)),
|
|
580
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("tr", { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("th", { children: "keys" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("td", {
|
|
581
|
+
className: "mono",
|
|
582
|
+
children: binding.jwksUri
|
|
583
|
+
})] })
|
|
584
|
+
] })
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
function TrustWorkload({ serviceId }) {
|
|
588
|
+
const [open, setOpen] = (0, import_react.useState)(false);
|
|
589
|
+
const [form, setForm] = (0, import_react.useState)(EMPTY_FORM);
|
|
590
|
+
const [plan, setPlan] = (0, import_react.useState)(null);
|
|
591
|
+
const coffre = useCoffre();
|
|
592
|
+
const member = memberRef("service", serviceId);
|
|
593
|
+
const { pending, error, setError, run } = useAction();
|
|
594
|
+
const lookup = useAction();
|
|
595
|
+
const set = (changes) => {
|
|
596
|
+
setForm((current) => ({
|
|
597
|
+
...current,
|
|
598
|
+
...changes
|
|
599
|
+
}));
|
|
600
|
+
setPlan(null);
|
|
601
|
+
};
|
|
602
|
+
const input = () => ({
|
|
603
|
+
...bindingOf(form),
|
|
604
|
+
label: form.label.trim() === "" ? null : form.label.trim(),
|
|
605
|
+
replaces: []
|
|
606
|
+
});
|
|
607
|
+
function close() {
|
|
608
|
+
setOpen(false);
|
|
609
|
+
setForm(EMPTY_FORM);
|
|
610
|
+
setPlan(null);
|
|
611
|
+
setError(null);
|
|
612
|
+
lookup.setError(null);
|
|
613
|
+
}
|
|
614
|
+
function review() {
|
|
615
|
+
let request;
|
|
616
|
+
try {
|
|
617
|
+
request = input();
|
|
618
|
+
} catch (problem) {
|
|
619
|
+
setError(problem.message);
|
|
620
|
+
return;
|
|
621
|
+
}
|
|
622
|
+
run(() => coffre.bindings.preview(member, request), {
|
|
623
|
+
affects: [],
|
|
624
|
+
onSuccess: setPlan
|
|
625
|
+
});
|
|
626
|
+
}
|
|
627
|
+
const field = (label, key, props = {}) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
628
|
+
className: "field",
|
|
629
|
+
children: [
|
|
630
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
631
|
+
className: "label",
|
|
632
|
+
children: label
|
|
633
|
+
}),
|
|
634
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
635
|
+
className: `input${props.mono ? " mono" : ""}`,
|
|
636
|
+
value: form[key],
|
|
637
|
+
placeholder: props.placeholder,
|
|
638
|
+
onChange: (event) => set({ [key]: event.target.value })
|
|
639
|
+
}),
|
|
640
|
+
props.hint !== void 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
641
|
+
className: "hint",
|
|
642
|
+
children: props.hint
|
|
643
|
+
})
|
|
644
|
+
]
|
|
645
|
+
});
|
|
646
|
+
const ref = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
647
|
+
className: "form-row",
|
|
648
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
649
|
+
className: "field",
|
|
650
|
+
style: { flex: "0 0 8rem" },
|
|
651
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
652
|
+
className: "label",
|
|
653
|
+
children: "At"
|
|
654
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", {
|
|
655
|
+
className: "select",
|
|
656
|
+
value: form.refKind,
|
|
657
|
+
onChange: (event) => set({ refKind: event.target.value }),
|
|
658
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
659
|
+
value: "branch",
|
|
660
|
+
children: "Branch"
|
|
661
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
662
|
+
value: "tag",
|
|
663
|
+
children: "Tag"
|
|
664
|
+
})]
|
|
665
|
+
})]
|
|
666
|
+
}), field(form.refKind === "branch" ? "Branch" : "Tag", "refName", { mono: true })]
|
|
667
|
+
});
|
|
668
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
669
|
+
className: "btn btn-sm",
|
|
670
|
+
onClick: () => setOpen(true),
|
|
671
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Plus, { size: 14 }), "Trust a workload"]
|
|
672
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Modal, {
|
|
673
|
+
open,
|
|
674
|
+
onOpenChange: (next) => next ? setOpen(true) : close(),
|
|
675
|
+
title: plan === null ? "Trust a workload" : "Review the binding",
|
|
676
|
+
children: plan === null ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", {
|
|
677
|
+
className: "form",
|
|
678
|
+
onSubmit: (event) => {
|
|
679
|
+
event.preventDefault();
|
|
680
|
+
review();
|
|
681
|
+
},
|
|
682
|
+
children: [
|
|
683
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", {
|
|
684
|
+
className: "segmented",
|
|
685
|
+
"aria-label": "Platform",
|
|
686
|
+
children: [
|
|
687
|
+
"github",
|
|
688
|
+
"gitlab",
|
|
689
|
+
"other"
|
|
690
|
+
].map((platform) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
691
|
+
type: "button",
|
|
692
|
+
"aria-pressed": form.platform === platform,
|
|
693
|
+
onClick: () => set({ platform }),
|
|
694
|
+
children: platform === "github" ? "GitHub Actions" : platform === "gitlab" ? "GitLab" : "Other issuer"
|
|
695
|
+
}, platform))
|
|
696
|
+
}),
|
|
697
|
+
form.platform === "github" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
698
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("nav", {
|
|
699
|
+
className: "segmented",
|
|
700
|
+
"aria-label": "Workflow",
|
|
701
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
702
|
+
type: "button",
|
|
703
|
+
"aria-pressed": !form.reusable,
|
|
704
|
+
onClick: () => set({ reusable: false }),
|
|
705
|
+
children: "A workflow of the repository"
|
|
706
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
707
|
+
type: "button",
|
|
708
|
+
"aria-pressed": form.reusable,
|
|
709
|
+
onClick: () => set({ reusable: true }),
|
|
710
|
+
children: "A reusable workflow"
|
|
711
|
+
})]
|
|
712
|
+
}),
|
|
713
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
714
|
+
className: "form-row",
|
|
715
|
+
children: [field("Repository", "repository", {
|
|
716
|
+
placeholder: "acme/api",
|
|
717
|
+
mono: true
|
|
718
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
719
|
+
className: "field",
|
|
720
|
+
style: {
|
|
721
|
+
flex: "0 0 auto",
|
|
722
|
+
alignSelf: "end"
|
|
723
|
+
},
|
|
724
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
725
|
+
className: "btn",
|
|
726
|
+
type: "button",
|
|
727
|
+
disabled: lookup.pending || form.repository.trim() === "",
|
|
728
|
+
onClick: () => void lookup.run(() => coffre.bindings.lookup({ github: form.repository.trim() }), {
|
|
729
|
+
affects: [],
|
|
730
|
+
onSuccess: (ids) => "repositoryId" in ids && set({
|
|
731
|
+
repositoryId: ids.repositoryId,
|
|
732
|
+
ownerId: ids.ownerId
|
|
733
|
+
})
|
|
734
|
+
}),
|
|
735
|
+
children: [lookup.pending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}), "Look up IDs"]
|
|
736
|
+
})
|
|
737
|
+
})]
|
|
738
|
+
}),
|
|
739
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
740
|
+
className: "form-row",
|
|
741
|
+
children: [!(form.reusable && form.anyRepository) && field("Repository ID", "repositoryId", { mono: true }), field("Owner ID", "ownerId", { mono: true })]
|
|
742
|
+
}),
|
|
743
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", {
|
|
744
|
+
className: "hint",
|
|
745
|
+
children: [
|
|
746
|
+
"Bindings name IDs, which unlike names nobody else can take over. For a private repository:",
|
|
747
|
+
" ",
|
|
748
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
749
|
+
className: "mono",
|
|
750
|
+
children: [
|
|
751
|
+
"gh api repos/",
|
|
752
|
+
form.repository.trim() || "acme/api",
|
|
753
|
+
" --jq '.id, .owner.id'"
|
|
754
|
+
]
|
|
755
|
+
})
|
|
756
|
+
]
|
|
757
|
+
}),
|
|
758
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error: lookup.error }),
|
|
759
|
+
form.reusable ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
760
|
+
field("Called workflow", "called", {
|
|
761
|
+
placeholder: "acme/deploy/.github/workflows/release.yml@refs/heads/main",
|
|
762
|
+
mono: true
|
|
763
|
+
}),
|
|
764
|
+
field("Its commit", "sha", {
|
|
765
|
+
placeholder: "the full SHA it is trusted at",
|
|
766
|
+
mono: true,
|
|
767
|
+
hint: "A new version of the workflow needs a new binding."
|
|
768
|
+
}),
|
|
769
|
+
field("Calling workflow (optional)", "workflow", {
|
|
770
|
+
placeholder: "deploy.yml",
|
|
771
|
+
mono: true,
|
|
772
|
+
hint: "Left out, every workflow of the repository at the ref below may call it."
|
|
773
|
+
}),
|
|
774
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
775
|
+
className: "check",
|
|
776
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", {
|
|
777
|
+
type: "checkbox",
|
|
778
|
+
checked: form.anyRepository,
|
|
779
|
+
onChange: (event) => set({ anyRepository: event.target.checked })
|
|
780
|
+
}), "Called from any repository of the organization"]
|
|
781
|
+
})
|
|
782
|
+
] }) : field("Workflow file", "workflow", {
|
|
783
|
+
placeholder: "deploy.yml",
|
|
784
|
+
mono: true
|
|
785
|
+
}),
|
|
786
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
787
|
+
className: "field",
|
|
788
|
+
children: [
|
|
789
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
790
|
+
className: "label",
|
|
791
|
+
children: "Event"
|
|
792
|
+
}),
|
|
793
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("select", {
|
|
794
|
+
className: "select",
|
|
795
|
+
value: form.event,
|
|
796
|
+
onChange: (event) => set({ event: event.target.value }),
|
|
797
|
+
children: GITHUB_EVENTS.map((event) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
798
|
+
value: event,
|
|
799
|
+
children: event
|
|
800
|
+
}, event))
|
|
801
|
+
}),
|
|
802
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
803
|
+
className: "hint",
|
|
804
|
+
children: "Pull requests and workflow_run are never trusted: their runs can carry a stranger's code."
|
|
805
|
+
})
|
|
806
|
+
]
|
|
807
|
+
}),
|
|
808
|
+
ref
|
|
809
|
+
] }),
|
|
810
|
+
form.platform === "gitlab" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
811
|
+
field("GitLab", "gitlabUrl", {
|
|
812
|
+
placeholder: "https://gitlab.com",
|
|
813
|
+
hint: "Left empty, gitlab.com."
|
|
814
|
+
}),
|
|
815
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
816
|
+
className: "form-row",
|
|
817
|
+
children: [field("Project", "project", {
|
|
818
|
+
placeholder: "acme/api",
|
|
819
|
+
mono: true
|
|
820
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
821
|
+
className: "field",
|
|
822
|
+
style: {
|
|
823
|
+
flex: "0 0 auto",
|
|
824
|
+
alignSelf: "end"
|
|
825
|
+
},
|
|
826
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
827
|
+
className: "btn",
|
|
828
|
+
type: "button",
|
|
829
|
+
disabled: lookup.pending || form.project.trim() === "",
|
|
830
|
+
onClick: () => void lookup.run(() => coffre.bindings.lookup({
|
|
831
|
+
gitlab: form.project.trim(),
|
|
832
|
+
...form.gitlabUrl.trim() === "" ? {} : { gitlabUrl: form.gitlabUrl.trim() }
|
|
833
|
+
}), {
|
|
834
|
+
affects: [],
|
|
835
|
+
onSuccess: (ids) => "projectId" in ids && set({
|
|
836
|
+
projectId: ids.projectId,
|
|
837
|
+
namespaceId: ids.namespaceId
|
|
838
|
+
})
|
|
839
|
+
}),
|
|
840
|
+
children: [lookup.pending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}), "Look up IDs"]
|
|
841
|
+
})
|
|
842
|
+
})]
|
|
843
|
+
}),
|
|
844
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
845
|
+
className: "form-row",
|
|
846
|
+
children: [field("Project ID", "projectId", { mono: true }), field("Namespace ID", "namespaceId", { mono: true })]
|
|
847
|
+
}),
|
|
848
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error: lookup.error }),
|
|
849
|
+
ref,
|
|
850
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
851
|
+
className: "field",
|
|
852
|
+
children: [
|
|
853
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
854
|
+
className: "label",
|
|
855
|
+
children: "Pipeline source"
|
|
856
|
+
}),
|
|
857
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("select", {
|
|
858
|
+
className: "select",
|
|
859
|
+
value: form.source,
|
|
860
|
+
onChange: (event) => set({ source: event.target.value }),
|
|
861
|
+
children: GITLAB_PIPELINE_SOURCES.map((source) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", {
|
|
862
|
+
value: source,
|
|
863
|
+
children: source
|
|
864
|
+
}, source))
|
|
865
|
+
}),
|
|
866
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
867
|
+
className: "hint",
|
|
868
|
+
children: "Merge-request pipelines are never trusted: they name another project."
|
|
869
|
+
})
|
|
870
|
+
]
|
|
871
|
+
})
|
|
872
|
+
] }),
|
|
873
|
+
form.platform === "other" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
874
|
+
field("Issuer", "issuer", { placeholder: "https://accounts.google.com" }),
|
|
875
|
+
field("Subject (sub)", "sub", {
|
|
876
|
+
mono: true,
|
|
877
|
+
hint: "You vouch for what this issuer's subject means: a Google service account's unique ID, say."
|
|
878
|
+
}),
|
|
879
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", {
|
|
880
|
+
className: "field",
|
|
881
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", {
|
|
882
|
+
className: "label",
|
|
883
|
+
children: [
|
|
884
|
+
"Other claims, one ",
|
|
885
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
886
|
+
className: "mono",
|
|
887
|
+
children: "name=value"
|
|
888
|
+
}),
|
|
889
|
+
" a line"
|
|
890
|
+
]
|
|
891
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("textarea", {
|
|
892
|
+
className: "input mono",
|
|
893
|
+
rows: 3,
|
|
894
|
+
value: form.extra,
|
|
895
|
+
onChange: (event) => set({ extra: event.target.value })
|
|
896
|
+
})]
|
|
897
|
+
})
|
|
898
|
+
] }),
|
|
899
|
+
field("Label (optional)", "label", { placeholder: "Deploys to production" }),
|
|
900
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error }),
|
|
901
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
902
|
+
className: "dialog-actions",
|
|
903
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
904
|
+
className: "btn",
|
|
905
|
+
type: "button",
|
|
906
|
+
onClick: close,
|
|
907
|
+
children: "Cancel"
|
|
908
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
909
|
+
className: "btn btn-primary",
|
|
910
|
+
type: "submit",
|
|
911
|
+
disabled: pending,
|
|
912
|
+
children: [pending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}), "Review"]
|
|
913
|
+
})]
|
|
914
|
+
})
|
|
915
|
+
]
|
|
916
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
917
|
+
className: "form",
|
|
918
|
+
children: [
|
|
919
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { children: [
|
|
920
|
+
"Runs whose ID token carries exactly these claims will sign in as ",
|
|
921
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
922
|
+
className: "mono",
|
|
923
|
+
children: member
|
|
924
|
+
}),
|
|
925
|
+
", and read what it may read."
|
|
926
|
+
] }),
|
|
927
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Claims, { binding: plan }),
|
|
928
|
+
plan.replaces.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Notice, {
|
|
929
|
+
tone: "info",
|
|
930
|
+
children: [
|
|
931
|
+
"This replaces ",
|
|
932
|
+
plan.replaces.length === 1 ? "a binding" : `${plan.replaces.length} bindings`,
|
|
933
|
+
plan.replaces.some((replaced) => replaced.why === "keys_moved") ? ", since the issuer moved its keys" : "",
|
|
934
|
+
"."
|
|
935
|
+
]
|
|
936
|
+
}),
|
|
937
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorLine, { error }),
|
|
938
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
939
|
+
className: "dialog-actions",
|
|
940
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
941
|
+
className: "btn",
|
|
942
|
+
type: "button",
|
|
943
|
+
onClick: () => setPlan(null),
|
|
944
|
+
children: "Back"
|
|
945
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("button", {
|
|
946
|
+
className: "btn btn-primary",
|
|
947
|
+
type: "button",
|
|
948
|
+
disabled: pending,
|
|
949
|
+
onClick: () => void run(() => coffre.bindings.create(member, input()), {
|
|
950
|
+
affects: affects.bindings(member),
|
|
951
|
+
onSuccess: close
|
|
952
|
+
}),
|
|
953
|
+
children: [pending && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Spinner, {}), "Save binding"]
|
|
954
|
+
})]
|
|
955
|
+
})
|
|
956
|
+
]
|
|
957
|
+
})
|
|
958
|
+
})] });
|
|
959
|
+
}
|
|
960
|
+
//#endregion
|
|
961
|
+
//#region src/routes/tokens.$token.tsx?tsr-split=component
|
|
962
|
+
function TokenPage() {
|
|
963
|
+
const { token } = Route.useParams();
|
|
964
|
+
const client = useCoffre();
|
|
965
|
+
const { auth, capabilities } = useShell();
|
|
966
|
+
const member = memberRef("service", token);
|
|
967
|
+
const owner = capabilities.canManageGrants;
|
|
968
|
+
const { data: report } = useSuspenseQuery(queries.report(client, member, owner));
|
|
969
|
+
const { data: credentials } = useSuspenseQuery(queries.credentials(client, member, owner && auth.signin !== null));
|
|
970
|
+
const { data: bindings } = useSuspenseQuery(queries.bindings(client, member, owner && auth.signin !== null));
|
|
971
|
+
const active = report?.ok === true && report.report?.status === "active";
|
|
972
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
973
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(PrincipalPage, {
|
|
974
|
+
principalType: "service",
|
|
975
|
+
principalId: token
|
|
976
|
+
}),
|
|
977
|
+
active && credentials?.ok === true && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ServiceTokens, {
|
|
978
|
+
serviceId: token,
|
|
979
|
+
tokens: credentials.tokens
|
|
980
|
+
}),
|
|
981
|
+
active && bindings?.ok === true && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TrustedWorkloads, {
|
|
982
|
+
serviceId: token,
|
|
983
|
+
bindings: bindings.bindings
|
|
984
|
+
})
|
|
985
|
+
] });
|
|
986
|
+
}
|
|
987
|
+
//#endregion
|
|
988
|
+
export { TokenPage as component };
|