@coffre/ui 0.4.6 → 0.5.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/{affordances-DAvsVz7u.js → affordances-Bqdevf7w.js} +10 -5
- package/dist/chunks/affordances-Bqdevf7w.js.map +1 -0
- package/dist/chunks/{audit-sentence-DIztXvbU.js → audit-sentence-Cm5nby5k.js} +105 -7
- package/dist/chunks/audit-sentence-Cm5nby5k.js.map +1 -0
- package/dist/chunks/{connected-apps-AZsX9Zvv.js → connected-apps-DTNS7YmY.js} +2 -2
- package/dist/chunks/{connected-apps-AZsX9Zvv.js.map → connected-apps-DTNS7YmY.js.map} +1 -1
- package/dist/chunks/{delete-place-D6LIZkg9.js → delete-place-CIaOq0mt.js} +3 -3
- package/dist/chunks/{delete-place-D6LIZkg9.js.map → delete-place-CIaOq0mt.js.map} +1 -1
- package/dist/chunks/{directory-B6FuiCir.js → directory-DSVt5Tya.js} +54 -60
- package/dist/chunks/directory-DSVt5Tya.js.map +1 -0
- package/dist/chunks/{folders-DvSqBhuu.js → folders-CoGK9oqg.js} +2 -2
- package/dist/chunks/{folders-DvSqBhuu.js.map → folders-CoGK9oqg.js.map} +1 -1
- package/dist/chunks/grants-CRU7yZhL.js +164 -0
- package/dist/chunks/grants-CRU7yZhL.js.map +1 -0
- package/dist/chunks/{offboarding-CLJaNTcD.js → offboarding-DVBSiJRZ.js} +7 -3
- package/dist/chunks/offboarding-DVBSiJRZ.js.map +1 -0
- package/dist/chunks/{principal-page-1yMztIcc.js → principal-page-BEBr_zW7.js} +350 -91
- package/dist/chunks/principal-page-BEBr_zW7.js.map +1 -0
- package/dist/chunks/{project-page-C4cEaRFa.js → project-page-B3TZ5_ig.js} +2 -2
- package/dist/chunks/{project-page-C4cEaRFa.js.map → project-page-B3TZ5_ig.js.map} +1 -1
- package/dist/chunks/{queries-Dew8mIeo.js → queries-DE5nK2y4.js} +132 -54
- package/dist/chunks/queries-DE5nK2y4.js.map +1 -0
- package/dist/chunks/{references-DWDnXNoW.js → references-uv4Mli9z.js} +4 -3
- package/dist/chunks/{references-DWDnXNoW.js.map → references-uv4Mli9z.js.map} +1 -1
- package/dist/chunks/role-field-DWhkRY6n.js +192 -0
- package/dist/chunks/role-field-DWhkRY6n.js.map +1 -0
- package/dist/chunks/use-action-BRgvbUWt.js +49 -0
- package/dist/chunks/use-action-BRgvbUWt.js.map +1 -0
- package/dist/chunks/{use-change-C4bGRhHY.js → use-change-BJ3dCFHb.js} +40 -14
- package/dist/chunks/use-change-BJ3dCFHb.js.map +1 -0
- package/dist/chunks/{use-shell-Dkv89nW1.js → use-shell-BO4ZTr1y.js} +2 -2
- package/dist/chunks/{use-shell-Dkv89nW1.js.map → use-shell-BO4ZTr1y.js.map} +1 -1
- package/dist/chunks/validation-DiHIwZRA.js +37 -0
- package/dist/chunks/validation-DiHIwZRA.js.map +1 -0
- package/dist/index.d.ts +111 -88
- package/dist/index.js +40 -21
- package/dist/index.js.map +1 -1
- package/dist/pages/account.js +8 -7
- package/dist/pages/account.js.map +1 -1
- package/dist/pages/audit.js +2 -2
- package/dist/pages/environment.js +8 -7
- package/dist/pages/environment.js.map +1 -1
- package/dist/pages/login.js +2 -2
- package/dist/pages/login.js.map +1 -1
- package/dist/pages/project-access.js +7 -7
- package/dist/pages/project-environments.js +26 -21
- package/dist/pages/project-environments.js.map +1 -1
- package/dist/pages/project-settings.js +9 -8
- package/dist/pages/project-settings.js.map +1 -1
- package/dist/pages/project.js +1 -1
- package/dist/pages/projects.js +8 -13
- package/dist/pages/projects.js.map +1 -1
- package/dist/pages/service-account.js +294 -88
- package/dist/pages/service-account.js.map +1 -1
- package/dist/pages/service-accounts.js +7 -7
- package/dist/pages/service-accounts.js.map +1 -1
- package/dist/pages/settings.js +91 -9
- package/dist/pages/settings.js.map +1 -1
- package/dist/pages/unregistered.d.ts +1 -1
- package/dist/pages/unregistered.js +4 -4
- package/dist/pages/unregistered.js.map +1 -1
- package/dist/pages/user.d.ts +2 -0
- package/dist/pages/user.js +21 -3
- package/dist/pages/user.js.map +1 -1
- package/dist/pages/users.js +4 -4
- package/package.json +3 -3
- package/src/components/affordances.ts +7 -3
- package/src/components/command-palette.tsx +2 -0
- package/src/components/directory.tsx +58 -63
- package/src/components/grants.tsx +9 -9
- package/src/components/offboarding.tsx +3 -1
- package/src/components/principal-page.tsx +124 -74
- package/src/components/role-field.tsx +183 -0
- package/src/components/scope-picker.tsx +73 -0
- package/src/components/service-tokens.tsx +20 -9
- package/src/components/shell.tsx +6 -10
- package/src/components/trusted-workloads.tsx +121 -42
- package/src/index.ts +1 -0
- package/src/lib/audit-sentences.ts +104 -3
- package/src/lib/bindings.ts +33 -10
- package/src/lib/capabilities.ts +28 -8
- package/src/lib/changes.ts +22 -13
- package/src/lib/project-access.ts +21 -0
- package/src/lib/queries.ts +121 -44
- package/src/lib/service-setup.ts +41 -0
- package/src/lib/validation.ts +7 -0
- package/src/options.ts +31 -11
- package/src/pages/account.tsx +3 -2
- package/src/pages/login.tsx +1 -1
- package/src/pages/project-environments.tsx +12 -15
- package/src/pages/project-settings.tsx +3 -3
- package/src/pages/projects.tsx +1 -5
- package/src/pages/service-account.tsx +7 -5
- package/src/pages/service-accounts.tsx +8 -4
- package/src/pages/settings.tsx +80 -4
- package/src/pages/unregistered.tsx +3 -3
- package/src/pages/user.tsx +24 -1
- package/src/parity.ts +5 -1
- package/src/register.ts +3 -1
- package/src/shared/models.ts +8 -4
- package/src/styles/globals.css +100 -27
- package/dist/chunks/affordances-DAvsVz7u.js.map +0 -1
- package/dist/chunks/audit-sentence-DIztXvbU.js.map +0 -1
- package/dist/chunks/directory-B6FuiCir.js.map +0 -1
- package/dist/chunks/grants-9kIV6uZ7.js +0 -669
- package/dist/chunks/grants-9kIV6uZ7.js.map +0 -1
- package/dist/chunks/offboarding-CLJaNTcD.js.map +0 -1
- package/dist/chunks/principal-page-1yMztIcc.js.map +0 -1
- package/dist/chunks/queries-Dew8mIeo.js.map +0 -1
- package/dist/chunks/use-change-C4bGRhHY.js.map +0 -1
- package/dist/chunks/validation-DvPinn8V.js +0 -87
- package/dist/chunks/validation-DvPinn8V.js.map +0 -1
- package/src/components/every-project.tsx +0 -287
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ServiceTokenRow } from '@coffre/client';
|
|
2
|
+
import { credentialScopeInWords } from '@coffre/core/access';
|
|
2
3
|
import { Fragment, useState } from 'react';
|
|
3
4
|
import { revokeCredential } from '../lib/changes';
|
|
4
5
|
import { memberRef, useCoffre } from '../lib/coffre';
|
|
@@ -7,6 +8,7 @@ import { useAction } from '../lib/use-action';
|
|
|
7
8
|
import { useChange, useChangeStatus } from '../lib/use-change';
|
|
8
9
|
import { RowFailure, RowPending, rowClass } from './row-state';
|
|
9
10
|
import { Card } from './page';
|
|
11
|
+
import { ScopePicker, wholeScope, type HeldGrant } from './scope-picker';
|
|
10
12
|
import { ConfirmButton, CopyButton, EmptyState, ErrorLine, Modal, Notice, Spinner, Timestamp } from './ui';
|
|
11
13
|
import { Key, Plus, X } from './icons';
|
|
12
14
|
|
|
@@ -17,7 +19,7 @@ const LIFETIMES = [30, 90, 180, 365] as const;
|
|
|
17
19
|
* OIDC. A value exists in exactly
|
|
18
20
|
* one place, this dialog, for as long as it stays open: coffre keeps a hash.
|
|
19
21
|
*/
|
|
20
|
-
export function ServiceTokens({ serviceId, tokens }: { serviceId: string; tokens: ServiceTokenRow[] }) {
|
|
22
|
+
export function ServiceTokens({ serviceId, tokens, grants }: { serviceId: string; tokens: ServiceTokenRow[]; grants: HeldGrant[] }) {
|
|
21
23
|
const change = revokeCredential(useCoffre(), serviceId);
|
|
22
24
|
const revoke = useChange(change);
|
|
23
25
|
const { status, dismiss } = useChangeStatus(change.list.queryKey);
|
|
@@ -27,18 +29,22 @@ export function ServiceTokens({ serviceId, tokens }: { serviceId: string; tokens
|
|
|
27
29
|
<Card
|
|
28
30
|
labelledBy="service-tokens"
|
|
29
31
|
title="Bearer tokens"
|
|
30
|
-
description=
|
|
32
|
+
description={
|
|
33
|
+
<>
|
|
34
|
+
A long-lived secret, for CI that can't use OIDC. For example, a cron job on your own server runs{' '}
|
|
35
|
+
<span className="mono nowrap">coffre login <url> --token</span> with one. coffre shows it once.
|
|
36
|
+
</>
|
|
37
|
+
}
|
|
31
38
|
>
|
|
32
39
|
{tokens.length === 0 ? (
|
|
33
|
-
<EmptyState title="No bearer tokens">
|
|
34
|
-
None is needed for CI that signs in with OIDC; issue one for CI that cannot.
|
|
35
|
-
</EmptyState>
|
|
40
|
+
<EmptyState title="No bearer tokens">CI that signs in with OIDC needs none.</EmptyState>
|
|
36
41
|
) : (
|
|
37
42
|
<div className="dt-wrap">
|
|
38
43
|
<table className="dt">
|
|
39
44
|
<thead>
|
|
40
45
|
<tr>
|
|
41
46
|
<th>Token</th>
|
|
47
|
+
<th>Reaches</th>
|
|
42
48
|
<th className="col-shrink">Issued (UTC)</th>
|
|
43
49
|
<th className="col-shrink">Last used</th>
|
|
44
50
|
<th className="col-shrink">Expires</th>
|
|
@@ -62,6 +68,7 @@ export function ServiceTokens({ serviceId, tokens }: { serviceId: string; tokens
|
|
|
62
68
|
</span>
|
|
63
69
|
</span>
|
|
64
70
|
</td>
|
|
71
|
+
<td>{token.scope === null ? 'All its account holds' : credentialScopeInWords(token.scope)}</td>
|
|
65
72
|
<td className="nowrap">
|
|
66
73
|
<span className="cell-stack">
|
|
67
74
|
<Timestamp iso={token.createdAt} />
|
|
@@ -120,7 +127,7 @@ export function ServiceTokens({ serviceId, tokens }: { serviceId: string; tokens
|
|
|
120
127
|
</tr>
|
|
121
128
|
<RowFailure
|
|
122
129
|
status={state}
|
|
123
|
-
columns={
|
|
130
|
+
columns={6}
|
|
124
131
|
onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)}
|
|
125
132
|
/>
|
|
126
133
|
</Fragment>
|
|
@@ -132,16 +139,17 @@ export function ServiceTokens({ serviceId, tokens }: { serviceId: string; tokens
|
|
|
132
139
|
)}
|
|
133
140
|
</Card>
|
|
134
141
|
<div className="table-actions">
|
|
135
|
-
<IssueToken serviceId={serviceId} />
|
|
142
|
+
<IssueToken serviceId={serviceId} grants={grants} />
|
|
136
143
|
</div>
|
|
137
144
|
</>
|
|
138
145
|
);
|
|
139
146
|
}
|
|
140
147
|
|
|
141
|
-
function IssueToken({ serviceId }: { serviceId: string }) {
|
|
148
|
+
function IssueToken({ serviceId, grants }: { serviceId: string; grants: HeldGrant[] }) {
|
|
142
149
|
const [open, setOpen] = useState(false);
|
|
143
150
|
const [label, setLabel] = useState('');
|
|
144
151
|
const [days, setDays] = useState<number>(90);
|
|
152
|
+
const [scope, setScope] = useState(() => wholeScope(grants));
|
|
145
153
|
const [issued, setIssued] = useState<{ token: string; expiresAt: string } | null>(null);
|
|
146
154
|
const coffre = useCoffre();
|
|
147
155
|
const { pending, error, setError, run } = useAction();
|
|
@@ -150,6 +158,7 @@ function IssueToken({ serviceId }: { serviceId: string }) {
|
|
|
150
158
|
setOpen(false);
|
|
151
159
|
setIssued(null);
|
|
152
160
|
setLabel('');
|
|
161
|
+
setScope(wholeScope(grants));
|
|
153
162
|
setError(null);
|
|
154
163
|
}
|
|
155
164
|
|
|
@@ -174,6 +183,7 @@ function IssueToken({ serviceId }: { serviceId: string }) {
|
|
|
174
183
|
coffre.tokens.issue(memberRef('service', serviceId), {
|
|
175
184
|
label: label.trim() === '' ? null : label.trim(),
|
|
176
185
|
expiresInDays: days,
|
|
186
|
+
scope,
|
|
177
187
|
}),
|
|
178
188
|
{
|
|
179
189
|
affects: affects.credentials(memberRef('service', serviceId)),
|
|
@@ -204,12 +214,13 @@ function IssueToken({ serviceId }: { serviceId: string }) {
|
|
|
204
214
|
</select>
|
|
205
215
|
</label>
|
|
206
216
|
</div>
|
|
217
|
+
<ScopePicker grants={grants} value={scope} onChange={setScope} />
|
|
207
218
|
<ErrorLine error={error} />
|
|
208
219
|
<div className="dialog-actions">
|
|
209
220
|
<button className="btn" type="button" onClick={close}>
|
|
210
221
|
Cancel
|
|
211
222
|
</button>
|
|
212
|
-
<button className="btn btn-primary" type="submit" disabled={pending}>
|
|
223
|
+
<button className="btn btn-primary" type="submit" disabled={pending || Object.keys(scope).length === 0}>
|
|
213
224
|
{pending && <Spinner />}
|
|
214
225
|
Issue token
|
|
215
226
|
</button>
|
package/src/components/shell.tsx
CHANGED
|
@@ -8,8 +8,9 @@ import {
|
|
|
8
8
|
import { Link, useNavigate, useRouterState } from '@tanstack/react-router';
|
|
9
9
|
import { Dialog } from '@base-ui/react/dialog';
|
|
10
10
|
import { Menu } from '@base-ui/react/menu';
|
|
11
|
+
import { INSTANCE_ROLES } from '@coffre/core/access';
|
|
11
12
|
import { PROJECT_PAGES } from '@coffre/core/pages';
|
|
12
|
-
import type { ProjectSummary } from '../shared/models';
|
|
13
|
+
import type { Me, ProjectSummary } from '../shared/models';
|
|
13
14
|
import type { UiCapabilities } from '../lib/capabilities';
|
|
14
15
|
import { isActiveAccessibleEnvironment } from '../lib/project-environments';
|
|
15
16
|
import { useMounted } from '../lib/mounted';
|
|
@@ -37,7 +38,7 @@ import {
|
|
|
37
38
|
} from './icons';
|
|
38
39
|
|
|
39
40
|
type Principal = { type: 'user' | 'service'; id: string } | null;
|
|
40
|
-
type InstanceRole = '
|
|
41
|
+
type InstanceRole = Me['instanceRole'] | null;
|
|
41
42
|
|
|
42
43
|
type ShellProps = {
|
|
43
44
|
projects: ProjectSummary[];
|
|
@@ -65,8 +66,7 @@ const CURRENT = { 'aria-current': 'page' } as const;
|
|
|
65
66
|
function roleLabel(principal: Principal, instanceRole: InstanceRole): string {
|
|
66
67
|
if (principal?.type === 'service') return 'Token';
|
|
67
68
|
if (instanceRole === 'root-admin') return 'Root admin';
|
|
68
|
-
|
|
69
|
-
return 'Member';
|
|
69
|
+
return INSTANCE_ROLES[instanceRole ?? 'member'].name;
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
/** The product's mark and name, for the pages you see before signing in. */
|
|
@@ -242,12 +242,8 @@ function Sidebar({
|
|
|
242
242
|
/>
|
|
243
243
|
<AdministrationItems
|
|
244
244
|
capabilities={capabilities}
|
|
245
|
-
users={
|
|
246
|
-
|
|
247
|
-
<NavLink to="/users" label="Users" icon={<Users size={16} />} collapsed={collapsed} />
|
|
248
|
-
<NavLink to="/service-accounts" label="Service accounts" icon={<Key size={16} />} collapsed={collapsed} />
|
|
249
|
-
</>
|
|
250
|
-
}
|
|
245
|
+
users={<NavLink to="/users" label="Users" icon={<Users size={16} />} collapsed={collapsed} />}
|
|
246
|
+
services={<NavLink to="/service-accounts" label="Service accounts" icon={<Key size={16} />} collapsed={collapsed} />}
|
|
251
247
|
audit={
|
|
252
248
|
<NavLink to="/audit" label="Audit" icon={<Ledger size={16} />} collapsed={collapsed} />
|
|
253
249
|
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { BindingPlan, BindingView } from '@coffre/client';
|
|
2
|
-
import {
|
|
2
|
+
import { credentialScopeInWords } from '@coffre/core/access';
|
|
3
|
+
import { claimValues, EVENT_EXPOSURE, githubEventsAt, GITLAB_PIPELINE_SOURCES } from '@coffre/core/workloads';
|
|
3
4
|
import { Fragment, useState } from 'react';
|
|
4
|
-
import { bindingOf, EMPTY_FORM, summary, type Form, type RefKind } from '../lib/bindings';
|
|
5
|
+
import { askedScope, bindingOf, EMPTY_FORM, planned, summary, type Form, type RefKind, type ScopeChoice } from '../lib/bindings';
|
|
5
6
|
import { removeBinding } from '../lib/changes';
|
|
6
7
|
import { memberRef, useCoffre } from '../lib/coffre';
|
|
7
8
|
import { affects } from '../lib/queries';
|
|
@@ -9,16 +10,17 @@ import { useAction } from '../lib/use-action';
|
|
|
9
10
|
import { useChange, useChangeStatus } from '../lib/use-change';
|
|
10
11
|
import { RowFailure, RowPending, rowClass } from './row-state';
|
|
11
12
|
import { Card } from './page';
|
|
13
|
+
import { ScopePicker, wholeScope, type HeldGrant } from './scope-picker';
|
|
12
14
|
import { ConfirmButton, EmptyState, ErrorLine, Modal, Notice, Spinner, Timestamp } from './ui';
|
|
13
15
|
import { GitHub, Link, Plus, X } from './icons';
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* The CI runs that may sign in as a service, by the ID token their platform
|
|
17
19
|
* signs for each run (docs/design/oidc.md). A run is trusted only when
|
|
18
|
-
* every claim of a binding matches
|
|
19
|
-
*
|
|
20
|
+
* every claim of a binding matches, so the claims are what the page shows,
|
|
21
|
+
* in full, before anything is saved.
|
|
20
22
|
*/
|
|
21
|
-
export function TrustedWorkloads({ serviceId, bindings }: { serviceId: string; bindings: BindingView[] }) {
|
|
23
|
+
export function TrustedWorkloads({ serviceId, bindings, grants }: { serviceId: string; bindings: BindingView[]; grants: HeldGrant[] }) {
|
|
22
24
|
const change = removeBinding(useCoffre(), serviceId);
|
|
23
25
|
const remove = useChange(change);
|
|
24
26
|
const { status, dismiss } = useChangeStatus(change.list.queryKey);
|
|
@@ -28,18 +30,22 @@ export function TrustedWorkloads({ serviceId, bindings }: { serviceId: string; b
|
|
|
28
30
|
<Card
|
|
29
31
|
labelledBy="trusted-workloads"
|
|
30
32
|
title="Sign in with OIDC"
|
|
31
|
-
description=
|
|
33
|
+
description={
|
|
34
|
+
<>
|
|
35
|
+
A CI run signs in with the ID token GitHub Actions or GitLab gives it, so there is no secret to store. For example,{' '}
|
|
36
|
+
<span className="mono">deploy.yml</span> in <span className="mono">acme/api</span>, on pushes to <span className="mono">main</span>.
|
|
37
|
+
</>
|
|
38
|
+
}
|
|
32
39
|
>
|
|
33
40
|
{bindings.length === 0 ? (
|
|
34
|
-
<EmptyState title="No trust bindings">
|
|
35
|
-
Trust a CI workflow to let its runs sign in as this service account with no stored secret. Until then, CI needs a bearer token.
|
|
36
|
-
</EmptyState>
|
|
41
|
+
<EmptyState title="No trust bindings">Trust a workflow to let its runs sign in.</EmptyState>
|
|
37
42
|
) : (
|
|
38
43
|
<div className="dt-wrap">
|
|
39
44
|
<table className="dt">
|
|
40
45
|
<thead>
|
|
41
46
|
<tr>
|
|
42
47
|
<th>Workload</th>
|
|
48
|
+
<th>Reaches</th>
|
|
43
49
|
<th className="col-shrink">Added (UTC)</th>
|
|
44
50
|
<th className="col-shrink">Last used</th>
|
|
45
51
|
<th className="col-actions">
|
|
@@ -67,6 +73,7 @@ export function TrustedWorkloads({ serviceId, bindings }: { serviceId: string; b
|
|
|
67
73
|
</span>
|
|
68
74
|
</span>
|
|
69
75
|
</td>
|
|
76
|
+
<td>{binding.scope === null ? 'All its account holds' : credentialScopeInWords(binding.scope)}</td>
|
|
70
77
|
<td className="nowrap">
|
|
71
78
|
<span className="cell-stack">
|
|
72
79
|
<Timestamp iso={binding.createdAt} />
|
|
@@ -109,7 +116,7 @@ export function TrustedWorkloads({ serviceId, bindings }: { serviceId: string; b
|
|
|
109
116
|
)}
|
|
110
117
|
</td>
|
|
111
118
|
</tr>
|
|
112
|
-
<RowFailure status={state} columns={
|
|
119
|
+
<RowFailure status={state} columns={5} onDismiss={() => state.state === 'failed' && dismiss(state.mutationId)} />
|
|
113
120
|
</Fragment>
|
|
114
121
|
);
|
|
115
122
|
})}
|
|
@@ -119,7 +126,7 @@ export function TrustedWorkloads({ serviceId, bindings }: { serviceId: string; b
|
|
|
119
126
|
)}
|
|
120
127
|
</Card>
|
|
121
128
|
<div className="table-actions">
|
|
122
|
-
<TrustWorkload serviceId={serviceId} />
|
|
129
|
+
<TrustWorkload serviceId={serviceId} grants={grants} bindings={bindings} />
|
|
123
130
|
</div>
|
|
124
131
|
</>
|
|
125
132
|
);
|
|
@@ -136,7 +143,7 @@ function Claims({ binding }: { binding: Pick<BindingPlan, 'issuer' | 'jwksUri' |
|
|
|
136
143
|
{Object.entries(binding.claims).map(([name, value]) => (
|
|
137
144
|
<tr key={name}>
|
|
138
145
|
<th className="mono">{name}</th>
|
|
139
|
-
<td className="mono">{value}</td>
|
|
146
|
+
<td className="mono">{claimValues(value).join(', ')}</td>
|
|
140
147
|
</tr>
|
|
141
148
|
))}
|
|
142
149
|
<tr>
|
|
@@ -148,9 +155,61 @@ function Claims({ binding }: { binding: Pick<BindingPlan, 'issuer' | 'jwksUri' |
|
|
|
148
155
|
);
|
|
149
156
|
}
|
|
150
157
|
|
|
151
|
-
|
|
158
|
+
/** Checkboxes for what may start a run: GitHub's events, or GitLab's pipeline sources. */
|
|
159
|
+
function Choices(props: { label: string; options: readonly string[]; chosen: string[]; onChange: (chosen: string[]) => void; hint?: string }) {
|
|
160
|
+
const { options, chosen } = props;
|
|
161
|
+
return (
|
|
162
|
+
<fieldset className="field checks">
|
|
163
|
+
<legend className="label">{props.label}</legend>
|
|
164
|
+
<div className="checks-row">
|
|
165
|
+
{options.map((option) => (
|
|
166
|
+
<label key={option} className="check mono">
|
|
167
|
+
<input
|
|
168
|
+
type="checkbox"
|
|
169
|
+
checked={chosen.includes(option)}
|
|
170
|
+
// Kept in the options' order, as the server stores them.
|
|
171
|
+
onChange={(event) => props.onChange(options.filter((each) => (each === option ? event.target.checked : chosen.includes(each))))}
|
|
172
|
+
/>
|
|
173
|
+
{option}
|
|
174
|
+
</label>
|
|
175
|
+
))}
|
|
176
|
+
</div>
|
|
177
|
+
{props.hint !== undefined && <span className="hint">{props.hint}</span>}
|
|
178
|
+
</fieldset>
|
|
179
|
+
);
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
/** What trusting `pull_request` or `workflow_run` exposes, said where the owner chooses it and again before saving. */
|
|
183
|
+
function Exposure({ events }: { events: string[] }) {
|
|
184
|
+
const exposed = events.filter((event) => EVENT_EXPOSURE[event] !== undefined);
|
|
185
|
+
if (exposed.length === 0) return null;
|
|
186
|
+
return (
|
|
187
|
+
<Notice tone="warn">
|
|
188
|
+
{exposed.map((event) => (
|
|
189
|
+
<p key={event}>
|
|
190
|
+
<span className="mono">{event}</span>: {EVENT_EXPOSURE[event]}
|
|
191
|
+
</p>
|
|
192
|
+
))}
|
|
193
|
+
<p>Give this service account only the secrets CI needs.</p>
|
|
194
|
+
</Notice>
|
|
195
|
+
);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/** What the bindings a plan replaces reached, beside what the new one reaches: the same, unless the person chose again. */
|
|
199
|
+
function Reached({ plan, bindings }: { plan: BindingPlan; bindings: BindingView[] }) {
|
|
200
|
+
const reached = [...new Set(plan.replaces.flatMap((replaced) => {
|
|
201
|
+
const scope = bindings.find((binding) => binding.id === replaced.id)?.scope;
|
|
202
|
+
return scope === undefined ? [] : [scope === null ? 'all its account holds' : credentialScopeInWords(scope)];
|
|
203
|
+
}))];
|
|
204
|
+
if (reached.every((words) => words === credentialScopeInWords(plan.scope))) return <> This one reaches what {plan.replaces.length === 1 ? 'it' : 'they'} did.</>;
|
|
205
|
+
return <> {plan.replaces.length === 1 ? 'It' : 'They'} reached {reached.join('; ')}: this one reaches what it says above.</>;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function TrustWorkload({ serviceId, grants, bindings }: { serviceId: string; grants: HeldGrant[]; bindings: BindingView[] }) {
|
|
152
209
|
const [open, setOpen] = useState(false);
|
|
153
210
|
const [form, setForm] = useState<Form>(EMPTY_FORM);
|
|
211
|
+
const whole = (): ScopeChoice => ({ scope: wholeScope(grants), chosen: false });
|
|
212
|
+
const [choice, setChoice] = useState(whole);
|
|
154
213
|
const [plan, setPlan] = useState<BindingPlan | null>(null);
|
|
155
214
|
const coffre = useCoffre();
|
|
156
215
|
const member = memberRef('service', serviceId);
|
|
@@ -160,11 +219,12 @@ function TrustWorkload({ serviceId }: { serviceId: string }) {
|
|
|
160
219
|
setForm((current) => ({ ...current, ...changes }));
|
|
161
220
|
setPlan(null);
|
|
162
221
|
};
|
|
163
|
-
const input = () => ({ ...bindingOf(form), label: form.label.trim() === '' ? null : form.label.trim(), replaces: [] });
|
|
222
|
+
const input = () => ({ ...bindingOf(form), ...askedScope(choice), label: form.label.trim() === '' ? null : form.label.trim(), replaces: [] });
|
|
164
223
|
|
|
165
224
|
function close() {
|
|
166
225
|
setOpen(false);
|
|
167
226
|
setForm(EMPTY_FORM);
|
|
227
|
+
setChoice(whole());
|
|
168
228
|
setPlan(null);
|
|
169
229
|
setError(null);
|
|
170
230
|
lookup.setError(null);
|
|
@@ -178,7 +238,14 @@ function TrustWorkload({ serviceId }: { serviceId: string }) {
|
|
|
178
238
|
setError((problem as Error).message);
|
|
179
239
|
return;
|
|
180
240
|
}
|
|
181
|
-
void run(() => coffre.bindings.preview(member, request), {
|
|
241
|
+
void run(() => coffre.bindings.preview(member, request), {
|
|
242
|
+
affects: [],
|
|
243
|
+
// One that replaces bindings reaches what they did unless told: the picker says so, should the person go back.
|
|
244
|
+
onSuccess: (next) => {
|
|
245
|
+
setPlan(next);
|
|
246
|
+
setChoice((current) => planned(current, next));
|
|
247
|
+
},
|
|
248
|
+
});
|
|
182
249
|
}
|
|
183
250
|
|
|
184
251
|
const field = (label: string, key: keyof Form, props: { placeholder?: string; mono?: boolean; hint?: string } = {}) => (
|
|
@@ -198,7 +265,15 @@ function TrustWorkload({ serviceId }: { serviceId: string }) {
|
|
|
198
265
|
<div className="form-row">
|
|
199
266
|
<label className="field" style={{ flex: '0 0 8rem' }}>
|
|
200
267
|
<span className="label">At</span>
|
|
201
|
-
<select
|
|
268
|
+
<select
|
|
269
|
+
className="select"
|
|
270
|
+
value={form.refKind}
|
|
271
|
+
onChange={(event) => {
|
|
272
|
+
const refKind = event.target.value as RefKind;
|
|
273
|
+
// A release runs at a tag; a schedule, a pull request or a workflow_run on a branch.
|
|
274
|
+
set({ refKind, events: form.events.filter((each) => githubEventsAt(refKind).includes(each)) });
|
|
275
|
+
}}
|
|
276
|
+
>
|
|
202
277
|
<option value="branch">Branch</option>
|
|
203
278
|
<option value="tag">Tag</option>
|
|
204
279
|
</select>
|
|
@@ -281,18 +356,15 @@ function TrustWorkload({ serviceId }: { serviceId: string }) {
|
|
|
281
356
|
) : (
|
|
282
357
|
field('Workflow file', 'workflow', { placeholder: 'deploy.yml', mono: true })
|
|
283
358
|
)}
|
|
284
|
-
<label className="field">
|
|
285
|
-
<span className="label">Event</span>
|
|
286
|
-
<select className="select" value={form.event} onChange={(event) => set({ event: event.target.value })}>
|
|
287
|
-
{GITHUB_EVENTS.map((event) => (
|
|
288
|
-
<option key={event} value={event}>
|
|
289
|
-
{event}
|
|
290
|
-
</option>
|
|
291
|
-
))}
|
|
292
|
-
</select>
|
|
293
|
-
<span className="hint">Pull requests and workflow_run are never trusted: their runs can carry a stranger's code.</span>
|
|
294
|
-
</label>
|
|
295
359
|
{ref}
|
|
360
|
+
<Choices
|
|
361
|
+
label="Events"
|
|
362
|
+
options={githubEventsAt(form.refKind)}
|
|
363
|
+
chosen={form.events}
|
|
364
|
+
onChange={(events) => set({ events })}
|
|
365
|
+
hint={form.events.includes('pull_request') ? `A pull request matches by the branch it merges into: ${form.refName.trim() || 'main'}.` : undefined}
|
|
366
|
+
/>
|
|
367
|
+
<Exposure events={form.events} />
|
|
296
368
|
</>
|
|
297
369
|
)}
|
|
298
370
|
|
|
@@ -324,17 +396,13 @@ function TrustWorkload({ serviceId }: { serviceId: string }) {
|
|
|
324
396
|
</div>
|
|
325
397
|
<ErrorLine error={lookup.error} />
|
|
326
398
|
{ref}
|
|
327
|
-
<
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
))}
|
|
335
|
-
</select>
|
|
336
|
-
<span className="hint">Merge-request pipelines are never trusted: they name another project.</span>
|
|
337
|
-
</label>
|
|
399
|
+
<Choices
|
|
400
|
+
label="Pipeline sources"
|
|
401
|
+
options={GITLAB_PIPELINE_SOURCES}
|
|
402
|
+
chosen={form.sources}
|
|
403
|
+
onChange={(sources) => set({ sources })}
|
|
404
|
+
hint="Merge-request pipelines are never trusted: they name another project."
|
|
405
|
+
/>
|
|
338
406
|
</>
|
|
339
407
|
)}
|
|
340
408
|
|
|
@@ -349,13 +417,21 @@ function TrustWorkload({ serviceId }: { serviceId: string }) {
|
|
|
349
417
|
</>
|
|
350
418
|
)}
|
|
351
419
|
|
|
420
|
+
<ScopePicker
|
|
421
|
+
grants={grants}
|
|
422
|
+
value={choice.scope}
|
|
423
|
+
onChange={(next) => {
|
|
424
|
+
setChoice({ scope: next, chosen: true });
|
|
425
|
+
setPlan(null);
|
|
426
|
+
}}
|
|
427
|
+
/>
|
|
352
428
|
{field('Label (optional)', 'label', { placeholder: 'Deploys to production' })}
|
|
353
429
|
<ErrorLine error={error} />
|
|
354
430
|
<div className="dialog-actions">
|
|
355
431
|
<button className="btn" type="button" onClick={close}>
|
|
356
432
|
Cancel
|
|
357
433
|
</button>
|
|
358
|
-
<button className="btn btn-primary" type="submit" disabled={pending}>
|
|
434
|
+
<button className="btn btn-primary" type="submit" disabled={pending || Object.keys(choice.scope).length === 0}>
|
|
359
435
|
{pending && <Spinner />}
|
|
360
436
|
Review
|
|
361
437
|
</button>
|
|
@@ -364,14 +440,16 @@ function TrustWorkload({ serviceId }: { serviceId: string }) {
|
|
|
364
440
|
) : (
|
|
365
441
|
<div className="form">
|
|
366
442
|
<p>
|
|
367
|
-
Runs whose ID token
|
|
368
|
-
|
|
443
|
+
Runs whose ID token matches these claims sign in as <span className="mono">service:{serviceId}</span> and reach{' '}
|
|
444
|
+
{credentialScopeInWords(plan.scope)}, as long as the account holds it.
|
|
369
445
|
</p>
|
|
370
446
|
<Claims binding={plan} />
|
|
447
|
+
<Exposure events={claimValues(plan.claims.event_name)} />
|
|
371
448
|
{plan.replaces.length > 0 && (
|
|
372
449
|
<Notice tone="info">
|
|
373
450
|
This replaces {plan.replaces.length === 1 ? 'a binding' : `${plan.replaces.length} bindings`}
|
|
374
451
|
{plan.replaces.some((replaced) => replaced.why === 'keys_moved') ? ', since the issuer moved its keys' : ''}.
|
|
452
|
+
<Reached plan={plan} bindings={bindings} />
|
|
375
453
|
</Notice>
|
|
376
454
|
)}
|
|
377
455
|
<ErrorLine error={error} />
|
|
@@ -383,7 +461,8 @@ function TrustWorkload({ serviceId }: { serviceId: string }) {
|
|
|
383
461
|
className="btn btn-primary"
|
|
384
462
|
type="button"
|
|
385
463
|
disabled={pending}
|
|
386
|
-
|
|
464
|
+
// What the review said it reaches, whatever the account holds by now.
|
|
465
|
+
onClick={() => void run(() => coffre.bindings.create(member, { ...input(), scope: plan.scope }), { affects: affects.bindings(member), onSuccess: close })}
|
|
387
466
|
>
|
|
388
467
|
{pending && <Spinner />}
|
|
389
468
|
Save binding
|
package/src/index.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
* and places in it links. `plain` flattens it, for tests and titles.
|
|
9
9
|
*/
|
|
10
10
|
import { shownMember, type AuditEntryView } from '@coffre/client';
|
|
11
|
+
import { INSTANCE_ROLES, isInstanceRole, isScope, scopeInWords, type Scope } from '@coffre/core/access';
|
|
11
12
|
|
|
12
13
|
/** What a sentence is made from: an entry of the log, as `GET /api/audit` gives it. */
|
|
13
14
|
export type AuditEntry = Pick<
|
|
@@ -261,6 +262,7 @@ const TEMPLATES: Record<string, Template> = {
|
|
|
261
262
|
then: ({ entry }) => [
|
|
262
263
|
...(text(entry.metadata.previousRole) === null ? [] : [`, was ${text(entry.metadata.previousRole)}`]),
|
|
263
264
|
...(text(entry.metadata.expiresAt) === null ? [] : [`, until ${text(entry.metadata.expiresAt)!.slice(0, 10)}`]),
|
|
265
|
+
...(entry.metadata.reason === 'every-project' ? [', for a grant on every project'] : []),
|
|
264
266
|
],
|
|
265
267
|
},
|
|
266
268
|
'access.revoke': {
|
|
@@ -272,13 +274,20 @@ const TEMPLATES: Record<string, Template> = {
|
|
|
272
274
|
' from ',
|
|
273
275
|
...subject(entry),
|
|
274
276
|
],
|
|
277
|
+
// The vault replacing a grant on every project of 0.4: by what, an instance role or project grants.
|
|
278
|
+
then: ({ entry }) => {
|
|
279
|
+
const by = entry.metadata.replacedBy as { role?: unknown } | undefined;
|
|
280
|
+
if (by === undefined) return [];
|
|
281
|
+
const role = typeof by.role === 'string' ? roleName(by.role) : null;
|
|
282
|
+
return [role === null || role === 'Member' ? ', replaced by project grants' : `, replaced by the instance role ${role}`];
|
|
283
|
+
},
|
|
275
284
|
},
|
|
276
285
|
'member.add': {
|
|
277
286
|
did: 'added',
|
|
278
287
|
tried: 'add',
|
|
279
288
|
what: ({ entry }) => [
|
|
280
289
|
...subject(entry),
|
|
281
|
-
...(entry.metadata.rootAdmin === true ? [' as a root admin'] : entry.metadata.owner === true ? [' as an owner'] :
|
|
290
|
+
...(entry.metadata.rootAdmin === true ? [' as a root admin'] : entry.metadata.owner === true ? [' as an owner'] : asRole(entry)),
|
|
282
291
|
],
|
|
283
292
|
},
|
|
284
293
|
'member.remove': {
|
|
@@ -287,17 +296,44 @@ const TEMPLATES: Record<string, Template> = {
|
|
|
287
296
|
what: (facts) => subject(facts.entry),
|
|
288
297
|
then: ({ entry }) => (number(entry.metadata.revoked) === null ? [] : [`, who held ${plural(number(entry.metadata.revoked)!, 'grant')}`]),
|
|
289
298
|
},
|
|
290
|
-
'member.restore': { did: 'brought back', tried: 'bring back', what: (
|
|
299
|
+
'member.restore': { did: 'brought back', tried: 'bring back', what: ({ entry }) => [...subject(entry), ...asRole(entry)] },
|
|
300
|
+
'member.role': {
|
|
301
|
+
did: 'made',
|
|
302
|
+
tried: 'make',
|
|
303
|
+
what: ({ entry }) => [...subject(entry), ` ${article(roleName(text(entry.metadata.role) ?? 'member') ?? 'Member')}`, ...scoped(entry)],
|
|
304
|
+
then: ({ entry }) => {
|
|
305
|
+
const before = roleName(text(entry.metadata.previousRole) ?? '');
|
|
306
|
+
return [...(before === null ? [] : [`, was ${before}`]), ...(entry.metadata.reason === 'every-project' ? [', for their grants on every project'] : [])];
|
|
307
|
+
},
|
|
308
|
+
},
|
|
291
309
|
'member.owner': {
|
|
292
310
|
did: ({ entry }) => (entry.metadata.owner === false ? 'took owner from' : 'made'),
|
|
293
311
|
tried: ({ entry }) => (entry.metadata.owner === false ? 'take owner from' : 'make'),
|
|
294
312
|
what: ({ entry }) => [...subject(entry), ...(entry.metadata.owner === false ? [] : [' an owner'])],
|
|
295
313
|
},
|
|
314
|
+
// Where people set up service accounts themselves, which those who run the instance set.
|
|
315
|
+
'settings.change': {
|
|
316
|
+
did: 'set',
|
|
317
|
+
tried: 'set',
|
|
318
|
+
what: ({ entry }) => ['where people set up service accounts', ...setting(entry.metadata.serviceAccounts).map((words) => `: ${words}`)],
|
|
319
|
+
then: ({ entry }) => {
|
|
320
|
+
const previous = (entry.metadata.previous as { serviceAccounts?: unknown } | undefined)?.serviceAccounts;
|
|
321
|
+
return setting(previous).map((words) => `, was ${words}`);
|
|
322
|
+
},
|
|
323
|
+
},
|
|
296
324
|
// A binding trusts CI runs to sign in as a service; removing one is its tombstone.
|
|
297
325
|
'token.bind': {
|
|
298
326
|
did: 'trusted CI runs to sign in as',
|
|
299
327
|
tried: 'trust CI runs to sign in as',
|
|
300
328
|
what: (facts) => subject(facts.entry),
|
|
329
|
+
then: ({ entry }) => reaching(entry),
|
|
330
|
+
},
|
|
331
|
+
// The tokens and bindings 0.4 made, given their own scope when 0.5 first checked a credential: what their account held then.
|
|
332
|
+
'token.seal': {
|
|
333
|
+
did: 'sealed',
|
|
334
|
+
tried: 'seal',
|
|
335
|
+
what: ({ entry }) => [`${sealedOf(entry)} of `, ...subject(entry)],
|
|
336
|
+
then: ({ entry }) => reaching(entry, ', reaching nothing'),
|
|
301
337
|
},
|
|
302
338
|
'token.unbind': {
|
|
303
339
|
did: 'stopped trusting CI runs to sign in as',
|
|
@@ -337,7 +373,7 @@ const TEMPLATES: Record<string, Template> = {
|
|
|
337
373
|
what: ({ entry }) => (text(entry.metadata.provider) === null ? [] : [`with ${text(entry.metadata.provider)}`]),
|
|
338
374
|
},
|
|
339
375
|
sign_out: { did: 'signed out', tried: 'sign out', what: () => [] },
|
|
340
|
-
'token.create': { did: 'issued a bearer token to', tried: 'issue a bearer token to', what: (facts) => subject(facts.entry) },
|
|
376
|
+
'token.create': { did: 'issued a bearer token to', tried: 'issue a bearer token to', what: (facts) => subject(facts.entry), then: ({ entry }) => reaching(entry) },
|
|
341
377
|
'token.revoke': { did: 'revoked a bearer token of', tried: 'revoke a bearer token of', what: (facts) => subject(facts.entry) },
|
|
342
378
|
'device.approve': { did: 'approved a CLI sign-in', tried: 'approve a CLI sign-in', what: () => [] },
|
|
343
379
|
'device.deny': { did: 'turned down a CLI sign-in', tried: 'turn down a CLI sign-in', what: () => [] },
|
|
@@ -384,6 +420,65 @@ function intoFolder(entry: AuditEntry): Part[] {
|
|
|
384
420
|
return [folder === null ? ' out of its folder' : ` to the folder ${folder}`];
|
|
385
421
|
}
|
|
386
422
|
|
|
423
|
+
/** An instance role's name, from its slug; null for none it knows. */
|
|
424
|
+
function roleName(role: string): string | null {
|
|
425
|
+
return isInstanceRole(role) ? INSTANCE_ROLES[role].name : null;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
function article(name: string): string {
|
|
429
|
+
return `${/^[AEIOU]/.test(name) ? 'an' : 'a'} ${name}`;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
/** Whether an entry's scope narrows the role; its projects are ids, which a sentence cannot name. */
|
|
433
|
+
function scoped(entry: AuditEntry): Part[] {
|
|
434
|
+
const scope = entry.metadata.scope as { projects?: unknown; environments?: unknown } | undefined;
|
|
435
|
+
return scope === undefined || (scope.projects === 'all' && scope.environments === 'all') ? [] : [', with a scope'];
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* What a token or binding reaches, its scope, each role with the places it
|
|
440
|
+
* holds, counted, as the log names them by id: `, reaching developer on 2 places`.
|
|
441
|
+
*/
|
|
442
|
+
function reaching(entry: AuditEntry, none = ''): Part[] {
|
|
443
|
+
const scope = entry.metadata.scope;
|
|
444
|
+
if (!Array.isArray(scope)) return [];
|
|
445
|
+
if (scope.length === 0) return none === '' ? [] : [none];
|
|
446
|
+
const byRole = new Map<string, number>();
|
|
447
|
+
for (const grant of scope as { role?: unknown }[]) {
|
|
448
|
+
const role = text(grant.role);
|
|
449
|
+
if (role !== null) byRole.set(role, (byRole.get(role) ?? 0) + 1);
|
|
450
|
+
}
|
|
451
|
+
return [`, reaching ${[...byRole].map(([role, count]) => `${role} on ${plural(count, 'place')}`).join(', ')}`];
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/** The tokens and trust bindings a `token.seal` names, counted: `2 tokens and a trust binding`. */
|
|
455
|
+
function sealedOf(entry: AuditEntry): string {
|
|
456
|
+
const count = (key: string) => (Array.isArray(entry.metadata[key]) ? (entry.metadata[key] as unknown[]).length : 0);
|
|
457
|
+
const parts = [[count('tokens'), 'token'], [count('bindings'), 'trust binding']] as const;
|
|
458
|
+
return parts.filter(([n]) => n > 0).map(([n, one]) => plural(n, one)).join(' and ') || 'nothing';
|
|
459
|
+
}
|
|
460
|
+
|
|
461
|
+
/**
|
|
462
|
+
* The setting of where people set up service accounts, in words: its
|
|
463
|
+
* projects counted, as the log names them by id, its environments by name.
|
|
464
|
+
*
|
|
465
|
+
* All projects · all but prod 2 projects · dev only
|
|
466
|
+
*/
|
|
467
|
+
function setting(scope: unknown): string[] {
|
|
468
|
+
if (!isScope(scope)) return [];
|
|
469
|
+
const { projects } = scope;
|
|
470
|
+
const counted: Scope = projects === 'all'
|
|
471
|
+
? scope
|
|
472
|
+
: { ...scope, projects: 'only' in projects ? { only: [plural(projects.only.length, 'project')] } : { except: [plural(projects.except.length, 'project')] } };
|
|
473
|
+
return [scopeInWords(counted)];
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/** The role a member is added or brought back with, said when it is more than Member. */
|
|
477
|
+
function asRole(entry: AuditEntry): Part[] {
|
|
478
|
+
const role = roleName(text(entry.metadata.role) ?? '');
|
|
479
|
+
return role === null || role === 'Member' ? [] : [` as ${article(role)}`, ...scoped(entry)];
|
|
480
|
+
}
|
|
481
|
+
|
|
387
482
|
function placeOnly(entry: AuditEntry): Part[] {
|
|
388
483
|
// A grant on every project names no project: its place is a path in its payload, `*` or `*/dev`.
|
|
389
484
|
const everywhere = entry.project === null ? text(entry.metadata.place) : null;
|
|
@@ -414,6 +509,12 @@ const REASONS: Record<string, string> = {
|
|
|
414
509
|
deleted: 'the place was deleted',
|
|
415
510
|
not_allowed: 'not allowed',
|
|
416
511
|
root_admin: 'root admins are set by the deployment',
|
|
512
|
+
requires_instance_admin: 'requires an admin or owner of the whole instance',
|
|
513
|
+
requires_instance_owner: 'requires an instance owner',
|
|
514
|
+
own_role: 'nobody changes their own role',
|
|
515
|
+
own_grant: 'nobody grants themselves a role',
|
|
516
|
+
service_cannot_hold_role: 'service accounts hold project grants only',
|
|
517
|
+
not_service_manager: 'they hold less than the service account, or than they gave it',
|
|
417
518
|
unknown_environment: 'no such environment',
|
|
418
519
|
unknown_secret: 'no such secret',
|
|
419
520
|
no_value: 'it holds no value',
|