@coffre/ui 0.9.0 → 0.10.1
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-JrQIUq6j.js → audit-sentence-DpYySuqg.js} +74 -7
- package/dist/chunks/audit-sentence-DpYySuqg.js.map +1 -0
- package/dist/chunks/{connected-apps-Dr8UgjK7.js → connected-apps-D48SFJsG.js} +4 -4
- package/dist/chunks/{connected-apps-Dr8UgjK7.js.map → connected-apps-D48SFJsG.js.map} +1 -1
- package/dist/chunks/{delete-place-CQCDHkne.js → delete-place-Cg_M6rAq.js} +4 -4
- package/dist/chunks/{delete-place-CQCDHkne.js.map → delete-place-Cg_M6rAq.js.map} +1 -1
- package/dist/chunks/{directory-XcSbDRJv.js → directory-_LTgdiIM.js} +11 -9
- package/dist/chunks/directory-_LTgdiIM.js.map +1 -0
- package/dist/chunks/{folders-Dw240WMJ.js → folders-D3A1NGpt.js} +2 -2
- package/dist/chunks/{folders-Dw240WMJ.js.map → folders-D3A1NGpt.js.map} +1 -1
- package/dist/chunks/{grants-CmdZjKYU.js → grants-CNM913EY.js} +6 -6
- package/dist/chunks/{grants-CmdZjKYU.js.map → grants-CNM913EY.js.map} +1 -1
- package/dist/chunks/{multi-combobox-CsIXihuc.js → multi-combobox-B0JzP1QN.js} +2 -2
- package/dist/chunks/{multi-combobox-CsIXihuc.js.map → multi-combobox-B0JzP1QN.js.map} +1 -1
- package/dist/chunks/{offboarding-CrgwaetA.js → offboarding-BeaNM3sf.js} +3 -3
- package/dist/chunks/{offboarding-CrgwaetA.js.map → offboarding-BeaNM3sf.js.map} +1 -1
- package/dist/chunks/{personal-tokens-Dvl1FktE.js → personal-tokens-KsXajpx4.js} +4 -4
- package/dist/chunks/{personal-tokens-Dvl1FktE.js.map → personal-tokens-KsXajpx4.js.map} +1 -1
- package/dist/chunks/{principal-page-bOaEYWJB.js → principal-page-BaiZXh6D.js} +94 -78
- package/dist/chunks/principal-page-BaiZXh6D.js.map +1 -0
- package/dist/chunks/{project-page-BI--vjt3.js → project-page-CYZ_MkfX.js} +2 -2
- package/dist/chunks/{project-page-BI--vjt3.js.map → project-page-CYZ_MkfX.js.map} +1 -1
- package/dist/chunks/protected-BL_DsZO6.js +22 -0
- package/dist/chunks/protected-BL_DsZO6.js.map +1 -0
- package/dist/chunks/{queries-epz4MIuW.js → queries-Danu0o75.js} +99 -31
- package/dist/chunks/queries-Danu0o75.js.map +1 -0
- package/dist/chunks/{references-DImfw0cz.js → references-BK2aPXae.js} +4 -4
- package/dist/chunks/{references-DImfw0cz.js.map → references-BK2aPXae.js.map} +1 -1
- package/dist/chunks/{role-field-C1KhNaIR.js → role-field-DIJiRz9B.js} +8 -5
- package/dist/chunks/role-field-DIJiRz9B.js.map +1 -0
- package/dist/chunks/{row-state-BsIHspy4.js → row-state-xtRGFnDc.js} +2 -2
- package/dist/chunks/{row-state-BsIHspy4.js.map → row-state-xtRGFnDc.js.map} +1 -1
- package/dist/chunks/{theme-3b4DnCow.js → theme-Ck45wzWB.js} +2 -2
- package/dist/chunks/{theme-3b4DnCow.js.map → theme-Ck45wzWB.js.map} +1 -1
- package/dist/chunks/{ui-2kwXXfrX.js → ui-D-blFWfx.js} +29 -5
- package/dist/chunks/{ui-2kwXXfrX.js.map → ui-D-blFWfx.js.map} +1 -1
- package/dist/chunks/{use-action-BB-RcHo1.js → use-action-BafZVwux.js} +2 -2
- package/dist/chunks/{use-action-BB-RcHo1.js.map → use-action-BafZVwux.js.map} +1 -1
- package/dist/chunks/{use-change-BY6KPmnJ.js → use-change-DhV6i_Ge.js} +218 -101
- package/dist/chunks/use-change-DhV6i_Ge.js.map +1 -0
- package/dist/chunks/use-roles-Daje0ikO.js +224 -0
- package/dist/chunks/use-roles-Daje0ikO.js.map +1 -0
- package/dist/chunks/{use-shell-C_NmvCt_.js → use-shell-BX9mzfaL.js} +2 -2
- package/dist/chunks/{use-shell-C_NmvCt_.js.map → use-shell-BX9mzfaL.js.map} +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +29 -15
- package/dist/index.js.map +1 -1
- package/dist/pages/account.js +9 -9
- package/dist/pages/approval.js +1 -1
- package/dist/pages/audit.js +96 -34
- package/dist/pages/audit.js.map +1 -1
- package/dist/pages/device-login.js +1 -1
- package/dist/pages/environment.js +255 -115
- 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 +79 -46
- package/dist/pages/project-access.js.map +1 -1
- package/dist/pages/project-environments.js +79 -30
- package/dist/pages/project-environments.js.map +1 -1
- package/dist/pages/project-settings.js +7 -7
- package/dist/pages/project.js +2 -2
- package/dist/pages/projects.js +26 -14
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.js +22 -15
- 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/components/ui.tsx +25 -2
- package/src/lib/access-plan.ts +35 -36
- package/src/lib/audit-sentences.ts +75 -9
- package/src/lib/changes.ts +46 -8
- package/src/lib/project-access.ts +4 -78
- package/src/lib/queries.ts +97 -29
- package/src/lib/roles.ts +201 -0
- package/src/lib/row-reads.ts +12 -0
- package/src/lib/secret-edit-batch.ts +147 -56
- 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/options.ts +2 -3
- package/src/pages/audit.tsx +99 -26
- package/src/pages/environment.tsx +264 -101
- 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 +42 -5
- package/src/shared/models.ts +2 -9
- package/src/styles/globals.css +322 -25
- package/dist/chunks/audit-sentence-JrQIUq6j.js.map +0 -1
- package/dist/chunks/directory-XcSbDRJv.js.map +0 -1
- package/dist/chunks/principal-page-bOaEYWJB.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-BY6KPmnJ.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ageInDays, byFolder, CoffreError, foldersOf, olderThan, planImport, shownMember, type CoffreClient, type ListedReference } from '@coffre/client';
|
|
2
2
|
import { parseDotenv } from '@coffre/core/dotenv';
|
|
3
3
|
import type { Generation } from '@coffre/core/recipe';
|
|
4
|
-
import { useEffect, useReducer, useRef, useState, type ReactNode } from 'react';
|
|
4
|
+
import { useEffect, useId, useReducer, useRef, useState, type ReactNode } from 'react';
|
|
5
5
|
import { useQuery, useQueryClient, useSuspenseQuery } from '@tanstack/react-query';
|
|
6
6
|
import { Link, useNavigate } from '@tanstack/react-router';
|
|
7
7
|
import { useShell } from '../lib/use-shell';
|
|
@@ -20,11 +20,14 @@ import type {
|
|
|
20
20
|
Permission,
|
|
21
21
|
SecretKey,
|
|
22
22
|
SecretVersion,
|
|
23
|
+
Sensitivity,
|
|
23
24
|
} from '../shared/models';
|
|
24
25
|
import { canRevealSecrets } from '../lib/capabilities';
|
|
26
|
+
import { LEVELS, levelsIn, markable, SENSITIVITIES, stricter, waitsForValue } from '../lib/sensitivity';
|
|
25
27
|
import {
|
|
26
28
|
companionsOf,
|
|
27
29
|
hasSecretEditConflict,
|
|
30
|
+
madeSensitive,
|
|
28
31
|
secretChangeFor,
|
|
29
32
|
valueEdit,
|
|
30
33
|
type Companion,
|
|
@@ -33,7 +36,7 @@ import {
|
|
|
33
36
|
} from '../lib/secret-edit-batch';
|
|
34
37
|
import { createCopier } from '../lib/copy-attempts';
|
|
35
38
|
import { revealIsCurrent, type Reveal } from '../lib/reveal';
|
|
36
|
-
import { noReads, revealToggleDisabled, rowReads } from '../lib/row-reads';
|
|
39
|
+
import { noReads, revealToggleDisabled, rowReads, valueToEdit } from '../lib/row-reads';
|
|
37
40
|
import { sortKeys, type Sort } from '../lib/secret-order';
|
|
38
41
|
import { inDialog } from '../lib/shortcuts';
|
|
39
42
|
import { folderProblem, secretKeyProblem } from '../lib/validation';
|
|
@@ -52,6 +55,7 @@ import {
|
|
|
52
55
|
Tip,
|
|
53
56
|
} from '../components/ui';
|
|
54
57
|
import { Card, ClosedDoor, PageHeader } from '../components/page';
|
|
58
|
+
import { ProtectedTag } from '../components/protected';
|
|
55
59
|
import { SecretReadOnly } from '../components/affordances';
|
|
56
60
|
import { GenerateValue, type GeneratedUse } from '../components/generate-value';
|
|
57
61
|
import { RecipeMark, RegenerateSecret } from '../components/regenerate';
|
|
@@ -150,6 +154,7 @@ export function EnvironmentPage() {
|
|
|
150
154
|
keys={result.keys}
|
|
151
155
|
parents={result.parents ?? []}
|
|
152
156
|
personal={result.personal != null}
|
|
157
|
+
guarded={result.protected}
|
|
153
158
|
rotateAfterDays={result.rotateAfterDays}
|
|
154
159
|
/>
|
|
155
160
|
);
|
|
@@ -164,6 +169,7 @@ function EnvironmentLedger({
|
|
|
164
169
|
keys,
|
|
165
170
|
parents,
|
|
166
171
|
personal,
|
|
172
|
+
guarded,
|
|
167
173
|
rotateAfterDays,
|
|
168
174
|
}: {
|
|
169
175
|
project: string;
|
|
@@ -174,6 +180,8 @@ function EnvironmentLedger({
|
|
|
174
180
|
parents: string[];
|
|
175
181
|
/** Your personal config, `dev@me`: its values yours alone. */
|
|
176
182
|
personal: boolean;
|
|
183
|
+
/** Protected (docs/design/roles.md): you hold your role's protected column here, a personal config as its parent. */
|
|
184
|
+
guarded: boolean;
|
|
177
185
|
/** Days a value may go unchanged before it is flagged for rotation; null for no flag. */
|
|
178
186
|
rotateAfterDays: number | null;
|
|
179
187
|
}) {
|
|
@@ -211,6 +219,14 @@ function EnvironmentLedger({
|
|
|
211
219
|
// pending change is in edit mode whether or not it is listed here.
|
|
212
220
|
const [editing, setEditing] = useState<ReadonlySet<string>>(() => new Set());
|
|
213
221
|
const [saveError, setSaveError] = useState<string | null>(null);
|
|
222
|
+
// A save that makes keys sensitive, waiting for its confirmation: nobody sees them again, which the row's menu asks too.
|
|
223
|
+
const [hiding, setHiding] = useState<{ keys: string[]; go: () => void } | null>(null);
|
|
224
|
+
// Every key the save writes counts, a key pair's public key included.
|
|
225
|
+
function confirmingSensitive(drafts: readonly SecretDraft[], changes: Record<string, SecretChange>, go: () => void) {
|
|
226
|
+
const keys = madeSensitive(active, drafts, changes);
|
|
227
|
+
if (keys.length === 0) go();
|
|
228
|
+
else setHiding({ keys, go });
|
|
229
|
+
}
|
|
214
230
|
const [query, setQuery] = useState(Route.useSearch().filter ?? '');
|
|
215
231
|
const [sort, setSort] = useState<Sort>({ by: 'key', descending: false });
|
|
216
232
|
// A column's first click sorts it ascending: names A to Z, the oldest values first.
|
|
@@ -221,6 +237,8 @@ function EnvironmentLedger({
|
|
|
221
237
|
const canWrite = permissions.includes('secret.write');
|
|
222
238
|
const canArchive = permissions.includes('secret.archive');
|
|
223
239
|
const canReveal = canRevealSecrets(permissions);
|
|
240
|
+
// What a Contributor does without reading: lists the keys, their history, and keeps a personal config.
|
|
241
|
+
const canList = canReveal || permissions.includes('secret.use');
|
|
224
242
|
|
|
225
243
|
// Listed by folder: those in none first, then each folder by name.
|
|
226
244
|
const active = byFolder(keys.filter((entry) => !entry.archived)).flatMap(([, entries]) => entries);
|
|
@@ -280,8 +298,10 @@ function EnvironmentLedger({
|
|
|
280
298
|
];
|
|
281
299
|
const unnamed = pendingNames.some((name) => name === '');
|
|
282
300
|
const invalid = pendingNames.some((name) => name !== '' && secretKeyProblem(name) !== null);
|
|
301
|
+
// A key made more visible, or marked where it holds no value of its own, waits for its value typed.
|
|
302
|
+
const waiting = changedEntries.find((entry) => waitsForValue(entry, secretChangeFor(changes, entry.key)));
|
|
283
303
|
const pendingCount = drafts.length + changedEntries.length;
|
|
284
|
-
const ready = pendingCount > 0 && !unnamed && !invalid && !hasConflict;
|
|
304
|
+
const ready = pendingCount > 0 && !unnamed && !invalid && !hasConflict && waiting === undefined;
|
|
285
305
|
|
|
286
306
|
function patchChange(entry: SecretKey, patch: Partial<SecretChange>) {
|
|
287
307
|
setChanges((current) => {
|
|
@@ -293,7 +313,7 @@ function EnvironmentLedger({
|
|
|
293
313
|
}),
|
|
294
314
|
...patch,
|
|
295
315
|
};
|
|
296
|
-
const dirty = next.key !== entry.key || next.value !== null || next.archived;
|
|
316
|
+
const dirty = next.key !== entry.key || next.value !== null || next.sensitivity !== undefined || next.archived;
|
|
297
317
|
if (dirty) return { ...current, [entry.key]: next };
|
|
298
318
|
const { [entry.key]: _, ...rest } = current;
|
|
299
319
|
return rest;
|
|
@@ -306,14 +326,18 @@ function EnvironmentLedger({
|
|
|
306
326
|
*/
|
|
307
327
|
function saveRow(key: string) {
|
|
308
328
|
const change = secretChangeFor(changes, key);
|
|
309
|
-
dropChange(key);
|
|
310
|
-
|
|
311
|
-
|
|
329
|
+
if (change === undefined) return dropChange(key);
|
|
330
|
+
confirmingSensitive([], { [key]: change }, () => {
|
|
331
|
+
dropChange(key);
|
|
332
|
+
sendAlone({ active, drafts: [], changes: { [key]: change } });
|
|
333
|
+
});
|
|
312
334
|
}
|
|
313
335
|
|
|
314
336
|
function saveDraft(draft: SecretDraft) {
|
|
315
|
-
|
|
316
|
-
|
|
337
|
+
confirmingSensitive([draft], {}, () => {
|
|
338
|
+
setDrafts((rows) => rows.filter((row) => row.id !== draft.id));
|
|
339
|
+
sendAlone({ active, drafts: [draft], changes: {} });
|
|
340
|
+
});
|
|
317
341
|
}
|
|
318
342
|
|
|
319
343
|
/** Whether one row's change could go alone: named, well named, and clashing with nothing. */
|
|
@@ -326,7 +350,8 @@ function EnvironmentLedger({
|
|
|
326
350
|
return (
|
|
327
351
|
(drafts.length > 0 || Object.keys(changes).length > 0) &&
|
|
328
352
|
names.every((name) => name !== '' && secretKeyProblem(name) === null) &&
|
|
329
|
-
!hasSecretEditConflict(active, drafts, changes)
|
|
353
|
+
!hasSecretEditConflict(active, drafts, changes) &&
|
|
354
|
+
!active.some((entry) => waitsForValue(entry, secretChangeFor(changes, entry.key)))
|
|
330
355
|
);
|
|
331
356
|
}
|
|
332
357
|
|
|
@@ -358,7 +383,7 @@ function EnvironmentLedger({
|
|
|
358
383
|
|
|
359
384
|
function addDraft(key = '') {
|
|
360
385
|
// New rows go last, by the button that made them, in the order they were added.
|
|
361
|
-
setDrafts((rows) => [...rows, { id: nextDraftId.current++, key, value: '' }]);
|
|
386
|
+
setDrafts((rows) => [...rows, { id: nextDraftId.current++, key, value: '', sensitivity: 'secret' }]);
|
|
362
387
|
}
|
|
363
388
|
|
|
364
389
|
function discardAll() {
|
|
@@ -387,6 +412,10 @@ function EnvironmentLedger({
|
|
|
387
412
|
*/
|
|
388
413
|
function saveChanges() {
|
|
389
414
|
if (!ready) return;
|
|
415
|
+
confirmingSensitive(drafts, changes, sendChanges);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
function sendChanges() {
|
|
390
419
|
const batch = { active, drafts, changes };
|
|
391
420
|
setDrafts([]);
|
|
392
421
|
setChanges({});
|
|
@@ -473,13 +502,15 @@ function EnvironmentLedger({
|
|
|
473
502
|
const change = secretChangeFor(changes, entry.key)!;
|
|
474
503
|
if (change.archived) return { key: entry.key, what: 'archived' };
|
|
475
504
|
const renamed = change.key.trim() !== entry.key;
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
505
|
+
// Who sees it, where the edit changes that: beside a new value, or alone, a mark.
|
|
506
|
+
const level = change.sensitivity === undefined || change.sensitivity === entry.sensitivity ? null : change.sensitivity;
|
|
507
|
+
const written = change.value === null
|
|
508
|
+
? (level === null ? null : `made ${level}`)
|
|
509
|
+
: withCompanion(level === null ? 'new value' : `new value, ${level}`, change.companion);
|
|
510
|
+
if (renamed) return { key: entry.key, what: written === null ? `→ ${change.key.trim()}` : `→ ${change.key.trim()}, ${written}` };
|
|
480
511
|
// In a fork, a value written over the parent's overrides it.
|
|
481
512
|
if (entry.parent !== null && entry.parent.state !== 'overridden') return { key: entry.key, what: withCompanion(`overrides ${entry.parent.from}`, change.companion) };
|
|
482
|
-
return { key: entry.key, what:
|
|
513
|
+
return { key: entry.key, what: written ?? 'new value' };
|
|
483
514
|
}),
|
|
484
515
|
];
|
|
485
516
|
|
|
@@ -491,7 +522,9 @@ function EnvironmentLedger({
|
|
|
491
522
|
? 'Two pending edits would end up with the same name. Secret names are unique in an environment.'
|
|
492
523
|
: invalid
|
|
493
524
|
? 'Names are letters, digits and underscores, and cannot start with a digit.'
|
|
494
|
-
:
|
|
525
|
+
: waiting !== undefined
|
|
526
|
+
? `${waiting.key} waits for its value: type it again.`
|
|
527
|
+
: null;
|
|
495
528
|
|
|
496
529
|
// Filtering narrows what is listed, never what is saved: a pending edit on
|
|
497
530
|
// a row the filter hides still counts, and still shows in the bar under the table.
|
|
@@ -507,9 +540,10 @@ function EnvironmentLedger({
|
|
|
507
540
|
<PageHeader
|
|
508
541
|
tile={project}
|
|
509
542
|
title={environment}
|
|
543
|
+
aside={guarded && <ProtectedTag />}
|
|
510
544
|
actions={personal ? (
|
|
511
545
|
<DeletePersonal project={project} environment={environment} of={parents[0]!} />
|
|
512
|
-
) : principal?.type === 'user' &&
|
|
546
|
+
) : principal?.type === 'user' && canList && (
|
|
513
547
|
<Link className="btn btn-sm" to="/projects/$project/$environment" params={{ project, environment: `${environment}@me` }}>
|
|
514
548
|
<Key size={14} />
|
|
515
549
|
My own {environment}
|
|
@@ -521,7 +555,7 @@ function EnvironmentLedger({
|
|
|
521
555
|
<Link className="mono" to="/projects/$project/$environment" params={{ project, environment: parents[0]! }}>
|
|
522
556
|
{project}/{parents[0]}
|
|
523
557
|
</Link>
|
|
524
|
-
: what you set here
|
|
558
|
+
: what you set here is yours alone, while you read or use {parents[0]}; the rest is {parents[0]}'s, as it changes.
|
|
525
559
|
</span>
|
|
526
560
|
) : parents.length > 0 && (
|
|
527
561
|
<span className="inherits">
|
|
@@ -651,6 +685,7 @@ function EnvironmentLedger({
|
|
|
651
685
|
canWrite={canWrite}
|
|
652
686
|
canArchive={canArchive}
|
|
653
687
|
canReveal={canReveal}
|
|
688
|
+
canList={canList}
|
|
654
689
|
folders={folders}
|
|
655
690
|
onMove={(folder) => move({ key: entry.key, folder })}
|
|
656
691
|
lent={lentBy.get(entry.key) ?? []}
|
|
@@ -728,6 +763,20 @@ function EnvironmentLedger({
|
|
|
728
763
|
)}
|
|
729
764
|
</section>
|
|
730
765
|
|
|
766
|
+
<ConfirmDialog
|
|
767
|
+
open={hiding !== null}
|
|
768
|
+
onOpenChange={(open) => !open && setHiding(null)}
|
|
769
|
+
title={hiding?.keys.length === 1 ? <>Make <span className="mono">{hiding.keys[0]}</span> sensitive?</> : `Make ${hiding?.keys.length ?? 0} keys sensitive?`}
|
|
770
|
+
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'}.`}
|
|
771
|
+
confirmLabel="Make sensitive"
|
|
772
|
+
destructive={false}
|
|
773
|
+
onConfirm={() => {
|
|
774
|
+
const go = hiding?.go;
|
|
775
|
+
setHiding(null);
|
|
776
|
+
go?.();
|
|
777
|
+
}}
|
|
778
|
+
/>
|
|
779
|
+
|
|
731
780
|
{canWrite && (
|
|
732
781
|
<div className="table-actions">
|
|
733
782
|
<AddButton onAddSecret={() => addDraft()} onAddFolder={() => setAddingFolder(true)} canAddFolder={settled.length > 0} />
|
|
@@ -791,7 +840,7 @@ function EnvironmentLedger({
|
|
|
791
840
|
environment={environment}
|
|
792
841
|
entry={entry}
|
|
793
842
|
canArchive={canArchive}
|
|
794
|
-
|
|
843
|
+
canList={canList}
|
|
795
844
|
status={status(entry.key)}
|
|
796
845
|
onRestore={() => restoreSecretKey(entry.key)}
|
|
797
846
|
onDismiss={dismiss}
|
|
@@ -1175,6 +1224,7 @@ function SecretRow({
|
|
|
1175
1224
|
canWrite,
|
|
1176
1225
|
canArchive,
|
|
1177
1226
|
canReveal,
|
|
1227
|
+
canList,
|
|
1178
1228
|
folders,
|
|
1179
1229
|
onMove,
|
|
1180
1230
|
lent,
|
|
@@ -1209,6 +1259,8 @@ function SecretRow({
|
|
|
1209
1259
|
canWrite: boolean;
|
|
1210
1260
|
canArchive: boolean;
|
|
1211
1261
|
canReveal: boolean;
|
|
1262
|
+
/** Whether the caller lists the environment: reads it, or uses it as a Contributor does. */
|
|
1263
|
+
canList: boolean;
|
|
1212
1264
|
/** The folders in use in this environment, offered when moving it. */
|
|
1213
1265
|
folders: readonly string[];
|
|
1214
1266
|
onMove: (folder: string | null) => void;
|
|
@@ -1233,7 +1285,7 @@ function SecretRow({
|
|
|
1233
1285
|
versionOf: (key: string) => number | null;
|
|
1234
1286
|
saveReady: boolean;
|
|
1235
1287
|
onMarkArchive: () => void;
|
|
1236
|
-
/** In
|
|
1288
|
+
/** In your personal config, `dev@me`, whose overrides are your own values. */
|
|
1237
1289
|
personal: boolean;
|
|
1238
1290
|
}) {
|
|
1239
1291
|
const [reads, dispatch] = useReducer(rowReads, noReads);
|
|
@@ -1249,8 +1301,10 @@ function SecretRow({
|
|
|
1249
1301
|
// Archiving a key others read through references waits until they are broken (D41).
|
|
1250
1302
|
const [archiveBlocked, setArchiveBlocked] = useState(false);
|
|
1251
1303
|
const blockers = archiveBlockers(`${project}/${environment}/${entry.key}`, lent);
|
|
1252
|
-
// Making or breaking a reference: its refusal shows under the row, as a reveal's does.
|
|
1304
|
+
// Making or breaking a reference, or marking it: its refusal shows under the row, as a reveal's does.
|
|
1253
1305
|
const { run: act, error: actError } = useAction();
|
|
1306
|
+
// Made sensitive from the menu, once confirmed: nobody sees its value after.
|
|
1307
|
+
const [hiding, setHiding] = useState(false);
|
|
1254
1308
|
const { reference, parent } = entry;
|
|
1255
1309
|
// In a fork (docs/design/forking.md): a key it inherits has no row of its
|
|
1256
1310
|
// own, one it overrides has, and one it removed is not served.
|
|
@@ -1258,9 +1312,10 @@ function SecretRow({
|
|
|
1258
1312
|
const removed = parent?.state === 'removed';
|
|
1259
1313
|
const overridden = parent?.state === 'overridden';
|
|
1260
1314
|
const own = !inherited && !removed;
|
|
1261
|
-
//
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1315
|
+
// A sensitive value is shown to nobody, its readers included: no Reveal, no Copy, and an edit starts empty.
|
|
1316
|
+
const sensitive = entry.sensitivity === 'sensitive';
|
|
1317
|
+
// Read where it is held: inherited, on its parent, which a Contributor's dev@me tells of and does not read.
|
|
1318
|
+
const canRead = entry.readable;
|
|
1264
1319
|
// What a reveal shows: its own version, or, as a reference, its source's.
|
|
1265
1320
|
const readVersion = reference === null ? entry.version : reference.version;
|
|
1266
1321
|
// And where that version is held: a reset, an override or a new reference changes it under the same number.
|
|
@@ -1268,11 +1323,14 @@ function SecretRow({
|
|
|
1268
1323
|
const holderPath = `${project}/${environment}/${entry.key}`;
|
|
1269
1324
|
// A plain value is no secret: listed as it is, shown inline and copied with no read.
|
|
1270
1325
|
const rowPlain = entry.value !== null;
|
|
1271
|
-
//
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
const
|
|
1275
|
-
|
|
1326
|
+
// Who sees its value now, and who will once the edit is saved. In a personal config, an override of a key it inherits
|
|
1327
|
+
// starts at that key's level, as the API writes one that says nothing (decision 27).
|
|
1328
|
+
const rowLevel = entry.sensitivity;
|
|
1329
|
+
const level = change.sensitivity ?? rowLevel ?? 'secret';
|
|
1330
|
+
// More visible than it is: the value is typed again, never shown and kept. Not an override in your personal config,
|
|
1331
|
+
// a value of your own, which nobody else sees: what it inherits stays as it is.
|
|
1332
|
+
const loosening = !(personal && inherited) && rowLevel !== null && stricter(rowLevel, level);
|
|
1333
|
+
const from = () => ({ start: editBase?.value ?? '', level: rowLevel });
|
|
1276
1334
|
// The current value, loaded on request as the starting point for an edit.
|
|
1277
1335
|
// It is not a change until it is edited: saving it untouched would append a
|
|
1278
1336
|
// version identical to the one it came from.
|
|
@@ -1362,28 +1420,47 @@ function SecretRow({
|
|
|
1362
1420
|
}
|
|
1363
1421
|
|
|
1364
1422
|
// An edit starts from the current value, read the way Reveal reads it, so
|
|
1365
|
-
// the audit log shows who opened it. One
|
|
1423
|
+
// the audit log shows who opened it. One its editor does not read starts
|
|
1424
|
+
// empty: sensitive, a parent's in a Contributor's dev@me, overridden unread,
|
|
1425
|
+
// or one whose read failed, its reason under the row (`valueToEdit`).
|
|
1366
1426
|
const [opening, setOpening] = useState(false);
|
|
1367
1427
|
// Rename opens the same editor, its name field focused rather than its value.
|
|
1368
1428
|
const [focusName, setFocusName] = useState(false);
|
|
1369
1429
|
async function startEdit({ name = false } = {}) {
|
|
1370
1430
|
setFocusName(name);
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
const value = await readValue({ show: false });
|
|
1376
|
-
setOpening(false);
|
|
1377
|
-
if (value === null) return;
|
|
1378
|
-
setBase({ value, version: readVersion, from: readFrom, at: Date.now() });
|
|
1379
|
-
}
|
|
1431
|
+
setOpening(entry.value === null && canRead);
|
|
1432
|
+
const value = await valueToEdit(entry, () => readValue({ show: false }));
|
|
1433
|
+
setOpening(false);
|
|
1434
|
+
if (value !== null) setBase({ value, version: readVersion, from: readFrom, at: Date.now() });
|
|
1380
1435
|
setReveal(null);
|
|
1381
1436
|
onEdit();
|
|
1382
1437
|
}
|
|
1383
1438
|
|
|
1439
|
+
// Who sees it, chosen from its menu: stricter at once, its value kept; more
|
|
1440
|
+
// visible in the editor, which asks for the value typed again.
|
|
1441
|
+
function chooseLevel(next: Sensitivity) {
|
|
1442
|
+
if (entry.sensitivity === null || next === entry.sensitivity) return;
|
|
1443
|
+
if (stricter(entry.sensitivity, next)) {
|
|
1444
|
+
setFocusName(false);
|
|
1445
|
+
setReveal(null);
|
|
1446
|
+
onEdit();
|
|
1447
|
+
onPatch({ sensitivity: next });
|
|
1448
|
+
} else if (next === 'sensitive') setHiding(true);
|
|
1449
|
+
else mark(next);
|
|
1450
|
+
}
|
|
1451
|
+
|
|
1452
|
+
function mark(next: Sensitivity) {
|
|
1453
|
+
setReveal(null);
|
|
1454
|
+
act(() => coffre.secrets.set(`${project}/${environment}`, { [entry.key]: { sensitivity: next } }), {
|
|
1455
|
+
affects: affects.secrets({ project, environment }),
|
|
1456
|
+
onSuccess: () => toast.success(`Made ${entry.key} ${next}`),
|
|
1457
|
+
});
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1384
1460
|
const leaving = change.archived;
|
|
1385
1461
|
const renamed = change.key !== entry.key;
|
|
1386
|
-
|
|
1462
|
+
// A new value, or a level alone, a mark: either makes a new version.
|
|
1463
|
+
const valueChanged = change.value !== null || change.sensitivity !== undefined;
|
|
1387
1464
|
const keyProblem = editing ? secretKeyProblem(change.key.trim()) : null;
|
|
1388
1465
|
const state = leaving
|
|
1389
1466
|
? ' is-leaving'
|
|
@@ -1434,7 +1511,13 @@ function SecretRow({
|
|
|
1434
1511
|
<div className="key-cell">
|
|
1435
1512
|
<span>{breakAfterUnderscores(entry.key)}</span>
|
|
1436
1513
|
{generated !== null && <RecipeMark generated={generated} />}
|
|
1437
|
-
{rowPlain && <span className="tag" title=
|
|
1514
|
+
{rowPlain && <span className="tag" title={levelsIn(personal && own).plain.hint}>Plain</span>}
|
|
1515
|
+
{sensitive && (
|
|
1516
|
+
<span className="tag" title={levelsIn(personal && own).sensitive.hint}>
|
|
1517
|
+
<Lock size={11} aria-hidden />
|
|
1518
|
+
Sensitive
|
|
1519
|
+
</span>
|
|
1520
|
+
)}
|
|
1438
1521
|
{leaving && <span className="tag tag-red">Will be archived</span>}
|
|
1439
1522
|
{parent !== null && <Standing project={project} secretKey={entry.key} parent={parent} />}
|
|
1440
1523
|
{lent.length > 0 && (
|
|
@@ -1460,15 +1543,22 @@ function SecretRow({
|
|
|
1460
1543
|
<div className="edit-stack">
|
|
1461
1544
|
<ValueField
|
|
1462
1545
|
label={`New value for ${entry.key}`}
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1546
|
+
// Made more visible, the field opens empty: the value is typed again.
|
|
1547
|
+
value={change.value ?? (loosening ? '' : editBase?.value ?? '')}
|
|
1548
|
+
start={loosening ? undefined : editBase?.value}
|
|
1549
|
+
placeholder={
|
|
1550
|
+
loosening ? 'Its value, typed again'
|
|
1551
|
+
: editBase !== null ? 'Value'
|
|
1552
|
+
: sensitive ? 'Type a new value'
|
|
1553
|
+
: error !== null ? 'New value; the current one could not be read'
|
|
1554
|
+
: canRead ? 'New value' : 'New value; the current one is hidden from you'
|
|
1555
|
+
}
|
|
1556
|
+
plain={level === 'plain'}
|
|
1467
1557
|
disabled={disabled}
|
|
1468
1558
|
autoFocus={!focusName}
|
|
1469
1559
|
// A value typed over a generated one has no recipe, and a private key's no longer matches its public key.
|
|
1470
1560
|
onChange={(value) =>
|
|
1471
|
-
onPatch(valueEdit(
|
|
1561
|
+
onPatch({ ...valueEdit(from(), { value, sensitivity: level }), companion: undefined, recipe: undefined })
|
|
1472
1562
|
}
|
|
1473
1563
|
onEscape={onUndo}
|
|
1474
1564
|
generate={{
|
|
@@ -1476,21 +1566,25 @@ function SecretRow({
|
|
|
1476
1566
|
name: change.key,
|
|
1477
1567
|
renamable: false,
|
|
1478
1568
|
companion: change.companion,
|
|
1479
|
-
// A generated value is
|
|
1480
|
-
onUse: ({ value, companion, recipe }) => onPatch({ value, companion, recipe, plain:
|
|
1569
|
+
// A generated value is never plain.
|
|
1570
|
+
onUse: ({ value, companion, recipe }) => onPatch({ value, companion, recipe, sensitivity: level === 'plain' ? 'secret' : level }),
|
|
1481
1571
|
}}
|
|
1482
1572
|
/>
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1573
|
+
<SensitivityField
|
|
1574
|
+
name={change.key.trim() === '' ? entry.key : change.key.trim()}
|
|
1575
|
+
value={level}
|
|
1576
|
+
levels={levelsIn(personal)}
|
|
1577
|
+
disabled={disabled}
|
|
1578
|
+
// A value made plain is typed by hand: it drops the recipe of one generated.
|
|
1579
|
+
onChange={(next) => onPatch({
|
|
1580
|
+
...valueEdit(from(), { value: change.value, sensitivity: next }),
|
|
1581
|
+
...(next === 'plain' ? { companion: undefined, recipe: undefined } : {}),
|
|
1582
|
+
})}
|
|
1583
|
+
/>
|
|
1584
|
+
{waitsForValue(entry, change) && (
|
|
1585
|
+
<span className="edit-note">
|
|
1586
|
+
{loosening ? 'Making it visible takes a new value: type it again.' : 'Type its value: only a value of its own here is marked.'}
|
|
1587
|
+
</span>
|
|
1494
1588
|
)}
|
|
1495
1589
|
<CompanionNote companion={change.companion} versionOf={versionOf} />
|
|
1496
1590
|
{!overridden && parent !== null && (
|
|
@@ -1520,7 +1614,7 @@ function SecretRow({
|
|
|
1520
1614
|
) : reference !== null ? (
|
|
1521
1615
|
<ReferenceValue reference={reference} />
|
|
1522
1616
|
) : (
|
|
1523
|
-
<span className="mask" aria-label=
|
|
1617
|
+
<span className="mask" aria-label={sensitive ? 'Never shown' : 'Hidden'}>
|
|
1524
1618
|
••••••••••••
|
|
1525
1619
|
</span>
|
|
1526
1620
|
)}
|
|
@@ -1628,7 +1722,7 @@ function SecretRow({
|
|
|
1628
1722
|
{status.state === 'pending' ? (
|
|
1629
1723
|
<RowPending status={status} />
|
|
1630
1724
|
) : (
|
|
1631
|
-
!removed && (
|
|
1725
|
+
!removed && (canList || (canWrite && !editing && !leaving) || (canArchive && !leaving && own && !overridden)) && (
|
|
1632
1726
|
<Menu.Root>
|
|
1633
1727
|
<Menu.Trigger
|
|
1634
1728
|
className="act act-icon act-quiet"
|
|
@@ -1638,7 +1732,7 @@ function SecretRow({
|
|
|
1638
1732
|
<MoreHorizontal size={16} />
|
|
1639
1733
|
</Menu.Trigger>
|
|
1640
1734
|
<MenuPopup align="end">
|
|
1641
|
-
<SecretReadOnly canReveal={
|
|
1735
|
+
<SecretReadOnly canReveal={canList && own}>
|
|
1642
1736
|
<Menu.Item className="menu-item" onClick={() => setHistoryOpen((open) => !open)}>
|
|
1643
1737
|
<History size={14} />
|
|
1644
1738
|
{historyOpen ? 'Hide history' : 'Version history'}
|
|
@@ -1702,6 +1796,26 @@ function SecretRow({
|
|
|
1702
1796
|
Break reference…
|
|
1703
1797
|
</Menu.Item>
|
|
1704
1798
|
)}
|
|
1799
|
+
{/* Its own value's level: a reference's is its source's, an inherited one's its parent's. */}
|
|
1800
|
+
{canWrite && !editing && !leaving && markable(entry) && (
|
|
1801
|
+
<>
|
|
1802
|
+
<Menu.Separator className="menu-sep" />
|
|
1803
|
+
<Menu.RadioGroup value={entry.sensitivity} onValueChange={(next: Sensitivity) => chooseLevel(next)}>
|
|
1804
|
+
<Menu.GroupLabel className="menu-label">Who sees it</Menu.GroupLabel>
|
|
1805
|
+
{SENSITIVITIES.map((each) => (
|
|
1806
|
+
<Menu.RadioItem key={each} value={each} className="menu-item menu-item-level" closeOnClick>
|
|
1807
|
+
<span className="menu-item-text">
|
|
1808
|
+
{levelsIn(personal)[each].label}
|
|
1809
|
+
<span className="menu-item-hint">{levelsIn(personal)[each].hint}</span>
|
|
1810
|
+
</span>
|
|
1811
|
+
<Menu.RadioItemIndicator className="menu-check">
|
|
1812
|
+
<Check size={14} />
|
|
1813
|
+
</Menu.RadioItemIndicator>
|
|
1814
|
+
</Menu.RadioItem>
|
|
1815
|
+
))}
|
|
1816
|
+
</Menu.RadioGroup>
|
|
1817
|
+
</>
|
|
1818
|
+
)}
|
|
1705
1819
|
{/* An override's way out is Reset, which keeps it; archiving there would be the same, by more. */}
|
|
1706
1820
|
{canArchive && !leaving && own && !overridden && (
|
|
1707
1821
|
<>
|
|
@@ -1771,6 +1885,20 @@ function SecretRow({
|
|
|
1771
1885
|
onConfirm={onMarkArchive}
|
|
1772
1886
|
/>
|
|
1773
1887
|
|
|
1888
|
+
<ConfirmDialog
|
|
1889
|
+
open={hiding}
|
|
1890
|
+
onOpenChange={setHiding}
|
|
1891
|
+
title={
|
|
1892
|
+
<>
|
|
1893
|
+
Make <span className="mono">{entry.key}</span> sensitive?
|
|
1894
|
+
</>
|
|
1895
|
+
}
|
|
1896
|
+
body="Nobody, Owners included, will see this value again. Apps use it through the proxy; service accounts still read it."
|
|
1897
|
+
confirmLabel="Make sensitive"
|
|
1898
|
+
destructive={false}
|
|
1899
|
+
onConfirm={() => mark('sensitive')}
|
|
1900
|
+
/>
|
|
1901
|
+
|
|
1774
1902
|
<ConfirmDialog
|
|
1775
1903
|
open={breaking !== null}
|
|
1776
1904
|
onOpenChange={(open) => !open && setBreaking(null)}
|
|
@@ -1809,7 +1937,7 @@ function SecretRow({
|
|
|
1809
1937
|
/>
|
|
1810
1938
|
)}
|
|
1811
1939
|
|
|
1812
|
-
{historyOpen &&
|
|
1940
|
+
{historyOpen && canList && (
|
|
1813
1941
|
<tr className="detail-row">
|
|
1814
1942
|
<td colSpan={columns}>
|
|
1815
1943
|
<VersionHistory
|
|
@@ -1931,7 +2059,8 @@ function Standing({ project, secretKey, parent }: { project: string; secretKey:
|
|
|
1931
2059
|
case 'inherited':
|
|
1932
2060
|
return <span className="tag tag-outline">from {from}</span>;
|
|
1933
2061
|
case 'removed':
|
|
1934
|
-
|
|
2062
|
+
// Removed here, a dismissal of the parent's key: which it still holds, or has dropped since, the removal then doing nothing.
|
|
2063
|
+
return <span className="tag tag-outline">removed here · {parent.held ? <>not inherited from {from}</> : <>{from} dropped it too</>}</span>;
|
|
1935
2064
|
case 'overridden':
|
|
1936
2065
|
return (
|
|
1937
2066
|
<>
|
|
@@ -2028,6 +2157,51 @@ function Written({ entry, rotateAfterDays }: { entry: SecretKey; rotateAfterDays
|
|
|
2028
2157
|
);
|
|
2029
2158
|
}
|
|
2030
2159
|
|
|
2160
|
+
/**
|
|
2161
|
+
* Who sees the value being written, loosest first, and beside it what the
|
|
2162
|
+
* level pointed at, or else the one chosen, means. Native radios: the arrow
|
|
2163
|
+
* keys move the choice, and a screen reader hears one group of three.
|
|
2164
|
+
*/
|
|
2165
|
+
function SensitivityField({
|
|
2166
|
+
name,
|
|
2167
|
+
value,
|
|
2168
|
+
levels,
|
|
2169
|
+
disabled,
|
|
2170
|
+
onChange,
|
|
2171
|
+
}: {
|
|
2172
|
+
/** The key it is for, naming the group. */
|
|
2173
|
+
name: string;
|
|
2174
|
+
value: Sensitivity;
|
|
2175
|
+
/** Each level as it is named here (`levelsIn`). */
|
|
2176
|
+
levels: Record<Sensitivity, { label: string; hint: string }>;
|
|
2177
|
+
disabled: boolean;
|
|
2178
|
+
onChange: (level: Sensitivity) => void;
|
|
2179
|
+
}) {
|
|
2180
|
+
const id = useId();
|
|
2181
|
+
const [pointed, setPointed] = useState<Sensitivity | null>(null);
|
|
2182
|
+
return (
|
|
2183
|
+
<div className="edit-note sensitivity-field">
|
|
2184
|
+
<div className="segmented segmented-sm" role="radiogroup" aria-label={`Who sees ${name}`} aria-describedby={`${id}-hint`}>
|
|
2185
|
+
{SENSITIVITIES.map((level) => (
|
|
2186
|
+
<label key={level} onPointerEnter={() => setPointed(level)} onPointerLeave={() => setPointed(null)}>
|
|
2187
|
+
<input
|
|
2188
|
+
type="radio"
|
|
2189
|
+
className="visually-hidden"
|
|
2190
|
+
name={id}
|
|
2191
|
+
value={level}
|
|
2192
|
+
checked={value === level}
|
|
2193
|
+
disabled={disabled}
|
|
2194
|
+
onChange={() => onChange(level)}
|
|
2195
|
+
/>
|
|
2196
|
+
{levels[level].label}
|
|
2197
|
+
</label>
|
|
2198
|
+
))}
|
|
2199
|
+
</div>
|
|
2200
|
+
<span id={`${id}-hint`}>{levels[pointed ?? value].hint}</span>
|
|
2201
|
+
</div>
|
|
2202
|
+
);
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2031
2205
|
/**
|
|
2032
2206
|
* A secret being typed, sitting in the table where it will end up.
|
|
2033
2207
|
*
|
|
@@ -2035,26 +2209,6 @@ function Written({ entry, rotateAfterDays }: { entry: SecretKey; rotateAfterDays
|
|
|
2035
2209
|
* from the list to add to it, and only ever accepted one key at a time; a row
|
|
2036
2210
|
* in place accepts as many as you want to queue.
|
|
2037
2211
|
*/
|
|
2038
|
-
/**
|
|
2039
|
-
* Whether the value being written is plain, no secret: an account's id,
|
|
2040
|
-
* which whoever reads the environment then sees as it is, and its apps get
|
|
2041
|
-
* as it is under stand-ins. Off, it is a secret, as every value is unless
|
|
2042
|
-
* this says otherwise.
|
|
2043
|
-
*/
|
|
2044
|
-
function PlainToggle({ plain, disabled, onToggle }: { plain: boolean; disabled: boolean; onToggle: () => void }) {
|
|
2045
|
-
return (
|
|
2046
|
-
<span className="edit-note">
|
|
2047
|
-
<button type="button" className="act plain-toggle" aria-pressed={plain} disabled={disabled} onClick={onToggle}>
|
|
2048
|
-
<span className="plain-toggle-box" aria-hidden>
|
|
2049
|
-
{plain && <Check size={11} />}
|
|
2050
|
-
</span>
|
|
2051
|
-
Plain value
|
|
2052
|
-
</button>
|
|
2053
|
-
{plain && 'shown to whoever reads this environment'}
|
|
2054
|
-
</span>
|
|
2055
|
-
);
|
|
2056
|
-
}
|
|
2057
|
-
|
|
2058
2212
|
function DraftRow({
|
|
2059
2213
|
draft,
|
|
2060
2214
|
existingVersion,
|
|
@@ -2076,7 +2230,7 @@ function DraftRow({
|
|
|
2076
2230
|
/** The current version of a key in this environment, for a companion's note. */
|
|
2077
2231
|
versionOf: (key: string) => number | null;
|
|
2078
2232
|
saveReady: boolean;
|
|
2079
|
-
/** In
|
|
2233
|
+
/** In your personal config, `dev@me`, whose values are your own. */
|
|
2080
2234
|
personal: boolean;
|
|
2081
2235
|
}) {
|
|
2082
2236
|
const [touched, setTouched] = useState(false);
|
|
@@ -2124,7 +2278,7 @@ function DraftRow({
|
|
|
2124
2278
|
<ValueField
|
|
2125
2279
|
label={`Value for ${trimmed === '' ? 'the new secret' : trimmed}`}
|
|
2126
2280
|
value={draft.value}
|
|
2127
|
-
plain={draft.
|
|
2281
|
+
plain={draft.sensitivity === 'plain'}
|
|
2128
2282
|
placeholder="Value"
|
|
2129
2283
|
disabled={disabled}
|
|
2130
2284
|
// A value typed over a generated one has no recipe, and a private key's no longer matches its public key.
|
|
@@ -2134,17 +2288,19 @@ function DraftRow({
|
|
|
2134
2288
|
name: draft.key,
|
|
2135
2289
|
renamable: true,
|
|
2136
2290
|
companion: draft.companion,
|
|
2137
|
-
// A generated value is
|
|
2138
|
-
onUse: ({ value, name, companion, recipe }) =>
|
|
2291
|
+
// A generated value is never plain.
|
|
2292
|
+
onUse: ({ value, name, companion, recipe }) =>
|
|
2293
|
+
onChange({ key: name, value, companion, recipe, sensitivity: draft.sensitivity === 'plain' ? 'secret' : draft.sensitivity }),
|
|
2139
2294
|
}}
|
|
2140
2295
|
/>
|
|
2141
|
-
|
|
2142
|
-
|
|
2143
|
-
|
|
2144
|
-
|
|
2145
|
-
|
|
2146
|
-
|
|
2147
|
-
|
|
2296
|
+
<SensitivityField
|
|
2297
|
+
name={trimmed === '' ? 'the new secret' : trimmed}
|
|
2298
|
+
value={draft.sensitivity}
|
|
2299
|
+
levels={levelsIn(personal)}
|
|
2300
|
+
disabled={disabled}
|
|
2301
|
+
// A value made plain is typed by hand: it drops the recipe of one generated.
|
|
2302
|
+
onChange={(sensitivity) => onChange(sensitivity === 'plain' ? { sensitivity, companion: undefined, recipe: undefined } : { sensitivity })}
|
|
2303
|
+
/>
|
|
2148
2304
|
<CompanionNote companion={draft.companion} versionOf={versionOf} />
|
|
2149
2305
|
</div>
|
|
2150
2306
|
</div>
|
|
@@ -2197,7 +2353,7 @@ function ArchivedRow({
|
|
|
2197
2353
|
environment,
|
|
2198
2354
|
entry,
|
|
2199
2355
|
canArchive,
|
|
2200
|
-
|
|
2356
|
+
canList,
|
|
2201
2357
|
status: state,
|
|
2202
2358
|
onRestore,
|
|
2203
2359
|
onDismiss,
|
|
@@ -2207,7 +2363,8 @@ function ArchivedRow({
|
|
|
2207
2363
|
environment: string;
|
|
2208
2364
|
entry: SecretKey;
|
|
2209
2365
|
canArchive: boolean;
|
|
2210
|
-
|
|
2366
|
+
/** Whether the caller lists the environment, as its history takes. */
|
|
2367
|
+
canList: boolean;
|
|
2211
2368
|
status: ItemStatus;
|
|
2212
2369
|
onRestore: () => void;
|
|
2213
2370
|
onDismiss: (mutationId: number) => void;
|
|
@@ -2231,7 +2388,7 @@ function ArchivedRow({
|
|
|
2231
2388
|
{state.state === 'pending' ? (
|
|
2232
2389
|
<RowPending status={state} />
|
|
2233
2390
|
) : (
|
|
2234
|
-
(
|
|
2391
|
+
(canList || canArchive) && (
|
|
2235
2392
|
<div className="acts">
|
|
2236
2393
|
<Menu.Root>
|
|
2237
2394
|
<Menu.Trigger
|
|
@@ -2241,7 +2398,7 @@ function ArchivedRow({
|
|
|
2241
2398
|
<MoreHorizontal size={16} />
|
|
2242
2399
|
</Menu.Trigger>
|
|
2243
2400
|
<MenuPopup align="end">
|
|
2244
|
-
<SecretReadOnly canReveal={
|
|
2401
|
+
<SecretReadOnly canReveal={canList}>
|
|
2245
2402
|
<Menu.Item
|
|
2246
2403
|
className="menu-item"
|
|
2247
2404
|
onClick={() => setHistoryOpen((open) => !open)}
|
|
@@ -2252,7 +2409,7 @@ function ArchivedRow({
|
|
|
2252
2409
|
</SecretReadOnly>
|
|
2253
2410
|
{canArchive && (
|
|
2254
2411
|
<>
|
|
2255
|
-
{
|
|
2412
|
+
{canList && <Menu.Separator className="menu-sep" />}
|
|
2256
2413
|
<Menu.Item className="menu-item" onClick={onRestore}>
|
|
2257
2414
|
<RotateBack size={14} />
|
|
2258
2415
|
Restore
|
|
@@ -2380,6 +2537,12 @@ function VersionHistory({
|
|
|
2380
2537
|
<td className="cell-mono nowrap">
|
|
2381
2538
|
v{version.version}{' '}
|
|
2382
2539
|
{version.current && <span className="tag tag-blue">Current</span>}
|
|
2540
|
+
{version.sensitivity !== 'secret' && (
|
|
2541
|
+
<>
|
|
2542
|
+
{' '}
|
|
2543
|
+
<span className="tag" title={LEVELS[version.sensitivity].hint}>{LEVELS[version.sensitivity].label}</span>
|
|
2544
|
+
</>
|
|
2545
|
+
)}
|
|
2383
2546
|
</td>
|
|
2384
2547
|
<td className="nowrap">
|
|
2385
2548
|
<Timestamp iso={version.createdAt} />
|