@coffre/ui 0.8.2 → 0.10.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-C_wMpAqr.js → audit-sentence-Bjhg00cn.js} +73 -6
- package/dist/chunks/audit-sentence-Bjhg00cn.js.map +1 -0
- package/dist/chunks/{connected-apps-Bn5rEoV2.js → connected-apps-CZI7xxUq.js} +2 -2
- package/dist/chunks/{connected-apps-Bn5rEoV2.js.map → connected-apps-CZI7xxUq.js.map} +1 -1
- package/dist/chunks/{delete-place-CQCDHkne.js → delete-place-D3UQGl3b.js} +3 -3
- package/dist/chunks/{delete-place-CQCDHkne.js.map → delete-place-D3UQGl3b.js.map} +1 -1
- package/dist/chunks/{directory-BQNOdze_.js → directory-CyHmxYP-.js} +9 -7
- package/dist/chunks/directory-CyHmxYP-.js.map +1 -0
- package/dist/chunks/{grants-CJIBrkod.js → grants-CEIdNqJU.js} +4 -4
- package/dist/chunks/{grants-CJIBrkod.js.map → grants-CEIdNqJU.js.map} +1 -1
- package/dist/chunks/{offboarding-CrgwaetA.js → offboarding-CvGgTmHi.js} +2 -2
- package/dist/chunks/{offboarding-CrgwaetA.js.map → offboarding-CvGgTmHi.js.map} +1 -1
- package/dist/chunks/{personal-tokens-B8rkT-DI.js → personal-tokens-BX97oX4a.js} +2 -2
- package/dist/chunks/{personal-tokens-B8rkT-DI.js.map → personal-tokens-BX97oX4a.js.map} +1 -1
- package/dist/chunks/{principal-page-Cv5PheS9.js → principal-page-Bp2O8kIW.js} +92 -76
- package/dist/chunks/principal-page-Bp2O8kIW.js.map +1 -0
- package/dist/chunks/{project-page-BI--vjt3.js → project-page-CUXV4FDR.js} +2 -2
- package/dist/chunks/{project-page-BI--vjt3.js.map → project-page-CUXV4FDR.js.map} +1 -1
- package/dist/chunks/protected-YYW3U-Sq.js +22 -0
- package/dist/chunks/protected-YYW3U-Sq.js.map +1 -0
- package/dist/chunks/{queries-epz4MIuW.js → queries-DEOPOpsT.js} +27 -3
- package/dist/chunks/queries-DEOPOpsT.js.map +1 -0
- package/dist/chunks/{references-DImfw0cz.js → references-DsXkt064.js} +3 -3
- package/dist/chunks/{references-DImfw0cz.js.map → references-DsXkt064.js.map} +1 -1
- package/dist/chunks/{role-field-C1KhNaIR.js → role-field-CCUeZd1a.js} +8 -5
- package/dist/chunks/role-field-CCUeZd1a.js.map +1 -0
- package/dist/chunks/{use-action-BB-RcHo1.js → use-action-COW-XFw8.js} +2 -2
- package/dist/chunks/{use-action-BB-RcHo1.js.map → use-action-COW-XFw8.js.map} +1 -1
- package/dist/chunks/{use-change-CQyDpCqw.js → use-change-hfqE7baE.js} +231 -66
- package/dist/chunks/use-change-hfqE7baE.js.map +1 -0
- package/dist/chunks/use-roles-C_Tj5wBH.js +224 -0
- package/dist/chunks/use-roles-C_Tj5wBH.js.map +1 -0
- package/dist/chunks/{use-shell-C_NmvCt_.js → use-shell-DBLG80kk.js} +2 -2
- package/dist/chunks/{use-shell-C_NmvCt_.js.map → use-shell-DBLG80kk.js.map} +1 -1
- package/dist/index.d.ts +9 -3
- package/dist/index.js +25 -11
- package/dist/index.js.map +1 -1
- package/dist/pages/account.js +6 -6
- package/dist/pages/audit.js +2 -2
- package/dist/pages/environment.js +306 -96
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +1 -1
- package/dist/pages/project-access.js +78 -45
- package/dist/pages/project-access.js.map +1 -1
- package/dist/pages/project-environments.js +77 -28
- package/dist/pages/project-environments.js.map +1 -1
- package/dist/pages/project-settings.js +6 -6
- package/dist/pages/project.js +1 -1
- package/dist/pages/projects.js +23 -11
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.js +19 -12
- package/dist/pages/service-account.js.map +1 -1
- package/dist/pages/service-accounts.js +4 -4
- package/dist/pages/settings.js +580 -8
- package/dist/pages/settings.js.map +1 -1
- 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/directory.tsx +5 -2
- package/src/components/grants.tsx +1 -1
- package/src/components/principal-page.tsx +38 -23
- package/src/components/protected.tsx +17 -0
- package/src/components/role-editor.tsx +582 -0
- package/src/components/role-field.tsx +7 -3
- package/src/components/scope-picker.tsx +19 -9
- package/src/components/shell.tsx +7 -1
- package/src/lib/access-plan.ts +35 -36
- package/src/lib/audit-sentences.ts +75 -6
- package/src/lib/changes.ts +48 -6
- package/src/lib/project-access.ts +4 -78
- package/src/lib/queries.ts +16 -0
- package/src/lib/roles.ts +201 -0
- package/src/lib/row-reads.ts +12 -0
- package/src/lib/secret-edit-batch.ts +162 -26
- package/src/lib/sensitivity.ts +50 -0
- package/src/lib/service-setup.ts +20 -8
- package/src/lib/use-roles.ts +17 -0
- package/src/pages/environment.tsx +295 -61
- package/src/pages/project-access.tsx +49 -19
- package/src/pages/project-environments.tsx +62 -3
- package/src/pages/projects.tsx +3 -1
- package/src/pages/settings.tsx +2 -0
- package/src/parity.ts +41 -4
- package/src/shared/models.ts +2 -9
- package/src/styles/globals.css +329 -4
- package/dist/chunks/audit-sentence-C_wMpAqr.js.map +0 -1
- package/dist/chunks/directory-BQNOdze_.js.map +0 -1
- package/dist/chunks/principal-page-Cv5PheS9.js.map +0 -1
- package/dist/chunks/queries-epz4MIuW.js.map +0 -1
- package/dist/chunks/role-field-C1KhNaIR.js.map +0 -1
- package/dist/chunks/use-change-CQyDpCqw.js.map +0 -1
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { E as isActiveAccessibleEnvironment, i as keys, t as affects, v as queries, w as canRevealSecrets } from "../chunks/queries-
|
|
1
|
+
import { E as isActiveAccessibleEnvironment, i as keys, t as affects, v as queries, w as canRevealSecrets } from "../chunks/queries-DEOPOpsT.js";
|
|
2
2
|
import { a as ErrorLine, c as Notice, d as Tip, g as createCopier, h as breakAfterUnderscores, i as EmptyState, l as Spinner, n as ConfirmDialog, o as MenuPopup, r as CopyButton, s as Modal, t as ConfirmButton, u as Timestamp } from "../chunks/ui-2kwXXfrX.js";
|
|
3
3
|
import { i as SecretReadOnly } from "../chunks/affordances-Dtyha68j.js";
|
|
4
4
|
import { $ as SlashCircle, A as History, D as Generate, E as Folder, G as Plus, H as MoreHorizontal, J as Search, L as Lock, M as Key, S as Clock, T as EyeOff, W as Pencil, Z as Shuffle, _ as Check, g as ArrowRight, h as Archive, i as PageHeader, k as Hash, n as ClosedDoor, nt as Trash, o as failureMessage, p as AlertCircle, q as RotateBack, rt as Upload, st as X, t as Card, tt as Terminal, u as useCoffre, w as Eye, x as ChevronsUpDown, y as ChevronDown } from "../chunks/page-JTORvh-N.js";
|
|
5
5
|
import { a as rowClass, i as RowPending, r as RowFailure } from "../chunks/row-state-BsIHspy4.js";
|
|
6
|
-
import { t as useShell } from "../chunks/use-shell-
|
|
7
|
-
import { B as
|
|
6
|
+
import { t as useShell } from "../chunks/use-shell-DBLG80kk.js";
|
|
7
|
+
import { A as restoreSecret, B as valueEdit, G as stricter, H as SENSITIVITIES, I as companionsOf, J as regenerateWaits, K as waitsForValue, L as hasSecretEditConflict, P as saveSecrets, R as madeSensitive, S as moveSecret, T as regenerateSecret, U as levelsIn, V as LEVELS, W as markable, Y as regeneratedKeys, _ as forkKey, a as UnsavedEdits, i as changeOptions, k as restoreMissing, m as dismissMissing, n as useChangeStatus, q as liveGeneration, r as changeKey, s as archiveSecret, t as useChange, x as missingList, z as secretChangeFor } from "../chunks/use-change-hfqE7baE.js";
|
|
8
8
|
import { i as secretKeyProblem, n as folderProblem } from "../chunks/validation-DiHIwZRA.js";
|
|
9
9
|
import { t as pageRoute } from "../chunks/page-route-Drfw7lmn.js";
|
|
10
|
-
import { t as useAction } from "../chunks/use-action-
|
|
10
|
+
import { t as useAction } from "../chunks/use-action-COW-XFw8.js";
|
|
11
|
+
import { t as ProtectedTag } from "../chunks/protected-YYW3U-Sq.js";
|
|
11
12
|
import { n as FolderRow, r as MoveToFolder, t as FolderMenu } from "../chunks/folders-Dw240WMJ.js";
|
|
12
13
|
import { t as MultiCombobox } from "../chunks/multi-combobox-CsIXihuc.js";
|
|
13
|
-
import { i as ReferenceValue, n as LentReferences, o as archiveBlockers, r as MakeReference, t as ArchiveBlocked } from "../chunks/references-
|
|
14
|
+
import { i as ReferenceValue, n as LentReferences, o as archiveBlockers, r as MakeReference, t as ArchiveBlocked } from "../chunks/references-DsXkt064.js";
|
|
14
15
|
import { useEffect, useId, useReducer, useRef, useState } from "react";
|
|
15
16
|
import { Link, useNavigate } from "@tanstack/react-router";
|
|
16
17
|
import { toast } from "sonner";
|
|
@@ -72,6 +73,17 @@ function rowReads(state, action) {
|
|
|
72
73
|
function revealToggleDisabled(state, shown) {
|
|
73
74
|
return shown === null && state.revealing;
|
|
74
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* The value an edit starts from: a plain one as listed, one the caller reads
|
|
78
|
+
* as `read` opens it, or none, the editor opening empty to replace it: a
|
|
79
|
+
* sensitive value, a parent's they do not read, or a read refused or failed,
|
|
80
|
+
* whose reason the row says. It always opens: writing a value takes no read
|
|
81
|
+
* of the one it replaces.
|
|
82
|
+
*/
|
|
83
|
+
async function valueToEdit(row, read) {
|
|
84
|
+
if (row.value !== null) return row.value;
|
|
85
|
+
return row.readable ? read() : null;
|
|
86
|
+
}
|
|
75
87
|
//#endregion
|
|
76
88
|
//#region src/lib/secret-order.ts
|
|
77
89
|
/**
|
|
@@ -731,10 +743,11 @@ function EnvironmentPage() {
|
|
|
731
743
|
keys: result.keys,
|
|
732
744
|
parents: result.parents ?? [],
|
|
733
745
|
personal: result.personal != null,
|
|
746
|
+
guarded: result.protected,
|
|
734
747
|
rotateAfterDays: result.rotateAfterDays
|
|
735
748
|
}, `${project}/${environment}`);
|
|
736
749
|
}
|
|
737
|
-
function EnvironmentLedger({ project, environment, permissions, keys: keys$1, parents, personal, rotateAfterDays }) {
|
|
750
|
+
function EnvironmentLedger({ project, environment, permissions, keys: keys$1, parents, personal, guarded, rotateAfterDays }) {
|
|
738
751
|
const coffre = useCoffre();
|
|
739
752
|
const queryClient = useQueryClient();
|
|
740
753
|
const { principal } = useShell();
|
|
@@ -792,6 +805,15 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
792
805
|
const [changes, setChanges] = useState({});
|
|
793
806
|
const [editing, setEditing] = useState(() => /* @__PURE__ */ new Set());
|
|
794
807
|
const [saveError, setSaveError] = useState(null);
|
|
808
|
+
const [hiding, setHiding] = useState(null);
|
|
809
|
+
function confirmingSensitive(drafts, changes, go) {
|
|
810
|
+
const keys = madeSensitive(active, drafts, changes);
|
|
811
|
+
if (keys.length === 0) go();
|
|
812
|
+
else setHiding({
|
|
813
|
+
keys,
|
|
814
|
+
go
|
|
815
|
+
});
|
|
816
|
+
}
|
|
795
817
|
const [query, setQuery] = useState(Route.useSearch().filter ?? "");
|
|
796
818
|
const [sort, setSort] = useState({
|
|
797
819
|
by: "key",
|
|
@@ -806,6 +828,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
806
828
|
const canWrite = permissions.includes("secret.write");
|
|
807
829
|
const canArchive = permissions.includes("secret.archive");
|
|
808
830
|
const canReveal = canRevealSecrets(permissions);
|
|
831
|
+
const canList = canReveal || permissions.includes("secret.use");
|
|
809
832
|
const active = byFolder(keys$1.filter((entry) => !entry.archived)).flatMap(([, entries]) => entries);
|
|
810
833
|
const folders = foldersOf(active);
|
|
811
834
|
const heldHere = (entry) => entry.parent === null || entry.parent.state === "overridden";
|
|
@@ -853,8 +876,9 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
853
876
|
];
|
|
854
877
|
const unnamed = pendingNames.some((name) => name === "");
|
|
855
878
|
const invalid = pendingNames.some((name) => name !== "" && secretKeyProblem(name) !== null);
|
|
879
|
+
const waiting = changedEntries.find((entry) => waitsForValue(entry, secretChangeFor(changes, entry.key)));
|
|
856
880
|
const pendingCount = drafts.length + changedEntries.length;
|
|
857
|
-
const ready = pendingCount > 0 && !unnamed && !invalid && !hasConflict;
|
|
881
|
+
const ready = pendingCount > 0 && !unnamed && !invalid && !hasConflict && waiting === void 0;
|
|
858
882
|
function patchChange(entry, patch) {
|
|
859
883
|
setChanges((current) => {
|
|
860
884
|
const next = {
|
|
@@ -865,7 +889,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
865
889
|
},
|
|
866
890
|
...patch
|
|
867
891
|
};
|
|
868
|
-
if (next.key !== entry.key || next.value !== null || next.archived) return {
|
|
892
|
+
if (next.key !== entry.key || next.value !== null || next.sensitivity !== void 0 || next.archived) return {
|
|
869
893
|
...current,
|
|
870
894
|
[entry.key]: next
|
|
871
895
|
};
|
|
@@ -879,20 +903,24 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
879
903
|
*/
|
|
880
904
|
function saveRow(key) {
|
|
881
905
|
const change = secretChangeFor(changes, key);
|
|
882
|
-
dropChange(key);
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
906
|
+
if (change === void 0) return dropChange(key);
|
|
907
|
+
confirmingSensitive([], { [key]: change }, () => {
|
|
908
|
+
dropChange(key);
|
|
909
|
+
sendAlone({
|
|
910
|
+
active,
|
|
911
|
+
drafts: [],
|
|
912
|
+
changes: { [key]: change }
|
|
913
|
+
});
|
|
888
914
|
});
|
|
889
915
|
}
|
|
890
916
|
function saveDraft(draft) {
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
917
|
+
confirmingSensitive([draft], {}, () => {
|
|
918
|
+
setDrafts((rows) => rows.filter((row) => row.id !== draft.id));
|
|
919
|
+
sendAlone({
|
|
920
|
+
active,
|
|
921
|
+
drafts: [draft],
|
|
922
|
+
changes: {}
|
|
923
|
+
});
|
|
896
924
|
});
|
|
897
925
|
}
|
|
898
926
|
/** Whether one row's change could go alone: named, well named, and clashing with nothing. */
|
|
@@ -902,7 +930,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
902
930
|
...Object.values(changes).flatMap((change) => change.archived ? [] : [change.key.trim()]),
|
|
903
931
|
...companionsOf(active, drafts, changes).map((companion) => companion.key.trim())
|
|
904
932
|
];
|
|
905
|
-
return (drafts.length > 0 || Object.keys(changes).length > 0) && names.every((name) => name !== "" && secretKeyProblem(name) === null) && !hasSecretEditConflict(active, drafts, changes);
|
|
933
|
+
return (drafts.length > 0 || Object.keys(changes).length > 0) && names.every((name) => name !== "" && secretKeyProblem(name) === null) && !hasSecretEditConflict(active, drafts, changes) && !active.some((entry) => waitsForValue(entry, secretChangeFor(changes, entry.key)));
|
|
906
934
|
}
|
|
907
935
|
function sendAlone(batch) {
|
|
908
936
|
setSaveError(null);
|
|
@@ -932,7 +960,8 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
932
960
|
setDrafts((rows) => [...rows, {
|
|
933
961
|
id: nextDraftId.current++,
|
|
934
962
|
key,
|
|
935
|
-
value: ""
|
|
963
|
+
value: "",
|
|
964
|
+
sensitivity: "secret"
|
|
936
965
|
}]);
|
|
937
966
|
}
|
|
938
967
|
function discardAll() {
|
|
@@ -962,6 +991,9 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
962
991
|
*/
|
|
963
992
|
function saveChanges() {
|
|
964
993
|
if (!ready) return;
|
|
994
|
+
confirmingSensitive(drafts, changes, sendChanges);
|
|
995
|
+
}
|
|
996
|
+
function sendChanges() {
|
|
965
997
|
const batch = {
|
|
966
998
|
active,
|
|
967
999
|
drafts,
|
|
@@ -1039,13 +1071,11 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1039
1071
|
what: "archived"
|
|
1040
1072
|
};
|
|
1041
1073
|
const renamed = change.key.trim() !== entry.key;
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
what: withCompanion(`→ ${change.key.trim()}, new value`, change.companion)
|
|
1045
|
-
};
|
|
1074
|
+
const level = change.sensitivity === void 0 || change.sensitivity === entry.sensitivity ? null : change.sensitivity;
|
|
1075
|
+
const written = change.value === null ? level === null ? null : `made ${level}` : withCompanion(level === null ? "new value" : `new value, ${level}`, change.companion);
|
|
1046
1076
|
if (renamed) return {
|
|
1047
1077
|
key: entry.key,
|
|
1048
|
-
what: `→ ${change.key.trim()}`
|
|
1078
|
+
what: written === null ? `→ ${change.key.trim()}` : `→ ${change.key.trim()}, ${written}`
|
|
1049
1079
|
};
|
|
1050
1080
|
if (entry.parent !== null && entry.parent.state !== "overridden") return {
|
|
1051
1081
|
key: entry.key,
|
|
@@ -1053,10 +1083,10 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1053
1083
|
};
|
|
1054
1084
|
return {
|
|
1055
1085
|
key: entry.key,
|
|
1056
|
-
what:
|
|
1086
|
+
what: written ?? "new value"
|
|
1057
1087
|
};
|
|
1058
1088
|
})];
|
|
1059
|
-
const problem = unnamed ? null : hasConflict ? "Two pending edits would end up with the same name. Secret names are unique in an environment." : invalid ? "Names are letters, digits and underscores, and cannot start with a digit." : null;
|
|
1089
|
+
const problem = unnamed ? null : hasConflict ? "Two pending edits would end up with the same name. Secret names are unique in an environment." : invalid ? "Names are letters, digits and underscores, and cannot start with a digit." : waiting !== void 0 ? `${waiting.key} waits for its value: type it again.` : null;
|
|
1060
1090
|
const needle = query.trim().toLowerCase();
|
|
1061
1091
|
const listed = sortKeys(needle === "" ? active : active.filter((entry) => entry.key.toLowerCase().includes(needle)), sort);
|
|
1062
1092
|
const columns = 6;
|
|
@@ -1064,11 +1094,12 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1064
1094
|
/* @__PURE__ */ jsx(PageHeader, {
|
|
1065
1095
|
tile: project,
|
|
1066
1096
|
title: environment,
|
|
1097
|
+
aside: guarded && /* @__PURE__ */ jsx(ProtectedTag, {}),
|
|
1067
1098
|
actions: personal ? /* @__PURE__ */ jsx(DeletePersonal, {
|
|
1068
1099
|
project,
|
|
1069
1100
|
environment,
|
|
1070
1101
|
of: parents[0]
|
|
1071
|
-
}) : principal?.type === "user" &&
|
|
1102
|
+
}) : principal?.type === "user" && canList && /* @__PURE__ */ jsxs(Link, {
|
|
1072
1103
|
className: "btn btn-sm",
|
|
1073
1104
|
to: "/projects/$project/$environment",
|
|
1074
1105
|
params: {
|
|
@@ -1099,7 +1130,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1099
1130
|
parents[0]
|
|
1100
1131
|
]
|
|
1101
1132
|
}),
|
|
1102
|
-
": what you set here
|
|
1133
|
+
": what you set here is yours alone, while you read or use ",
|
|
1103
1134
|
parents[0],
|
|
1104
1135
|
"; the rest is ",
|
|
1105
1136
|
parents[0],
|
|
@@ -1265,6 +1296,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1265
1296
|
canWrite,
|
|
1266
1297
|
canArchive,
|
|
1267
1298
|
canReveal,
|
|
1299
|
+
canList,
|
|
1268
1300
|
folders,
|
|
1269
1301
|
onMove: (folder) => move({
|
|
1270
1302
|
key: entry.key,
|
|
@@ -1272,6 +1304,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1272
1304
|
}),
|
|
1273
1305
|
lent: lentBy.get(entry.key) ?? [],
|
|
1274
1306
|
environments: personal ? [] : readable,
|
|
1307
|
+
personal,
|
|
1275
1308
|
status: state,
|
|
1276
1309
|
disabled: state.state === "pending",
|
|
1277
1310
|
onDismiss: dismiss,
|
|
@@ -1313,6 +1346,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1313
1346
|
drafts.map((draft) => /* @__PURE__ */ jsx(DraftRow, {
|
|
1314
1347
|
draft,
|
|
1315
1348
|
existingVersion: versionOf(draft.key),
|
|
1349
|
+
personal,
|
|
1316
1350
|
disabled: false,
|
|
1317
1351
|
onChange: (patch) => setDrafts((rows) => rows.map((row) => row.id === draft.id ? {
|
|
1318
1352
|
...row,
|
|
@@ -1333,6 +1367,26 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1333
1367
|
onSave: saveChanges
|
|
1334
1368
|
})]
|
|
1335
1369
|
}),
|
|
1370
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
1371
|
+
open: hiding !== null,
|
|
1372
|
+
onOpenChange: (open) => !open && setHiding(null),
|
|
1373
|
+
title: hiding?.keys.length === 1 ? /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
1374
|
+
"Make ",
|
|
1375
|
+
/* @__PURE__ */ jsx("span", {
|
|
1376
|
+
className: "mono",
|
|
1377
|
+
children: hiding.keys[0]
|
|
1378
|
+
}),
|
|
1379
|
+
" sensitive?"
|
|
1380
|
+
] }) : `Make ${hiding?.keys.length ?? 0} keys sensitive?`,
|
|
1381
|
+
body: `${hiding !== null && hiding.keys.length > 1 ? `${hiding.keys.join(", ")}: n` : "N"}obody, Owners included, will see ${hiding?.keys.length === 1 ? "this value" : "these values"} again. Apps use ${hiding?.keys.length === 1 ? "it" : "them"} through the proxy; service accounts still read ${hiding?.keys.length === 1 ? "it" : "them"}.`,
|
|
1382
|
+
confirmLabel: "Make sensitive",
|
|
1383
|
+
destructive: false,
|
|
1384
|
+
onConfirm: () => {
|
|
1385
|
+
const go = hiding?.go;
|
|
1386
|
+
setHiding(null);
|
|
1387
|
+
go?.();
|
|
1388
|
+
}
|
|
1389
|
+
}),
|
|
1336
1390
|
canWrite && /* @__PURE__ */ jsxs("div", {
|
|
1337
1391
|
className: "table-actions",
|
|
1338
1392
|
children: [
|
|
@@ -1407,7 +1461,7 @@ function EnvironmentLedger({ project, environment, permissions, keys: keys$1, pa
|
|
|
1407
1461
|
environment,
|
|
1408
1462
|
entry,
|
|
1409
1463
|
canArchive,
|
|
1410
|
-
|
|
1464
|
+
canList,
|
|
1411
1465
|
status: status(entry.key),
|
|
1412
1466
|
onRestore: () => restoreSecretKey(entry.key),
|
|
1413
1467
|
onDismiss: dismiss
|
|
@@ -1590,7 +1644,7 @@ function AddFolder({ open, onOpenChange, keys, folders, onAdd }) {
|
|
|
1590
1644
|
});
|
|
1591
1645
|
}
|
|
1592
1646
|
var lineCount = (text) => text.split("\n").length;
|
|
1593
|
-
function ValueField({ label, value, start = "", onChange, placeholder, disabled, autoFocus, onEscape, generate }) {
|
|
1647
|
+
function ValueField({ label, value, start = "", onChange, placeholder, disabled, autoFocus, onEscape, generate, plain = false }) {
|
|
1594
1648
|
const [shown, setShown] = useState(false);
|
|
1595
1649
|
const [generating, setGenerating] = useState(false);
|
|
1596
1650
|
const [lines, setLines] = useState(() => start.includes("\n") || value.includes("\n"));
|
|
@@ -1604,7 +1658,7 @@ function ValueField({ label, value, start = "", onChange, placeholder, disabled,
|
|
|
1604
1658
|
};
|
|
1605
1659
|
const field = {
|
|
1606
1660
|
className: "input input-mono",
|
|
1607
|
-
masked: !shown,
|
|
1661
|
+
masked: !shown && !plain,
|
|
1608
1662
|
"aria-label": label,
|
|
1609
1663
|
placeholder,
|
|
1610
1664
|
value,
|
|
@@ -1654,7 +1708,7 @@ function ValueField({ label, value, start = "", onChange, placeholder, disabled,
|
|
|
1654
1708
|
children: /* @__PURE__ */ jsx(Generate, { size: 14 })
|
|
1655
1709
|
})
|
|
1656
1710
|
}),
|
|
1657
|
-
/* @__PURE__ */ jsx("button", {
|
|
1711
|
+
!plain && /* @__PURE__ */ jsx("button", {
|
|
1658
1712
|
type: "button",
|
|
1659
1713
|
className: "btn btn-quiet btn-sm btn-icon input-addon",
|
|
1660
1714
|
"aria-label": shown ? "Mask the value" : "Show the value",
|
|
@@ -1700,7 +1754,7 @@ function useSecondsLeft(reveal) {
|
|
|
1700
1754
|
if (reveal === null) return 0;
|
|
1701
1755
|
return Math.max(0, Math.ceil(REVEAL_TTL_SECONDS - (now - reveal.at) / 1e3));
|
|
1702
1756
|
}
|
|
1703
|
-
function SecretRow({ number, project, environment, entry, generated, busy, onRegenerate, rotateAfterDays, change, editing, canWrite, canArchive, canReveal, folders, onMove, lent, environments, status, disabled, onDismiss, columns, onFork, onEdit, onPatch, onUndo, onSave, versionOf, saveReady, onMarkArchive }) {
|
|
1757
|
+
function SecretRow({ number, project, environment, entry, generated, busy, onRegenerate, rotateAfterDays, change, editing, canWrite, canArchive, canReveal, canList, folders, onMove, lent, environments, status, disabled, onDismiss, columns, onFork, onEdit, onPatch, onUndo, onSave, versionOf, saveReady, onMarkArchive, personal }) {
|
|
1704
1758
|
const [reads, dispatch] = useReducer(rowReads, noReads);
|
|
1705
1759
|
const { reveal, revealing, error, copyError } = reads;
|
|
1706
1760
|
const setReveal = (next) => dispatch({
|
|
@@ -1717,16 +1771,25 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1717
1771
|
const [archiveBlocked, setArchiveBlocked] = useState(false);
|
|
1718
1772
|
const blockers = archiveBlockers(`${project}/${environment}/${entry.key}`, lent);
|
|
1719
1773
|
const { run: act, error: actError } = useAction();
|
|
1774
|
+
const [hiding, setHiding] = useState(false);
|
|
1720
1775
|
const { reference, parent } = entry;
|
|
1721
1776
|
const inherited = parent?.state === "inherited";
|
|
1722
1777
|
const removed = parent?.state === "removed";
|
|
1723
1778
|
const overridden = parent?.state === "overridden";
|
|
1724
1779
|
const own = !inherited && !removed;
|
|
1725
|
-
const
|
|
1726
|
-
const canRead =
|
|
1780
|
+
const sensitive = entry.sensitivity === "sensitive";
|
|
1781
|
+
const canRead = entry.readable;
|
|
1727
1782
|
const readVersion = reference === null ? entry.version : reference.version;
|
|
1728
1783
|
const readFrom = `${inherited ? parent.from : "."}:${reference?.source ?? ""}`;
|
|
1729
1784
|
const holderPath = `${project}/${environment}/${entry.key}`;
|
|
1785
|
+
const rowPlain = entry.value !== null;
|
|
1786
|
+
const rowLevel = entry.sensitivity;
|
|
1787
|
+
const level = change.sensitivity ?? rowLevel ?? "secret";
|
|
1788
|
+
const loosening = !(personal && inherited) && rowLevel !== null && stricter(rowLevel, level);
|
|
1789
|
+
const from = () => ({
|
|
1790
|
+
start: editBase?.value ?? "",
|
|
1791
|
+
level: rowLevel
|
|
1792
|
+
});
|
|
1730
1793
|
const [base, setBase] = useState(null);
|
|
1731
1794
|
const shown = revealIsCurrent(reveal, readVersion, readFrom) ? reveal : null;
|
|
1732
1795
|
useEffect(() => {
|
|
@@ -1770,6 +1833,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1770
1833
|
}
|
|
1771
1834
|
}
|
|
1772
1835
|
async function fetchValue() {
|
|
1836
|
+
if (entry.value !== null) return entry.value;
|
|
1773
1837
|
const { values } = await coffre.secrets.reveal(`${project}/${environment}/${entry.key}`);
|
|
1774
1838
|
return values[entry.key];
|
|
1775
1839
|
}
|
|
@@ -1798,24 +1862,41 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1798
1862
|
const [focusName, setFocusName] = useState(false);
|
|
1799
1863
|
async function startEdit({ name = false } = {}) {
|
|
1800
1864
|
setFocusName(name);
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
|
|
1807
|
-
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
at: Date.now()
|
|
1811
|
-
});
|
|
1812
|
-
}
|
|
1865
|
+
setOpening(entry.value === null && canRead);
|
|
1866
|
+
const value = await valueToEdit(entry, () => readValue({ show: false }));
|
|
1867
|
+
setOpening(false);
|
|
1868
|
+
if (value !== null) setBase({
|
|
1869
|
+
value,
|
|
1870
|
+
version: readVersion,
|
|
1871
|
+
from: readFrom,
|
|
1872
|
+
at: Date.now()
|
|
1873
|
+
});
|
|
1813
1874
|
setReveal(null);
|
|
1814
1875
|
onEdit();
|
|
1815
1876
|
}
|
|
1877
|
+
function chooseLevel(next) {
|
|
1878
|
+
if (entry.sensitivity === null || next === entry.sensitivity) return;
|
|
1879
|
+
if (stricter(entry.sensitivity, next)) {
|
|
1880
|
+
setFocusName(false);
|
|
1881
|
+
setReveal(null);
|
|
1882
|
+
onEdit();
|
|
1883
|
+
onPatch({ sensitivity: next });
|
|
1884
|
+
} else if (next === "sensitive") setHiding(true);
|
|
1885
|
+
else mark(next);
|
|
1886
|
+
}
|
|
1887
|
+
function mark(next) {
|
|
1888
|
+
setReveal(null);
|
|
1889
|
+
act(() => coffre.secrets.set(`${project}/${environment}`, { [entry.key]: { sensitivity: next } }), {
|
|
1890
|
+
affects: affects.secrets({
|
|
1891
|
+
project,
|
|
1892
|
+
environment
|
|
1893
|
+
}),
|
|
1894
|
+
onSuccess: () => toast.success(`Made ${entry.key} ${next}`)
|
|
1895
|
+
});
|
|
1896
|
+
}
|
|
1816
1897
|
const leaving = change.archived;
|
|
1817
1898
|
const renamed = change.key !== entry.key;
|
|
1818
|
-
const valueChanged = change.value !== null;
|
|
1899
|
+
const valueChanged = change.value !== null || change.sensitivity !== void 0;
|
|
1819
1900
|
const keyProblem = editing ? secretKeyProblem(change.key.trim()) : null;
|
|
1820
1901
|
const state = leaving ? " is-leaving" : editing && (renamed || valueChanged) ? " is-changed" : shown !== null ? " is-revealed" : removed ? " is-removed" : inherited ? " is-inherited" : "";
|
|
1821
1902
|
const version = entry.version ?? 0;
|
|
@@ -1857,6 +1938,19 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1857
1938
|
children: [
|
|
1858
1939
|
/* @__PURE__ */ jsx("span", { children: breakAfterUnderscores(entry.key) }),
|
|
1859
1940
|
generated !== null && /* @__PURE__ */ jsx(RecipeMark, { generated }),
|
|
1941
|
+
rowPlain && /* @__PURE__ */ jsx("span", {
|
|
1942
|
+
className: "tag",
|
|
1943
|
+
title: levelsIn(personal && own).plain.hint,
|
|
1944
|
+
children: "Plain"
|
|
1945
|
+
}),
|
|
1946
|
+
sensitive && /* @__PURE__ */ jsxs("span", {
|
|
1947
|
+
className: "tag",
|
|
1948
|
+
title: levelsIn(personal && own).sensitive.hint,
|
|
1949
|
+
children: [/* @__PURE__ */ jsx(Lock, {
|
|
1950
|
+
size: 11,
|
|
1951
|
+
"aria-hidden": true
|
|
1952
|
+
}), "Sensitive"]
|
|
1953
|
+
}),
|
|
1860
1954
|
leaving && /* @__PURE__ */ jsx("span", {
|
|
1861
1955
|
className: "tag tag-red",
|
|
1862
1956
|
children: "Will be archived"
|
|
@@ -1891,13 +1985,17 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1891
1985
|
children: [
|
|
1892
1986
|
/* @__PURE__ */ jsx(ValueField, {
|
|
1893
1987
|
label: `New value for ${entry.key}`,
|
|
1894
|
-
value: change.value ?? editBase?.value ?? "",
|
|
1895
|
-
start: editBase?.value,
|
|
1896
|
-
placeholder:
|
|
1988
|
+
value: change.value ?? (loosening ? "" : editBase?.value ?? ""),
|
|
1989
|
+
start: loosening ? void 0 : editBase?.value,
|
|
1990
|
+
placeholder: loosening ? "Its value, typed again" : editBase !== null ? "Value" : sensitive ? "Type a new value" : error !== null ? "New value; the current one could not be read" : canRead ? "New value" : "New value; the current one is hidden from you",
|
|
1991
|
+
plain: level === "plain",
|
|
1897
1992
|
disabled,
|
|
1898
1993
|
autoFocus: !focusName,
|
|
1899
1994
|
onChange: (value) => onPatch({
|
|
1900
|
-
|
|
1995
|
+
...valueEdit(from(), {
|
|
1996
|
+
value,
|
|
1997
|
+
sensitivity: level
|
|
1998
|
+
}),
|
|
1901
1999
|
companion: void 0,
|
|
1902
2000
|
recipe: void 0
|
|
1903
2001
|
}),
|
|
@@ -1909,10 +2007,31 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1909
2007
|
onUse: ({ value, companion, recipe }) => onPatch({
|
|
1910
2008
|
value,
|
|
1911
2009
|
companion,
|
|
1912
|
-
recipe
|
|
2010
|
+
recipe,
|
|
2011
|
+
sensitivity: level === "plain" ? "secret" : level
|
|
1913
2012
|
})
|
|
1914
2013
|
}
|
|
1915
2014
|
}),
|
|
2015
|
+
/* @__PURE__ */ jsx(SensitivityField, {
|
|
2016
|
+
name: change.key.trim() === "" ? entry.key : change.key.trim(),
|
|
2017
|
+
value: level,
|
|
2018
|
+
levels: levelsIn(personal),
|
|
2019
|
+
disabled,
|
|
2020
|
+
onChange: (next) => onPatch({
|
|
2021
|
+
...valueEdit(from(), {
|
|
2022
|
+
value: change.value,
|
|
2023
|
+
sensitivity: next
|
|
2024
|
+
}),
|
|
2025
|
+
...next === "plain" ? {
|
|
2026
|
+
companion: void 0,
|
|
2027
|
+
recipe: void 0
|
|
2028
|
+
} : {}
|
|
2029
|
+
})
|
|
2030
|
+
}),
|
|
2031
|
+
waitsForValue(entry, change) && /* @__PURE__ */ jsx("span", {
|
|
2032
|
+
className: "edit-note",
|
|
2033
|
+
children: loosening ? "Making it visible takes a new value: type it again." : "Type its value: only a value of its own here is marked."
|
|
2034
|
+
}),
|
|
1916
2035
|
/* @__PURE__ */ jsx(CompanionNote, {
|
|
1917
2036
|
companion: change.companion,
|
|
1918
2037
|
versionOf
|
|
@@ -1933,6 +2052,9 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1933
2052
|
})]
|
|
1934
2053
|
})
|
|
1935
2054
|
]
|
|
2055
|
+
}) : rowPlain && !leaving ? /* @__PURE__ */ jsx("span", {
|
|
2056
|
+
className: "revealed-value plain-value",
|
|
2057
|
+
children: entry.value === "" ? "(empty)" : entry.value
|
|
1936
2058
|
}) : shown !== null && !leaving ? /* @__PURE__ */ jsxs("div", {
|
|
1937
2059
|
className: "revealed",
|
|
1938
2060
|
style: { ["--reveal-ttl"]: `${REVEAL_TTL_SECONDS}s` },
|
|
@@ -1959,7 +2081,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1959
2081
|
children: "Not served here"
|
|
1960
2082
|
}) : reference !== null ? /* @__PURE__ */ jsx(ReferenceValue, { reference }) : /* @__PURE__ */ jsx("span", {
|
|
1961
2083
|
className: "mask",
|
|
1962
|
-
"aria-label": "Hidden",
|
|
2084
|
+
"aria-label": sensitive ? "Never shown" : "Hidden",
|
|
1963
2085
|
children: "••••••••••••"
|
|
1964
2086
|
})
|
|
1965
2087
|
}), status.state !== "pending" && /* @__PURE__ */ jsx("div", {
|
|
@@ -1995,7 +2117,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
1995
2117
|
copier,
|
|
1996
2118
|
onCopy: copyValue,
|
|
1997
2119
|
label: `Copy ${entry.key}`
|
|
1998
|
-
}), /* @__PURE__ */ jsx(Tip, {
|
|
2120
|
+
}), !rowPlain && /* @__PURE__ */ jsx(Tip, {
|
|
1999
2121
|
label: shown === null ? "Reveal" : "Hide",
|
|
2000
2122
|
children: /* @__PURE__ */ jsx("button", {
|
|
2001
2123
|
className: "act act-icon act-accent",
|
|
@@ -2048,7 +2170,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
2048
2170
|
}),
|
|
2049
2171
|
/* @__PURE__ */ jsx("td", {
|
|
2050
2172
|
className: "col-actions",
|
|
2051
|
-
children: status.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status }) : !removed && (
|
|
2173
|
+
children: status.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status }) : !removed && (canList || canWrite && !editing && !leaving || canArchive && !leaving && own && !overridden) && /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
2052
2174
|
className: "act act-icon act-quiet",
|
|
2053
2175
|
"aria-label": `More for ${entry.key}`,
|
|
2054
2176
|
disabled,
|
|
@@ -2057,7 +2179,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
2057
2179
|
align: "end",
|
|
2058
2180
|
children: [
|
|
2059
2181
|
/* @__PURE__ */ jsx(SecretReadOnly, {
|
|
2060
|
-
canReveal:
|
|
2182
|
+
canReveal: canList && own,
|
|
2061
2183
|
children: /* @__PURE__ */ jsxs(Menu.Item, {
|
|
2062
2184
|
className: "menu-item",
|
|
2063
2185
|
onClick: () => setHistoryOpen((open) => !open),
|
|
@@ -2120,6 +2242,28 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
2120
2242
|
onClick: () => setBreaking(holderPath),
|
|
2121
2243
|
children: [/* @__PURE__ */ jsx(SlashCircle, { size: 14 }), "Break reference…"]
|
|
2122
2244
|
}),
|
|
2245
|
+
canWrite && !editing && !leaving && markable(entry) && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Menu.Separator, { className: "menu-sep" }), /* @__PURE__ */ jsxs(Menu.RadioGroup, {
|
|
2246
|
+
value: entry.sensitivity,
|
|
2247
|
+
onValueChange: (next) => chooseLevel(next),
|
|
2248
|
+
children: [/* @__PURE__ */ jsx(Menu.GroupLabel, {
|
|
2249
|
+
className: "menu-label",
|
|
2250
|
+
children: "Who sees it"
|
|
2251
|
+
}), SENSITIVITIES.map((each) => /* @__PURE__ */ jsxs(Menu.RadioItem, {
|
|
2252
|
+
value: each,
|
|
2253
|
+
className: "menu-item menu-item-level",
|
|
2254
|
+
closeOnClick: true,
|
|
2255
|
+
children: [/* @__PURE__ */ jsxs("span", {
|
|
2256
|
+
className: "menu-item-text",
|
|
2257
|
+
children: [levelsIn(personal)[each].label, /* @__PURE__ */ jsx("span", {
|
|
2258
|
+
className: "menu-item-hint",
|
|
2259
|
+
children: levelsIn(personal)[each].hint
|
|
2260
|
+
})]
|
|
2261
|
+
}), /* @__PURE__ */ jsx(Menu.RadioItemIndicator, {
|
|
2262
|
+
className: "menu-check",
|
|
2263
|
+
children: /* @__PURE__ */ jsx(Check, { size: 14 })
|
|
2264
|
+
})]
|
|
2265
|
+
}, each))]
|
|
2266
|
+
})] }),
|
|
2123
2267
|
canArchive && !leaving && own && !overridden && /* @__PURE__ */ jsxs(Fragment$1, { children: [(canReveal || canWrite) && /* @__PURE__ */ jsx(Menu.Separator, { className: "menu-sep" }), /* @__PURE__ */ jsxs(Menu.Item, {
|
|
2124
2268
|
className: "menu-item menu-item-danger",
|
|
2125
2269
|
onClick: () => {
|
|
@@ -2182,6 +2326,22 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
2182
2326
|
confirmDisabled: blockers.length > 0,
|
|
2183
2327
|
onConfirm: onMarkArchive
|
|
2184
2328
|
}),
|
|
2329
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
2330
|
+
open: hiding,
|
|
2331
|
+
onOpenChange: setHiding,
|
|
2332
|
+
title: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2333
|
+
"Make ",
|
|
2334
|
+
/* @__PURE__ */ jsx("span", {
|
|
2335
|
+
className: "mono",
|
|
2336
|
+
children: entry.key
|
|
2337
|
+
}),
|
|
2338
|
+
" sensitive?"
|
|
2339
|
+
] }),
|
|
2340
|
+
body: "Nobody, Owners included, will see this value again. Apps use it through the proxy; service accounts still read it.",
|
|
2341
|
+
confirmLabel: "Make sensitive",
|
|
2342
|
+
destructive: false,
|
|
2343
|
+
onConfirm: () => mark("sensitive")
|
|
2344
|
+
}),
|
|
2185
2345
|
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
2186
2346
|
open: breaking !== null,
|
|
2187
2347
|
onOpenChange: (open) => !open && setBreaking(null),
|
|
@@ -2217,7 +2377,7 @@ function SecretRow({ number, project, environment, entry, generated, busy, onReg
|
|
|
2217
2377
|
folders,
|
|
2218
2378
|
onMove
|
|
2219
2379
|
}),
|
|
2220
|
-
historyOpen &&
|
|
2380
|
+
historyOpen && canList && /* @__PURE__ */ jsx("tr", {
|
|
2221
2381
|
className: "detail-row",
|
|
2222
2382
|
children: /* @__PURE__ */ jsx("td", {
|
|
2223
2383
|
colSpan: columns,
|
|
@@ -2381,12 +2541,7 @@ function Standing({ project, secretKey, parent }) {
|
|
|
2381
2541
|
});
|
|
2382
2542
|
case "removed": return /* @__PURE__ */ jsxs("span", {
|
|
2383
2543
|
className: "tag tag-outline",
|
|
2384
|
-
children: [
|
|
2385
|
-
"removed · ",
|
|
2386
|
-
from,
|
|
2387
|
-
" ",
|
|
2388
|
-
parent.held ? "has it" : "dropped it"
|
|
2389
|
-
]
|
|
2544
|
+
children: ["removed here · ", parent.held ? /* @__PURE__ */ jsxs(Fragment$1, { children: ["not inherited from ", from] }) : /* @__PURE__ */ jsxs(Fragment$1, { children: [from, " dropped it too"] })]
|
|
2390
2545
|
});
|
|
2391
2546
|
case "overridden": return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsxs("span", {
|
|
2392
2547
|
className: "tag tag-outline",
|
|
@@ -2480,13 +2635,47 @@ function Written({ entry, rotateAfterDays }) {
|
|
|
2480
2635
|
});
|
|
2481
2636
|
}
|
|
2482
2637
|
/**
|
|
2638
|
+
* Who sees the value being written, loosest first, and beside it what the
|
|
2639
|
+
* level pointed at, or else the one chosen, means. Native radios: the arrow
|
|
2640
|
+
* keys move the choice, and a screen reader hears one group of three.
|
|
2641
|
+
*/
|
|
2642
|
+
function SensitivityField({ name, value, levels, disabled, onChange }) {
|
|
2643
|
+
const id = useId();
|
|
2644
|
+
const [pointed, setPointed] = useState(null);
|
|
2645
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
2646
|
+
className: "edit-note sensitivity-field",
|
|
2647
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
2648
|
+
className: "segmented segmented-sm",
|
|
2649
|
+
role: "radiogroup",
|
|
2650
|
+
"aria-label": `Who sees ${name}`,
|
|
2651
|
+
"aria-describedby": `${id}-hint`,
|
|
2652
|
+
children: SENSITIVITIES.map((level) => /* @__PURE__ */ jsxs("label", {
|
|
2653
|
+
onPointerEnter: () => setPointed(level),
|
|
2654
|
+
onPointerLeave: () => setPointed(null),
|
|
2655
|
+
children: [/* @__PURE__ */ jsx("input", {
|
|
2656
|
+
type: "radio",
|
|
2657
|
+
className: "visually-hidden",
|
|
2658
|
+
name: id,
|
|
2659
|
+
value: level,
|
|
2660
|
+
checked: value === level,
|
|
2661
|
+
disabled,
|
|
2662
|
+
onChange: () => onChange(level)
|
|
2663
|
+
}), levels[level].label]
|
|
2664
|
+
}, level))
|
|
2665
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
2666
|
+
id: `${id}-hint`,
|
|
2667
|
+
children: levels[pointed ?? value].hint
|
|
2668
|
+
})]
|
|
2669
|
+
});
|
|
2670
|
+
}
|
|
2671
|
+
/**
|
|
2483
2672
|
* A secret being typed, sitting in the table where it will end up.
|
|
2484
2673
|
*
|
|
2485
2674
|
* This replaced a separate "Add a secret" form. The form made you look away
|
|
2486
2675
|
* from the list to add to it, and only ever accepted one key at a time; a row
|
|
2487
2676
|
* in place accepts as many as you want to queue.
|
|
2488
2677
|
*/
|
|
2489
|
-
function DraftRow({ draft, existingVersion, disabled, onChange, onRemove, onSave, versionOf, saveReady }) {
|
|
2678
|
+
function DraftRow({ draft, existingVersion, disabled, onChange, onRemove, onSave, versionOf, saveReady, personal }) {
|
|
2490
2679
|
const [touched, setTouched] = useState(false);
|
|
2491
2680
|
const trimmed = draft.key.trim();
|
|
2492
2681
|
const keyProblem = trimmed === "" ? touched ? "Give it a name." : null : secretKeyProblem(trimmed);
|
|
@@ -2533,32 +2722,48 @@ function DraftRow({ draft, existingVersion, disabled, onChange, onRemove, onSave
|
|
|
2533
2722
|
className: "value-content",
|
|
2534
2723
|
children: /* @__PURE__ */ jsxs("div", {
|
|
2535
2724
|
className: "edit-stack",
|
|
2536
|
-
children: [
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2725
|
+
children: [
|
|
2726
|
+
/* @__PURE__ */ jsx(ValueField, {
|
|
2727
|
+
label: `Value for ${trimmed === "" ? "the new secret" : trimmed}`,
|
|
2728
|
+
value: draft.value,
|
|
2729
|
+
plain: draft.sensitivity === "plain",
|
|
2730
|
+
placeholder: "Value",
|
|
2731
|
+
disabled,
|
|
2732
|
+
onChange: (value) => onChange({
|
|
2733
|
+
value,
|
|
2734
|
+
companion: void 0,
|
|
2735
|
+
recipe: void 0
|
|
2736
|
+
}),
|
|
2737
|
+
onEscape: onRemove,
|
|
2738
|
+
generate: {
|
|
2739
|
+
name: draft.key,
|
|
2740
|
+
renamable: true,
|
|
2741
|
+
companion: draft.companion,
|
|
2742
|
+
onUse: ({ value, name, companion, recipe }) => onChange({
|
|
2743
|
+
key: name,
|
|
2744
|
+
value,
|
|
2745
|
+
companion,
|
|
2746
|
+
recipe,
|
|
2747
|
+
sensitivity: draft.sensitivity === "plain" ? "secret" : draft.sensitivity
|
|
2748
|
+
})
|
|
2749
|
+
}
|
|
2750
|
+
}),
|
|
2751
|
+
/* @__PURE__ */ jsx(SensitivityField, {
|
|
2752
|
+
name: trimmed === "" ? "the new secret" : trimmed,
|
|
2753
|
+
value: draft.sensitivity,
|
|
2754
|
+
levels: levelsIn(personal),
|
|
2755
|
+
disabled,
|
|
2756
|
+
onChange: (sensitivity) => onChange(sensitivity === "plain" ? {
|
|
2757
|
+
sensitivity,
|
|
2758
|
+
companion: void 0,
|
|
2759
|
+
recipe: void 0
|
|
2760
|
+
} : { sensitivity })
|
|
2545
2761
|
}),
|
|
2546
|
-
|
|
2547
|
-
generate: {
|
|
2548
|
-
name: draft.key,
|
|
2549
|
-
renamable: true,
|
|
2762
|
+
/* @__PURE__ */ jsx(CompanionNote, {
|
|
2550
2763
|
companion: draft.companion,
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
companion,
|
|
2555
|
-
recipe
|
|
2556
|
-
})
|
|
2557
|
-
}
|
|
2558
|
-
}), /* @__PURE__ */ jsx(CompanionNote, {
|
|
2559
|
-
companion: draft.companion,
|
|
2560
|
-
versionOf
|
|
2561
|
-
})]
|
|
2764
|
+
versionOf
|
|
2765
|
+
})
|
|
2766
|
+
]
|
|
2562
2767
|
})
|
|
2563
2768
|
}), /* @__PURE__ */ jsxs("div", {
|
|
2564
2769
|
className: "acts value-acts",
|
|
@@ -2608,7 +2813,7 @@ function DraftRow({ draft, existingVersion, disabled, onChange, onRemove, onSave
|
|
|
2608
2813
|
]
|
|
2609
2814
|
});
|
|
2610
2815
|
}
|
|
2611
|
-
function ArchivedRow({ number, project, environment, entry, canArchive,
|
|
2816
|
+
function ArchivedRow({ number, project, environment, entry, canArchive, canList, status: state, onRestore, onDismiss }) {
|
|
2612
2817
|
const [historyOpen, setHistoryOpen] = useState(false);
|
|
2613
2818
|
return /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2614
2819
|
/* @__PURE__ */ jsxs("tr", {
|
|
@@ -2641,7 +2846,7 @@ function ArchivedRow({ number, project, environment, entry, canArchive, canRevea
|
|
|
2641
2846
|
}),
|
|
2642
2847
|
/* @__PURE__ */ jsx("td", {
|
|
2643
2848
|
className: "col-actions",
|
|
2644
|
-
children: state.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status: state }) : (
|
|
2849
|
+
children: state.state === "pending" ? /* @__PURE__ */ jsx(RowPending, { status: state }) : (canList || canArchive) && /* @__PURE__ */ jsx("div", {
|
|
2645
2850
|
className: "acts",
|
|
2646
2851
|
children: /* @__PURE__ */ jsxs(Menu.Root, { children: [/* @__PURE__ */ jsx(Menu.Trigger, {
|
|
2647
2852
|
className: "act act-icon act-quiet",
|
|
@@ -2650,13 +2855,13 @@ function ArchivedRow({ number, project, environment, entry, canArchive, canRevea
|
|
|
2650
2855
|
}), /* @__PURE__ */ jsxs(MenuPopup, {
|
|
2651
2856
|
align: "end",
|
|
2652
2857
|
children: [/* @__PURE__ */ jsx(SecretReadOnly, {
|
|
2653
|
-
canReveal,
|
|
2858
|
+
canReveal: canList,
|
|
2654
2859
|
children: /* @__PURE__ */ jsxs(Menu.Item, {
|
|
2655
2860
|
className: "menu-item",
|
|
2656
2861
|
onClick: () => setHistoryOpen((open) => !open),
|
|
2657
2862
|
children: [/* @__PURE__ */ jsx(History, { size: 14 }), historyOpen ? "Hide history" : "Version history"]
|
|
2658
2863
|
})
|
|
2659
|
-
}), canArchive && /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
2864
|
+
}), canArchive && /* @__PURE__ */ jsxs(Fragment$1, { children: [canList && /* @__PURE__ */ jsx(Menu.Separator, { className: "menu-sep" }), /* @__PURE__ */ jsxs(Menu.Item, {
|
|
2660
2865
|
className: "menu-item",
|
|
2661
2866
|
onClick: onRestore,
|
|
2662
2867
|
children: [/* @__PURE__ */ jsx(RotateBack, { size: 14 }), "Restore"]
|
|
@@ -2775,7 +2980,12 @@ function VersionHistory({ project, environment, secretKey, currentVersion, canWr
|
|
|
2775
2980
|
version.current && /* @__PURE__ */ jsx("span", {
|
|
2776
2981
|
className: "tag tag-blue",
|
|
2777
2982
|
children: "Current"
|
|
2778
|
-
})
|
|
2983
|
+
}),
|
|
2984
|
+
version.sensitivity !== "secret" && /* @__PURE__ */ jsxs(Fragment$1, { children: [" ", /* @__PURE__ */ jsx("span", {
|
|
2985
|
+
className: "tag",
|
|
2986
|
+
title: LEVELS[version.sensitivity].hint,
|
|
2987
|
+
children: LEVELS[version.sensitivity].label
|
|
2988
|
+
})] })
|
|
2779
2989
|
]
|
|
2780
2990
|
}),
|
|
2781
2991
|
/* @__PURE__ */ jsx("td", {
|