@coffre/ui 0.6.1 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/{audit-sentence-CUUMshIp.js → audit-sentence-C1_gRxWW.js} +91 -26
- package/dist/chunks/audit-sentence-C1_gRxWW.js.map +1 -0
- package/dist/chunks/{connected-apps-DTpatjge.js → connected-apps-Bn5rEoV2.js} +4 -4
- package/dist/chunks/{connected-apps-DTpatjge.js.map → connected-apps-Bn5rEoV2.js.map} +1 -1
- package/dist/chunks/{delete-place-SOOYVt6A.js → delete-place-CQCDHkne.js} +4 -4
- package/dist/chunks/{delete-place-SOOYVt6A.js.map → delete-place-CQCDHkne.js.map} +1 -1
- package/dist/chunks/{directory-DrtdKny2.js → directory-BQNOdze_.js} +22 -19
- package/dist/chunks/directory-BQNOdze_.js.map +1 -0
- package/dist/chunks/{folders-hR2Lnk0k.js → folders-Dw240WMJ.js} +2 -2
- package/dist/chunks/{folders-hR2Lnk0k.js.map → folders-Dw240WMJ.js.map} +1 -1
- package/dist/chunks/{grants-DDBui9YD.js → grants-CJIBrkod.js} +5 -5
- package/dist/chunks/{grants-DDBui9YD.js.map → grants-CJIBrkod.js.map} +1 -1
- package/dist/chunks/multi-combobox-CsIXihuc.js +99 -0
- package/dist/chunks/multi-combobox-CsIXihuc.js.map +1 -0
- package/dist/chunks/{offboarding-C7ECW5o0.js → offboarding-CrgwaetA.js} +4 -4
- package/dist/chunks/offboarding-CrgwaetA.js.map +1 -0
- package/dist/chunks/personal-tokens-B8rkT-DI.js +138 -0
- package/dist/chunks/personal-tokens-B8rkT-DI.js.map +1 -0
- package/dist/chunks/{principal-page-CB6dAABC.js → principal-page-DDmmV1KQ.js} +37 -27
- package/dist/chunks/principal-page-DDmmV1KQ.js.map +1 -0
- package/dist/chunks/{project-page-BHNUvr2L.js → project-page-BI--vjt3.js} +2 -2
- package/dist/chunks/{project-page-BHNUvr2L.js.map → project-page-BI--vjt3.js.map} +1 -1
- package/dist/chunks/{queries-DgQo3mC-.js → queries-epz4MIuW.js} +103 -18
- package/dist/chunks/queries-epz4MIuW.js.map +1 -0
- package/dist/chunks/{references-BQc35Q9g.js → references-DImfw0cz.js} +4 -4
- package/dist/chunks/{references-BQc35Q9g.js.map → references-DImfw0cz.js.map} +1 -1
- package/dist/chunks/{role-field-BfWRCqzl.js → role-field-C1KhNaIR.js} +2 -2
- package/dist/chunks/{role-field-BfWRCqzl.js.map → role-field-C1KhNaIR.js.map} +1 -1
- package/dist/chunks/{row-state-Zf3kZVhd.js → row-state-BsIHspy4.js} +2 -2
- package/dist/chunks/{row-state-Zf3kZVhd.js.map → row-state-BsIHspy4.js.map} +1 -1
- package/dist/chunks/{theme-B6-V9JvY.js → theme-3b4DnCow.js} +2 -2
- package/dist/chunks/{theme-B6-V9JvY.js.map → theme-3b4DnCow.js.map} +1 -1
- package/dist/chunks/{ui-Br-dNUTc.js → ui-2kwXXfrX.js} +95 -22
- package/dist/chunks/ui-2kwXXfrX.js.map +1 -0
- package/dist/chunks/{use-action-DthL5hL8.js → use-action-BB-RcHo1.js} +2 -2
- package/dist/chunks/{use-action-DthL5hL8.js.map → use-action-BB-RcHo1.js.map} +1 -1
- package/dist/chunks/{use-change-By4cG8bT.js → use-change-CQyDpCqw.js} +323 -31
- package/dist/chunks/use-change-CQyDpCqw.js.map +1 -0
- package/dist/chunks/{use-shell-D6kjSPls.js → use-shell-C_NmvCt_.js} +2 -2
- package/dist/chunks/{use-shell-D6kjSPls.js.map → use-shell-C_NmvCt_.js.map} +1 -1
- package/dist/index.d.ts +46 -164
- package/dist/index.js +143 -129
- package/dist/index.js.map +1 -1
- package/dist/pages/account.d.ts +1 -1
- package/dist/pages/account.js +29 -12
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/approval.js +1 -1
- package/dist/pages/audit.js +96 -90
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +1 -1
- package/dist/pages/environment.js +949 -412
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +2 -2
- package/dist/pages/oauth-authorize.js +1 -1
- package/dist/pages/project-access.js +9 -9
- package/dist/pages/project-access.js.map +1 -1
- package/dist/pages/project-environments.js +112 -64
- package/dist/pages/project-environments.js.map +1 -1
- package/dist/pages/project-settings.d.ts +1 -1
- package/dist/pages/project-settings.js +54 -75
- package/dist/pages/project-settings.js.map +1 -1
- package/dist/pages/project.js +3 -7
- package/dist/pages/project.js.map +1 -1
- package/dist/pages/projects.js +50 -77
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.js +284 -160
- package/dist/pages/service-account.js.map +1 -1
- package/dist/pages/service-accounts.js +4 -4
- package/dist/pages/settings.js +5 -5
- package/dist/pages/unregistered.js +1 -1
- package/dist/pages/user.js +5 -5
- package/dist/pages/users.js +4 -4
- package/package.json +3 -3
- package/src/components/actions-log.tsx +3 -2
- package/src/components/command-palette.tsx +4 -5
- package/src/components/directory.tsx +7 -14
- package/src/components/generate-value.tsx +15 -7
- package/src/components/missing.tsx +63 -67
- package/src/components/offboarding.tsx +1 -1
- package/src/components/personal-tokens.tsx +131 -0
- package/src/components/principal-page.tsx +30 -17
- package/src/components/regenerate.tsx +72 -0
- package/src/components/service-tokens.tsx +5 -14
- package/src/components/shell.tsx +79 -75
- package/src/components/trusted-workloads.tsx +179 -19
- package/src/components/ui.tsx +35 -25
- package/src/lib/audit-sentences.ts +100 -12
- package/src/lib/bindings.ts +41 -3
- package/src/lib/changes.ts +215 -29
- package/src/lib/clipboard.ts +40 -0
- package/src/lib/copy-attempts.ts +103 -0
- package/src/lib/dismissal.ts +24 -0
- package/src/lib/generate.ts +3 -146
- package/src/lib/optimistic.ts +3 -1
- package/src/lib/queries.ts +121 -17
- package/src/lib/recipes.ts +63 -0
- package/src/lib/reveal.ts +7 -1
- package/src/lib/row-reads.ts +64 -0
- package/src/lib/secret-edit-batch.ts +64 -5
- package/src/options.ts +43 -51
- package/src/pages/account.tsx +27 -5
- package/src/pages/audit.tsx +38 -31
- package/src/pages/environment.tsx +655 -121
- package/src/pages/project-access.tsx +1 -1
- package/src/pages/project-environments.tsx +92 -45
- package/src/pages/project-settings.tsx +9 -20
- package/src/pages/project.tsx +1 -5
- package/src/pages/projects.tsx +13 -28
- package/src/parity.ts +20 -4
- package/src/styles/globals.css +143 -131
- package/dist/chunks/audit-sentence-CUUMshIp.js.map +0 -1
- package/dist/chunks/directory-DrtdKny2.js.map +0 -1
- package/dist/chunks/offboarding-C7ECW5o0.js.map +0 -1
- package/dist/chunks/principal-page-CB6dAABC.js.map +0 -1
- package/dist/chunks/project-environments-lEzFHUt4.js +0 -11
- package/dist/chunks/project-environments-lEzFHUt4.js.map +0 -1
- package/dist/chunks/queries-DgQo3mC-.js.map +0 -1
- package/dist/chunks/ui-Br-dNUTc.js.map +0 -1
- package/dist/chunks/use-change-By4cG8bT.js.map +0 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { a as
|
|
5
|
-
import { t as useShell } from "../chunks/use-shell-
|
|
6
|
-
import {
|
|
1
|
+
import { a as listsAccess, t as affects, v as queries, x as signInWays } from "../chunks/queries-epz4MIuW.js";
|
|
2
|
+
import { a as ErrorLine, c as Notice, i as EmptyState, l as Spinner, r as CopyButton, s as Modal, t as ConfirmButton, u as Timestamp, x as usePreferences } from "../chunks/ui-2kwXXfrX.js";
|
|
3
|
+
import { F as Link, G as Plus, M as Key, O as GitHub, c as statusOf, s as memberRef, st as X, t as Card, u as useCoffre, v as CheckCircle } from "../chunks/page-JTORvh-N.js";
|
|
4
|
+
import { a as rowClass, i as RowPending, r as RowFailure } from "../chunks/row-state-BsIHspy4.js";
|
|
5
|
+
import { t as useShell } from "../chunks/use-shell-C_NmvCt_.js";
|
|
6
|
+
import { A as revokeCredential, T as removeBinding, n as useChangeStatus, t as useChange } from "../chunks/use-change-CQyDpCqw.js";
|
|
7
7
|
import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
|
|
8
|
-
import { t as useAction } from "../chunks/use-action-
|
|
9
|
-
import {
|
|
8
|
+
import { t as useAction } from "../chunks/use-action-BB-RcHo1.js";
|
|
9
|
+
import { t as MultiCombobox } from "../chunks/multi-combobox-CsIXihuc.js";
|
|
10
|
+
import { n as PrincipalLayout, r as ActionsLog, t as PrincipalAccess } from "../chunks/principal-page-DDmmV1KQ.js";
|
|
10
11
|
import { Fragment, useEffect, useId, useState } from "react";
|
|
11
12
|
import { ROLES, ROLE_NAMES, assignableToEnvironment, credentialScopeInWords } from "@coffre/core/access";
|
|
12
13
|
import { Autocomplete } from "@base-ui/react/autocomplete";
|
|
@@ -14,7 +15,6 @@ import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
|
14
15
|
import { useQuery, useSuspenseQuery } from "@tanstack/react-query";
|
|
15
16
|
import { CoffreError } from "@coffre/client";
|
|
16
17
|
import { EVENT_EXPOSURE, GITLAB_PIPELINE_SOURCES, claimValues, fullRef, githubEventsAt, githubReusable, githubWorkflow, gitlabProject } from "@coffre/core/workloads";
|
|
17
|
-
import { Combobox } from "@base-ui/react/combobox";
|
|
18
18
|
//#region src/components/scope-picker.tsx
|
|
19
19
|
var pathOf = (grant) => grant.environment === null ? grant.project : `${grant.project}/${grant.environment}`;
|
|
20
20
|
/** Everything the account holds, each grant as it is: what a new token or binding reaches unless narrowed. */
|
|
@@ -97,25 +97,13 @@ var LIFETIMES = [
|
|
|
97
97
|
* one place, this dialog, for as long as it stays open: coffre keeps a hash.
|
|
98
98
|
*/
|
|
99
99
|
function ServiceTokens({ serviceId, tokens, grants }) {
|
|
100
|
-
const change = revokeCredential(useCoffre(), serviceId);
|
|
100
|
+
const change = revokeCredential(useCoffre(), memberRef("service", serviceId));
|
|
101
101
|
const revoke = useChange(change);
|
|
102
102
|
const { status, dismiss } = useChangeStatus(change.list.queryKey);
|
|
103
103
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Card, {
|
|
104
104
|
labelledBy: "service-tokens",
|
|
105
105
|
title: "Bearer tokens",
|
|
106
|
-
|
|
107
|
-
"A long-lived secret, for CI that can't use OIDC. For example, a cron job on your own server runs",
|
|
108
|
-
" ",
|
|
109
|
-
/* @__PURE__ */ jsx("span", {
|
|
110
|
-
className: "mono nowrap",
|
|
111
|
-
children: "coffre login <url> --token"
|
|
112
|
-
}),
|
|
113
|
-
" with one. coffre shows it once."
|
|
114
|
-
] }),
|
|
115
|
-
children: tokens.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
116
|
-
title: "No bearer tokens",
|
|
117
|
-
children: "CI that signs in with OIDC needs none."
|
|
118
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
106
|
+
children: tokens.length === 0 ? /* @__PURE__ */ jsx(EmptyState, { title: "No bearer tokens" }) : /* @__PURE__ */ jsx("div", {
|
|
119
107
|
className: "dt-wrap",
|
|
120
108
|
children: /* @__PURE__ */ jsxs("table", {
|
|
121
109
|
className: "dt",
|
|
@@ -406,10 +394,18 @@ function summary(binding) {
|
|
|
406
394
|
detail: `${claimValues(binding.claims.pipeline_source).join(", ")} at ${claims.ref_type} ${claims.ref}`
|
|
407
395
|
};
|
|
408
396
|
return {
|
|
409
|
-
title:
|
|
397
|
+
title: issuerName(binding.issuer),
|
|
410
398
|
detail: `sub ${claims.sub}`
|
|
411
399
|
};
|
|
412
400
|
}
|
|
401
|
+
/** An issuer as a title: its host, when it is a URL; a binding that carries its keys may name any string. */
|
|
402
|
+
function issuerName(issuer) {
|
|
403
|
+
try {
|
|
404
|
+
return new URL(issuer).host || issuer;
|
|
405
|
+
} catch {
|
|
406
|
+
return issuer;
|
|
407
|
+
}
|
|
408
|
+
}
|
|
413
409
|
/** The scope the dialog asks for: the person's, or none, for the server's own. */
|
|
414
410
|
function askedScope(choice) {
|
|
415
411
|
return choice.chosen ? { scope: choice.scope } : {};
|
|
@@ -445,7 +441,8 @@ var EMPTY_FORM = {
|
|
|
445
441
|
sources: ["push"],
|
|
446
442
|
issuer: "",
|
|
447
443
|
sub: "",
|
|
448
|
-
extra: ""
|
|
444
|
+
extra: "",
|
|
445
|
+
jwks: ""
|
|
449
446
|
};
|
|
450
447
|
/** What a GitHub App's listing tells of names' IDs: each repository's, and its owner's, once each. */
|
|
451
448
|
function listedIds(repositories) {
|
|
@@ -608,12 +605,32 @@ function bindingOf(form, found = null) {
|
|
|
608
605
|
if (at <= 0) throw new Error(`"${line}" is not <claim>=<value>`);
|
|
609
606
|
claims[line.slice(0, at).trim()] = line.slice(at + 1).trim();
|
|
610
607
|
}
|
|
608
|
+
const jwks = keySetOf(form.jwks);
|
|
611
609
|
return {
|
|
612
610
|
profile: "custom",
|
|
613
611
|
issuer: needed(form.issuer, "The issuer"),
|
|
614
|
-
claims
|
|
612
|
+
claims,
|
|
613
|
+
...jwks === void 0 ? {} : { jwks }
|
|
615
614
|
};
|
|
616
615
|
}
|
|
616
|
+
/** The key set pasted in a field, or undefined for none; throws a sentence when it is not one. */
|
|
617
|
+
function keySetOf(text) {
|
|
618
|
+
if (text.trim() === "") return void 0;
|
|
619
|
+
let value;
|
|
620
|
+
try {
|
|
621
|
+
value = JSON.parse(text);
|
|
622
|
+
} catch {
|
|
623
|
+
throw new Error("The keys are not JSON: paste the issuer's key set, { \"keys\": [ … ] }");
|
|
624
|
+
}
|
|
625
|
+
const keys = value?.keys;
|
|
626
|
+
if (!Array.isArray(keys)) throw new Error("The keys are a key set, { \"keys\": [ … ] }, as kubectl get --raw /openid/v1/jwks prints it");
|
|
627
|
+
return { keys };
|
|
628
|
+
}
|
|
629
|
+
/** Where a binding's keys come from, in a line: the URL coffre fetches, or the keys uploaded with it, by `kid` or thumbprint. */
|
|
630
|
+
function keysOf(binding) {
|
|
631
|
+
if (binding.keys === null) return binding.jwksUri;
|
|
632
|
+
return `Uploaded: ${binding.keys.map((key) => `${key.kid ?? key.thumbprint} (${key.alg})`).join(", ")}`;
|
|
633
|
+
}
|
|
617
634
|
/**
|
|
618
635
|
* A GitHub repository's or owner's IDs, looked up through coffre once its
|
|
619
636
|
* name has rested in the field for `LOOKUP_PAUSE_MS`, or at once when the
|
|
@@ -745,97 +762,6 @@ function GitHubPicker({ label, value, onChange, onPick, onBlur, options, placeho
|
|
|
745
762
|
});
|
|
746
763
|
}
|
|
747
764
|
//#endregion
|
|
748
|
-
//#region src/components/multi-combobox.tsx
|
|
749
|
-
/**
|
|
750
|
-
* Several of a fixed list, chosen by typing: each chosen one a chip in the
|
|
751
|
-
* field, the rest offered below as the text filters them. Base UI's
|
|
752
|
-
* combobox does the keyboard and ARIA: arrows move through the options,
|
|
753
|
-
* Enter takes one, Backspace in an empty field removes the last chip, and
|
|
754
|
-
* Left Arrow from the start of the field walks the chips.
|
|
755
|
-
*
|
|
756
|
-
* The value keeps the options' order, whatever order they were chosen in.
|
|
757
|
-
*/
|
|
758
|
-
function MultiCombobox({ label, options, value, onChange, placeholder, hint, note, mono = false }) {
|
|
759
|
-
const { portal } = usePreferences();
|
|
760
|
-
const id = useId();
|
|
761
|
-
const labelId = useId();
|
|
762
|
-
const hintId = useId();
|
|
763
|
-
return /* @__PURE__ */ jsxs(Combobox.Root, {
|
|
764
|
-
items: options,
|
|
765
|
-
multiple: true,
|
|
766
|
-
value,
|
|
767
|
-
onValueChange: (next) => onChange(options.filter((option) => next.includes(option))),
|
|
768
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
769
|
-
className: "field",
|
|
770
|
-
children: [
|
|
771
|
-
/* @__PURE__ */ jsx("label", {
|
|
772
|
-
className: "label",
|
|
773
|
-
htmlFor: id,
|
|
774
|
-
id: labelId,
|
|
775
|
-
children: label
|
|
776
|
-
}),
|
|
777
|
-
/* @__PURE__ */ jsx(Combobox.InputGroup, {
|
|
778
|
-
className: `combo${mono ? " combo-mono" : ""}`,
|
|
779
|
-
children: /* @__PURE__ */ jsxs(Combobox.Chips, {
|
|
780
|
-
className: "combo-chips",
|
|
781
|
-
"aria-label": value.length > 0 ? "Chosen" : void 0,
|
|
782
|
-
children: [value.map((option) => /* @__PURE__ */ jsxs(Combobox.Chip, {
|
|
783
|
-
className: "combo-chip",
|
|
784
|
-
"aria-label": option,
|
|
785
|
-
"aria-description": "Press Backspace or Delete to remove",
|
|
786
|
-
children: [option, /* @__PURE__ */ jsx(Combobox.ChipRemove, {
|
|
787
|
-
className: "combo-chip-remove",
|
|
788
|
-
"aria-label": `Remove ${option}`,
|
|
789
|
-
children: /* @__PURE__ */ jsx(X, { size: 12 })
|
|
790
|
-
})]
|
|
791
|
-
}, option)), /* @__PURE__ */ jsx(Combobox.Input, {
|
|
792
|
-
id,
|
|
793
|
-
"aria-labelledby": labelId,
|
|
794
|
-
className: "combo-input",
|
|
795
|
-
placeholder: value.length > 0 ? void 0 : placeholder,
|
|
796
|
-
"aria-describedby": hint === void 0 ? void 0 : hintId,
|
|
797
|
-
"aria-description": value.length > 0 ? `${value.length} chosen. From the start of the field, press Left Arrow to reach them` : void 0
|
|
798
|
-
})]
|
|
799
|
-
})
|
|
800
|
-
}),
|
|
801
|
-
hint !== void 0 && /* @__PURE__ */ jsx("span", {
|
|
802
|
-
className: "hint",
|
|
803
|
-
id: hintId,
|
|
804
|
-
children: hint
|
|
805
|
-
})
|
|
806
|
-
]
|
|
807
|
-
}), /* @__PURE__ */ jsx(Combobox.Portal, {
|
|
808
|
-
container: portal,
|
|
809
|
-
children: /* @__PURE__ */ jsx(Combobox.Positioner, {
|
|
810
|
-
className: "menu-positioner",
|
|
811
|
-
sideOffset: 4,
|
|
812
|
-
align: "start",
|
|
813
|
-
children: /* @__PURE__ */ jsxs(Combobox.Popup, {
|
|
814
|
-
className: "menu combo-popup",
|
|
815
|
-
children: [/* @__PURE__ */ jsx(Combobox.Empty, {
|
|
816
|
-
className: "combo-empty",
|
|
817
|
-
children: "Nothing matches."
|
|
818
|
-
}), /* @__PURE__ */ jsx(Combobox.List, { children: (option) => /* @__PURE__ */ jsxs(Combobox.Item, {
|
|
819
|
-
value: option,
|
|
820
|
-
className: `menu-item${mono ? " mono" : ""}`,
|
|
821
|
-
children: [
|
|
822
|
-
/* @__PURE__ */ jsx("span", {
|
|
823
|
-
className: "combo-check",
|
|
824
|
-
children: /* @__PURE__ */ jsx(Combobox.ItemIndicator, { children: /* @__PURE__ */ jsx(Check, { size: 14 }) })
|
|
825
|
-
}),
|
|
826
|
-
/* @__PURE__ */ jsx("span", {
|
|
827
|
-
className: "combo-option",
|
|
828
|
-
children: option
|
|
829
|
-
}),
|
|
830
|
-
note?.(option)
|
|
831
|
-
]
|
|
832
|
-
}, option) })]
|
|
833
|
-
})
|
|
834
|
-
})
|
|
835
|
-
})]
|
|
836
|
-
});
|
|
837
|
-
}
|
|
838
|
-
//#endregion
|
|
839
765
|
//#region src/components/trusted-workloads.tsx
|
|
840
766
|
/**
|
|
841
767
|
* The CI runs that may sign in as a service, by the ID token their platform
|
|
@@ -850,29 +776,7 @@ function TrustedWorkloads({ serviceId, bindings, grants }) {
|
|
|
850
776
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Card, {
|
|
851
777
|
labelledBy: "trusted-workloads",
|
|
852
778
|
title: "Sign in with OIDC",
|
|
853
|
-
|
|
854
|
-
"A CI run signs in with the ID token GitHub Actions or GitLab gives it, so there is no secret to store. For example,",
|
|
855
|
-
" ",
|
|
856
|
-
/* @__PURE__ */ jsx("span", {
|
|
857
|
-
className: "mono",
|
|
858
|
-
children: "deploy.yml"
|
|
859
|
-
}),
|
|
860
|
-
" in ",
|
|
861
|
-
/* @__PURE__ */ jsx("span", {
|
|
862
|
-
className: "mono",
|
|
863
|
-
children: "acme/api"
|
|
864
|
-
}),
|
|
865
|
-
", on pushes to ",
|
|
866
|
-
/* @__PURE__ */ jsx("span", {
|
|
867
|
-
className: "mono",
|
|
868
|
-
children: "main"
|
|
869
|
-
}),
|
|
870
|
-
"."
|
|
871
|
-
] }),
|
|
872
|
-
children: bindings.length === 0 ? /* @__PURE__ */ jsx(EmptyState, {
|
|
873
|
-
title: "No trust bindings",
|
|
874
|
-
children: "Trust a workflow to let its runs sign in."
|
|
875
|
-
}) : /* @__PURE__ */ jsx("div", {
|
|
779
|
+
children: bindings.length === 0 ? /* @__PURE__ */ jsx(EmptyState, { title: "No trust bindings" }) : /* @__PURE__ */ jsx("div", {
|
|
876
780
|
className: "dt-wrap",
|
|
877
781
|
children: /* @__PURE__ */ jsxs("table", {
|
|
878
782
|
className: "dt",
|
|
@@ -909,7 +813,15 @@ function TrustedWorkloads({ serviceId, bindings, grants }) {
|
|
|
909
813
|
/* @__PURE__ */ jsx("small", { children: binding.label === null ? detail : `${title} · ${detail}` }),
|
|
910
814
|
/* @__PURE__ */ jsxs("details", {
|
|
911
815
|
className: "claims",
|
|
912
|
-
children: [
|
|
816
|
+
children: [
|
|
817
|
+
/* @__PURE__ */ jsx("summary", { children: "Claims" }),
|
|
818
|
+
/* @__PURE__ */ jsx(Claims, { binding }),
|
|
819
|
+
binding.keys !== null && /* @__PURE__ */ jsx(ReplaceKeys, {
|
|
820
|
+
serviceId,
|
|
821
|
+
issuer: binding.issuer,
|
|
822
|
+
bindings
|
|
823
|
+
})
|
|
824
|
+
]
|
|
913
825
|
})
|
|
914
826
|
]
|
|
915
827
|
})]
|
|
@@ -1004,11 +916,181 @@ function Claims({ binding }) {
|
|
|
1004
916
|
})] }, name)),
|
|
1005
917
|
/* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", { children: "keys" }), /* @__PURE__ */ jsx("td", {
|
|
1006
918
|
className: "mono",
|
|
1007
|
-
children: binding
|
|
919
|
+
children: keysOf(binding)
|
|
1008
920
|
})] })
|
|
1009
921
|
] })
|
|
1010
922
|
});
|
|
1011
923
|
}
|
|
924
|
+
/**
|
|
925
|
+
* New keys, pasted, for the service's bindings on an issuer whose keys they
|
|
926
|
+
* carry: when the issuer rotates its keys. Each binding is replaced by one
|
|
927
|
+
* the same but for them, as the review says before anything is saved.
|
|
928
|
+
*/
|
|
929
|
+
function ReplaceKeys({ serviceId, issuer, bindings }) {
|
|
930
|
+
const [open, setOpen] = useState(false);
|
|
931
|
+
const [text, setText] = useState("");
|
|
932
|
+
const [preview, setPreview] = useState(null);
|
|
933
|
+
const plan = preview?.plan ?? null;
|
|
934
|
+
const coffre = useCoffre();
|
|
935
|
+
const member = memberRef("service", serviceId);
|
|
936
|
+
const { pending, error, setError, run } = useAction();
|
|
937
|
+
const on = bindings.filter((binding) => binding.issuer === issuer).length;
|
|
938
|
+
function close() {
|
|
939
|
+
setOpen(false);
|
|
940
|
+
setText("");
|
|
941
|
+
setPreview(null);
|
|
942
|
+
setError(null);
|
|
943
|
+
}
|
|
944
|
+
function review() {
|
|
945
|
+
let jwks;
|
|
946
|
+
try {
|
|
947
|
+
const pasted = keySetOf(text);
|
|
948
|
+
if (pasted === void 0) throw new Error("Paste the issuer's key set");
|
|
949
|
+
jwks = pasted;
|
|
950
|
+
} catch (problem) {
|
|
951
|
+
setError(problem.message);
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
run(() => coffre.bindings.previewKeys(member, {
|
|
955
|
+
issuer,
|
|
956
|
+
jwks
|
|
957
|
+
}), {
|
|
958
|
+
affects: [],
|
|
959
|
+
onSuccess: (next) => setPreview({
|
|
960
|
+
plan: next,
|
|
961
|
+
jwks
|
|
962
|
+
})
|
|
963
|
+
});
|
|
964
|
+
}
|
|
965
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("button", {
|
|
966
|
+
className: "act",
|
|
967
|
+
type: "button",
|
|
968
|
+
onClick: () => setOpen(true),
|
|
969
|
+
children: [/* @__PURE__ */ jsx(Key, { size: 13 }), "Replace keys"]
|
|
970
|
+
}), /* @__PURE__ */ jsx(Modal, {
|
|
971
|
+
open,
|
|
972
|
+
onOpenChange: (next) => next ? setOpen(true) : close(),
|
|
973
|
+
title: preview === null ? "Replace keys" : "Review the keys",
|
|
974
|
+
children: preview === null || plan === null ? /* @__PURE__ */ jsxs("form", {
|
|
975
|
+
className: "form",
|
|
976
|
+
onSubmit: (event) => {
|
|
977
|
+
event.preventDefault();
|
|
978
|
+
review();
|
|
979
|
+
},
|
|
980
|
+
children: [
|
|
981
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
982
|
+
"The ",
|
|
983
|
+
on === 1 ? "binding" : `${on} bindings`,
|
|
984
|
+
" of ",
|
|
985
|
+
/* @__PURE__ */ jsxs("span", {
|
|
986
|
+
className: "mono",
|
|
987
|
+
children: ["service:", serviceId]
|
|
988
|
+
}),
|
|
989
|
+
" on",
|
|
990
|
+
" ",
|
|
991
|
+
/* @__PURE__ */ jsx("span", {
|
|
992
|
+
className: "mono",
|
|
993
|
+
children: issuer
|
|
994
|
+
}),
|
|
995
|
+
" will verify tokens with these keys alone. While the issuer rotates, paste a set that holds the old key and the new, and tokens signed with either sign in."
|
|
996
|
+
] }),
|
|
997
|
+
/* @__PURE__ */ jsxs("label", {
|
|
998
|
+
className: "field",
|
|
999
|
+
children: [
|
|
1000
|
+
/* @__PURE__ */ jsx("span", {
|
|
1001
|
+
className: "label",
|
|
1002
|
+
children: "Keys"
|
|
1003
|
+
}),
|
|
1004
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
1005
|
+
className: "input mono",
|
|
1006
|
+
rows: 6,
|
|
1007
|
+
value: text,
|
|
1008
|
+
spellCheck: false,
|
|
1009
|
+
placeholder: "{ \"keys\": [ … ] }",
|
|
1010
|
+
onChange: (event) => {
|
|
1011
|
+
setText(event.target.value);
|
|
1012
|
+
setError(null);
|
|
1013
|
+
}
|
|
1014
|
+
}),
|
|
1015
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1016
|
+
className: "hint",
|
|
1017
|
+
children: ["From a Kubernetes cluster: ", /* @__PURE__ */ jsx("span", {
|
|
1018
|
+
className: "mono",
|
|
1019
|
+
children: "kubectl get --raw /openid/v1/jwks"
|
|
1020
|
+
})]
|
|
1021
|
+
})
|
|
1022
|
+
]
|
|
1023
|
+
}),
|
|
1024
|
+
/* @__PURE__ */ jsx(ErrorLine, { error }),
|
|
1025
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1026
|
+
className: "dialog-actions",
|
|
1027
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
1028
|
+
className: "btn",
|
|
1029
|
+
type: "button",
|
|
1030
|
+
onClick: close,
|
|
1031
|
+
children: "Cancel"
|
|
1032
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
1033
|
+
className: "btn btn-primary",
|
|
1034
|
+
type: "submit",
|
|
1035
|
+
disabled: pending,
|
|
1036
|
+
children: [pending && /* @__PURE__ */ jsx(Spinner, {}), "Review"]
|
|
1037
|
+
})]
|
|
1038
|
+
})
|
|
1039
|
+
]
|
|
1040
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
1041
|
+
className: "form",
|
|
1042
|
+
children: [
|
|
1043
|
+
/* @__PURE__ */ jsxs("p", { children: [
|
|
1044
|
+
plan.replaces.length === 1 ? "Its binding" : `Its ${plan.replaces.length} bindings`,
|
|
1045
|
+
" on ",
|
|
1046
|
+
/* @__PURE__ */ jsx("span", {
|
|
1047
|
+
className: "mono",
|
|
1048
|
+
children: issuer
|
|
1049
|
+
}),
|
|
1050
|
+
" ",
|
|
1051
|
+
plan.replaces.length === 1 ? "is" : "are",
|
|
1052
|
+
" replaced by ",
|
|
1053
|
+
plan.replaces.length === 1 ? "one" : "ones",
|
|
1054
|
+
" the same but for these keys. Credentials ",
|
|
1055
|
+
plan.replaces.length === 1 ? "it" : "they",
|
|
1056
|
+
" issued, five minutes each at most, end at once."
|
|
1057
|
+
] }),
|
|
1058
|
+
/* @__PURE__ */ jsx("table", {
|
|
1059
|
+
className: "claims-table",
|
|
1060
|
+
children: /* @__PURE__ */ jsx("tbody", { children: plan.keys.map((key) => /* @__PURE__ */ jsxs("tr", { children: [/* @__PURE__ */ jsx("th", {
|
|
1061
|
+
className: "mono",
|
|
1062
|
+
children: key.alg
|
|
1063
|
+
}), /* @__PURE__ */ jsx("td", {
|
|
1064
|
+
className: "mono",
|
|
1065
|
+
children: key.kid ?? key.thumbprint
|
|
1066
|
+
})] }, key.thumbprint)) })
|
|
1067
|
+
}),
|
|
1068
|
+
/* @__PURE__ */ jsx(ErrorLine, { error }),
|
|
1069
|
+
/* @__PURE__ */ jsxs("div", {
|
|
1070
|
+
className: "dialog-actions",
|
|
1071
|
+
children: [/* @__PURE__ */ jsx("button", {
|
|
1072
|
+
className: "btn",
|
|
1073
|
+
type: "button",
|
|
1074
|
+
onClick: () => setPreview(null),
|
|
1075
|
+
children: "Back"
|
|
1076
|
+
}), /* @__PURE__ */ jsxs("button", {
|
|
1077
|
+
className: "btn btn-primary",
|
|
1078
|
+
type: "button",
|
|
1079
|
+
disabled: pending,
|
|
1080
|
+
onClick: () => void run(() => coffre.bindings.replaceKeys(member, {
|
|
1081
|
+
issuer,
|
|
1082
|
+
jwks: preview.jwks
|
|
1083
|
+
}), {
|
|
1084
|
+
affects: affects.bindings(member),
|
|
1085
|
+
onSuccess: close
|
|
1086
|
+
}),
|
|
1087
|
+
children: [pending && /* @__PURE__ */ jsx(Spinner, {}), "Save keys"]
|
|
1088
|
+
})]
|
|
1089
|
+
})
|
|
1090
|
+
]
|
|
1091
|
+
})
|
|
1092
|
+
})] });
|
|
1093
|
+
}
|
|
1012
1094
|
/** Beside `pull_request` and `workflow_run` in the events' list: they run code nobody reviewed, said in full once chosen. */
|
|
1013
1095
|
function exposureNote(event) {
|
|
1014
1096
|
return EVENT_EXPOSURE[event] === void 0 ? null : /* @__PURE__ */ jsx("span", {
|
|
@@ -1136,6 +1218,7 @@ function TrustWorkload({ serviceId, grants, bindings }) {
|
|
|
1136
1218
|
});
|
|
1137
1219
|
const [choice, setChoice] = useState(whole);
|
|
1138
1220
|
const [plan, setPlan] = useState(null);
|
|
1221
|
+
const [reviewed, setReviewed] = useState(null);
|
|
1139
1222
|
const coffre = useCoffre();
|
|
1140
1223
|
const member = memberRef("service", serviceId);
|
|
1141
1224
|
const { pending, error, setError, run } = useAction();
|
|
@@ -1187,6 +1270,7 @@ function TrustWorkload({ serviceId, grants, bindings }) {
|
|
|
1187
1270
|
affects: [],
|
|
1188
1271
|
onSuccess: (next) => {
|
|
1189
1272
|
setPlan(next);
|
|
1273
|
+
setReviewed(request);
|
|
1190
1274
|
setChoice((current) => planned(current, next));
|
|
1191
1275
|
}
|
|
1192
1276
|
});
|
|
@@ -1446,29 +1530,69 @@ function TrustWorkload({ serviceId, grants, bindings }) {
|
|
|
1446
1530
|
})
|
|
1447
1531
|
] }),
|
|
1448
1532
|
form.platform === "other" && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1449
|
-
field("Issuer", "issuer", {
|
|
1533
|
+
field("Issuer", "issuer", {
|
|
1534
|
+
placeholder: "https://accounts.google.com",
|
|
1535
|
+
hint: form.jwks.trim() === "" ? void 0 : "Exactly as its tokens name it in iss: with its keys pasted below, coffre asks it nothing."
|
|
1536
|
+
}),
|
|
1450
1537
|
field("Subject (sub)", "sub", {
|
|
1451
1538
|
mono: true,
|
|
1452
1539
|
hint: "You vouch for what this issuer's subject means: a Google service account's unique ID, say."
|
|
1453
1540
|
}),
|
|
1454
1541
|
/* @__PURE__ */ jsxs("label", {
|
|
1455
1542
|
className: "field",
|
|
1456
|
-
children: [
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1543
|
+
children: [
|
|
1544
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1545
|
+
className: "label",
|
|
1546
|
+
children: [
|
|
1547
|
+
"Other claims, one ",
|
|
1548
|
+
/* @__PURE__ */ jsx("span", {
|
|
1549
|
+
className: "mono",
|
|
1550
|
+
children: "name=value"
|
|
1551
|
+
}),
|
|
1552
|
+
" a line"
|
|
1553
|
+
]
|
|
1554
|
+
}),
|
|
1555
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
1556
|
+
className: "input mono",
|
|
1557
|
+
rows: 3,
|
|
1558
|
+
value: form.extra,
|
|
1559
|
+
spellCheck: false,
|
|
1560
|
+
placeholder: "kubernetes.io.serviceaccount.uid=…",
|
|
1561
|
+
onChange: (event) => set({ extra: event.target.value })
|
|
1562
|
+
}),
|
|
1563
|
+
/* @__PURE__ */ jsx("span", {
|
|
1564
|
+
className: "hint",
|
|
1565
|
+
children: "A nested claim goes by its path, its names joined by dots."
|
|
1566
|
+
})
|
|
1567
|
+
]
|
|
1568
|
+
}),
|
|
1569
|
+
/* @__PURE__ */ jsxs("label", {
|
|
1570
|
+
className: "field",
|
|
1571
|
+
children: [
|
|
1572
|
+
/* @__PURE__ */ jsx("span", {
|
|
1573
|
+
className: "label",
|
|
1574
|
+
children: "Keys (optional)"
|
|
1575
|
+
}),
|
|
1576
|
+
/* @__PURE__ */ jsx("textarea", {
|
|
1577
|
+
className: "input mono",
|
|
1578
|
+
rows: 3,
|
|
1579
|
+
value: form.jwks,
|
|
1580
|
+
spellCheck: false,
|
|
1581
|
+
placeholder: "{ \"keys\": [ … ] }",
|
|
1582
|
+
onChange: (event) => set({ jwks: event.target.value })
|
|
1583
|
+
}),
|
|
1584
|
+
/* @__PURE__ */ jsxs("span", {
|
|
1585
|
+
className: "hint",
|
|
1586
|
+
children: [
|
|
1587
|
+
"Left empty, coffre fetches the issuer's keys. Paste them for one it cannot reach, such as a private Kubernetes cluster:",
|
|
1588
|
+
" ",
|
|
1589
|
+
/* @__PURE__ */ jsx("span", {
|
|
1590
|
+
className: "mono",
|
|
1591
|
+
children: "kubectl get --raw /openid/v1/jwks"
|
|
1592
|
+
})
|
|
1593
|
+
]
|
|
1594
|
+
})
|
|
1595
|
+
]
|
|
1472
1596
|
})
|
|
1473
1597
|
] }),
|
|
1474
1598
|
/* @__PURE__ */ jsx(ScopePicker, {
|
|
@@ -1541,7 +1665,7 @@ function TrustWorkload({ serviceId, grants, bindings }) {
|
|
|
1541
1665
|
type: "button",
|
|
1542
1666
|
disabled: pending,
|
|
1543
1667
|
onClick: () => void run(() => coffre.bindings.create(member, {
|
|
1544
|
-
...
|
|
1668
|
+
...reviewed,
|
|
1545
1669
|
scope: plan.scope
|
|
1546
1670
|
}), {
|
|
1547
1671
|
affects: affects.bindings(member),
|