@coffre/core 0.9.0 → 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/{access-CONhKG2P.d.ts → access-CF4noOjL.d.ts} +214 -36
- package/dist/{access-B1wpMzEB.js → access-Dl13x6mB.js} +284 -46
- package/dist/access.d.ts +2 -2
- package/dist/access.js +2 -2
- package/dist/envelope.d.ts +8 -5
- package/dist/envelope.js +13 -5
- package/dist/identity.d.ts +1 -1
- package/dist/kek.d.ts +1 -1
- package/dist/kek.js +3 -2
- package/dist/recipe.d.ts +3 -2
- package/dist/{registry-Bd7hPoY4.d.ts → registry-D7X-x202.d.ts} +9 -4
- package/dist/schemas.d.ts +2 -0
- package/dist/schemas.js +4 -2
- package/dist/{types-E1Sz50n6.js → types-Cp3lB_-W.js} +3 -2
- package/dist/vault.d.ts +121 -23
- package/dist/vault.js +28 -8
- package/package.json +2 -2
- package/src/access-conversion.ts +1 -1
- package/src/access.ts +312 -58
- package/src/context.ts +11 -5
- package/src/envelope.ts +14 -6
- package/src/identity/tokens.ts +1 -1
- package/src/kek/aws-kms.ts +2 -0
- package/src/recipe.ts +3 -3
- package/src/schemas.ts +4 -1
- package/src/vault.ts +117 -17
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
/** A grant on every project of 0.4: on all of each (`environmentSlug` null), or on the environment of one slug in each. */
|
|
34
34
|
type EveryProjectGrant = {
|
|
35
35
|
environmentSlug: string | null;
|
|
36
|
-
role:
|
|
36
|
+
role: BuiltinRole;
|
|
37
37
|
expiresAt: number | null;
|
|
38
38
|
};
|
|
39
39
|
type ConversionInput = {
|
|
@@ -45,7 +45,7 @@ type ConversionInput = {
|
|
|
45
45
|
everyProject: readonly EveryProjectGrant[];
|
|
46
46
|
/** Their live grants on projects and environments. */
|
|
47
47
|
grants: readonly (GrantPlace & {
|
|
48
|
-
role:
|
|
48
|
+
role: BuiltinRole;
|
|
49
49
|
expiresAt: number | null;
|
|
50
50
|
})[];
|
|
51
51
|
/** The projects there are now, deleted ones left out, with their environments. */
|
|
@@ -61,9 +61,9 @@ type ConversionInput = {
|
|
|
61
61
|
type ConvertedGrant = {
|
|
62
62
|
projectId: string;
|
|
63
63
|
environmentId: string | null;
|
|
64
|
-
role:
|
|
64
|
+
role: BuiltinRole;
|
|
65
65
|
expiresAt: number | null;
|
|
66
|
-
replaces:
|
|
66
|
+
replaces: BuiltinRole | null;
|
|
67
67
|
};
|
|
68
68
|
/** Where the conversion gives less than a grant on every project did, each naming the grant it comes of. */
|
|
69
69
|
type Narrowed =
|
|
@@ -81,7 +81,7 @@ type Narrowed =
|
|
|
81
81
|
kind: 'environments';
|
|
82
82
|
grant: EveryProjectGrant;
|
|
83
83
|
projectId: string;
|
|
84
|
-
role:
|
|
84
|
+
role: BuiltinRole;
|
|
85
85
|
} |
|
|
86
86
|
/** No grant here holds both: `kept` stays (until `keptUntil`), and what `lost` held beyond it is gone. */
|
|
87
87
|
{
|
|
@@ -89,8 +89,8 @@ type Narrowed =
|
|
|
89
89
|
grant: EveryProjectGrant;
|
|
90
90
|
projectId: string;
|
|
91
91
|
environmentId: string | null;
|
|
92
|
-
lost:
|
|
93
|
-
kept:
|
|
92
|
+
lost: BuiltinRole;
|
|
93
|
+
kept: BuiltinRole;
|
|
94
94
|
keptUntil: number | null;
|
|
95
95
|
};
|
|
96
96
|
type Conversion = {
|
|
@@ -103,7 +103,7 @@ declare function convertEveryProjectGrants(input: ConversionInput): Conversion;
|
|
|
103
103
|
//#endregion
|
|
104
104
|
//#region src/access.d.ts
|
|
105
105
|
/**
|
|
106
|
-
* Who may do what:
|
|
106
|
+
* Who may do what: eight permissions, the seven project roles a grant names,
|
|
107
107
|
* and the five instance roles a person holds across every project.
|
|
108
108
|
*
|
|
109
109
|
* Deliberately constants and not tables or a policy language. A grant names
|
|
@@ -111,7 +111,14 @@ declare function convertEveryProjectGrants(input: ConversionInput): Conversion;
|
|
|
111
111
|
* role and its scope, and a check is a lookup in this file, so authorisation
|
|
112
112
|
* stays something you can read end to end.
|
|
113
113
|
*/
|
|
114
|
-
|
|
114
|
+
/**
|
|
115
|
+
* `secret.read` hands a value back: a reveal, `coffre get`, `coffre run`'s
|
|
116
|
+
* values. `secret.use` uses it without handing it back: a placeholder in a
|
|
117
|
+
* person's app, the credential proxy filling it in (docs/design/credential-proxy.md).
|
|
118
|
+
* Every role that reads uses too. What a person gets is the narrower of the
|
|
119
|
+
* two and the key's sensitivity: a sensitive key is only ever used.
|
|
120
|
+
*/
|
|
121
|
+
declare const PERMISSIONS: readonly ["secret.read", "secret.use", "secret.write", "secret.archive", "audit.read", "environment.manage", "grant.manage", "project.manage"];
|
|
115
122
|
type Permission = (typeof PERMISSIONS)[number];
|
|
116
123
|
/**
|
|
117
124
|
* Permissions that only make sense on a project. Granting
|
|
@@ -119,44 +126,80 @@ type Permission = (typeof PERMISSIONS)[number];
|
|
|
119
126
|
* authorises is creating that environment's siblings.
|
|
120
127
|
*/
|
|
121
128
|
declare const PROJECT_ONLY_PERMISSIONS: readonly Permission[];
|
|
129
|
+
/**
|
|
130
|
+
* What a role holds: `permissions` in an environment that is not
|
|
131
|
+
* protected, and on its project; `protected`, what a person holds of it in
|
|
132
|
+
* a protected environment (docs/design/roles.md). Project-wide permissions
|
|
133
|
+
* are in `permissions` alone: a project is never protected. A service
|
|
134
|
+
* account holds `permissions` everywhere.
|
|
135
|
+
*/
|
|
136
|
+
type RoleDefinition = {
|
|
137
|
+
name: string;
|
|
138
|
+
description: string;
|
|
139
|
+
permissions: readonly Permission[];
|
|
140
|
+
protected: readonly Permission[];
|
|
141
|
+
};
|
|
122
142
|
declare const ROLES: {
|
|
123
143
|
readonly viewer: {
|
|
124
144
|
readonly name: "Viewer";
|
|
125
|
-
readonly description: "Read secret values.";
|
|
126
|
-
readonly permissions: readonly ["secret.read"];
|
|
145
|
+
readonly description: "Read and use secret values.";
|
|
146
|
+
readonly permissions: readonly ["secret.read", "secret.use"];
|
|
147
|
+
readonly protected: readonly ["secret.use"];
|
|
148
|
+
};
|
|
149
|
+
readonly contributor: {
|
|
150
|
+
readonly name: "Contributor";
|
|
151
|
+
readonly description: "Use and write secrets, never read them: apps get placeholders through the credential proxy.";
|
|
152
|
+
readonly permissions: readonly ["secret.use", "secret.write"];
|
|
153
|
+
readonly protected: readonly ["secret.use", "secret.write"];
|
|
127
154
|
};
|
|
128
155
|
readonly developer: {
|
|
129
156
|
readonly name: "Developer";
|
|
130
|
-
readonly description: "Read and write secrets.";
|
|
131
|
-
readonly permissions: readonly ["secret.read", "secret.write"];
|
|
157
|
+
readonly description: "Read, use and write secrets.";
|
|
158
|
+
readonly permissions: readonly ["secret.read", "secret.use", "secret.write"];
|
|
159
|
+
readonly protected: readonly ["secret.use", "secret.write"];
|
|
132
160
|
};
|
|
133
161
|
readonly maintainer: {
|
|
134
162
|
readonly name: "Maintainer";
|
|
135
|
-
readonly description: "Read, write and retire secrets, and manage environments.";
|
|
136
|
-
readonly permissions: readonly ["secret.read", "secret.write", "secret.archive", "environment.manage"];
|
|
163
|
+
readonly description: "Read, use, write and retire secrets, and manage environments.";
|
|
164
|
+
readonly permissions: readonly ["secret.read", "secret.use", "secret.write", "secret.archive", "environment.manage"];
|
|
165
|
+
readonly protected: readonly ["secret.use", "secret.write", "secret.archive"];
|
|
137
166
|
};
|
|
138
167
|
readonly 'access-manager': {
|
|
139
168
|
readonly name: "Access manager";
|
|
140
169
|
readonly description: "Manage who has access. Cannot read secret values.";
|
|
141
170
|
readonly permissions: readonly ["grant.manage"];
|
|
171
|
+
readonly protected: readonly [];
|
|
142
172
|
};
|
|
143
173
|
readonly auditor: {
|
|
144
174
|
readonly name: "Auditor";
|
|
145
175
|
readonly description: "Read the audit log. Cannot read secret values.";
|
|
146
176
|
readonly permissions: readonly ["audit.read"];
|
|
177
|
+
readonly protected: readonly ["audit.read"];
|
|
147
178
|
};
|
|
148
179
|
readonly owner: {
|
|
149
180
|
readonly name: "Owner";
|
|
150
181
|
readonly description: "Everything, including reading secret values.";
|
|
151
|
-
readonly permissions: readonly ["secret.read", "secret.write", "secret.archive", "audit.read", "environment.manage", "grant.manage", "project.manage"];
|
|
182
|
+
readonly permissions: readonly ["secret.read", "secret.use", "secret.write", "secret.archive", "audit.read", "environment.manage", "grant.manage", "project.manage"];
|
|
183
|
+
readonly protected: ("secret.read" | "secret.use" | "secret.write" | "secret.archive" | "audit.read" | "environment.manage" | "grant.manage" | "project.manage")[];
|
|
152
184
|
};
|
|
153
185
|
};
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
186
|
+
/** A role coffre ships, as its default says (`ROLES`); an Owner may edit any but Owner. */
|
|
187
|
+
type BuiltinRole = keyof typeof ROLES;
|
|
188
|
+
/** A project role by id: one coffre ships, or one an Owner made (`ROLE_ID`), as the instance's policy defines it. */
|
|
189
|
+
type Role = string;
|
|
190
|
+
declare const ROLE_NAMES: BuiltinRole[];
|
|
191
|
+
/** A custom role's id: lowercase, as a slug, and no built-in one's. */
|
|
192
|
+
declare const ROLE_ID: RegExp;
|
|
193
|
+
/** Whether `value` names a role of `policy`'s: a built-in one, as it ships, unless told. */
|
|
194
|
+
declare function isRole(value: string, policy?: Policy): value is Role;
|
|
195
|
+
/** Whether `value` is one of the roles coffre ships. */
|
|
196
|
+
declare function isBuiltinRole(value: string): value is BuiltinRole;
|
|
197
|
+
/** Whether `role` holds `permission` where nothing is protected, as `policy` defines it: as it ships, unless told. */
|
|
198
|
+
declare function roleGrants(role: Role, permission: Permission, policy?: Policy): boolean;
|
|
158
199
|
/** Roles that hold a project-only permission can only be granted on a project. */
|
|
159
|
-
declare function assignableToEnvironment(role: Role): boolean;
|
|
200
|
+
declare function assignableToEnvironment(role: Role, policy?: Policy): boolean;
|
|
201
|
+
/** A project role's definition in `policy`, or undefined for none. */
|
|
202
|
+
declare function definitionOf(policy: Policy, role: Role): RoleDefinition | undefined;
|
|
160
203
|
/**
|
|
161
204
|
* A person's role on the whole instance: what they hold in every project
|
|
162
205
|
* their scope covers, before any grant. Service accounts are always
|
|
@@ -168,32 +211,96 @@ declare const INSTANCE_ROLES: {
|
|
|
168
211
|
readonly name: "Member";
|
|
169
212
|
readonly description: "None.";
|
|
170
213
|
readonly permissions: readonly [];
|
|
214
|
+
readonly protected: readonly [];
|
|
171
215
|
};
|
|
172
216
|
readonly auditor: {
|
|
173
217
|
readonly name: "Auditor";
|
|
174
218
|
readonly description: "Read the audit log. No secret values.";
|
|
175
219
|
readonly permissions: readonly ["audit.read"];
|
|
220
|
+
readonly protected: readonly ["audit.read"];
|
|
176
221
|
};
|
|
177
222
|
readonly developer: {
|
|
178
223
|
readonly name: "Developer";
|
|
179
|
-
readonly description: "Read and write secrets.";
|
|
180
|
-
readonly permissions: readonly ["secret.read", "secret.write"];
|
|
224
|
+
readonly description: "Read, use and write secrets.";
|
|
225
|
+
readonly permissions: readonly ["secret.read", "secret.use", "secret.write"];
|
|
226
|
+
readonly protected: readonly ["secret.use", "secret.write"];
|
|
181
227
|
};
|
|
182
228
|
readonly admin: {
|
|
183
229
|
readonly name: "Admin";
|
|
184
230
|
readonly description: "Manage people, service accounts, projects and access. No secret values.";
|
|
185
231
|
readonly permissions: readonly ["audit.read", "environment.manage", "grant.manage", "project.manage"];
|
|
232
|
+
readonly protected: readonly ["audit.read"];
|
|
186
233
|
};
|
|
187
234
|
readonly owner: {
|
|
188
235
|
readonly name: "Owner";
|
|
189
236
|
readonly description: "Everything, every secret included.";
|
|
190
|
-
readonly permissions: readonly ["secret.read", "secret.write", "secret.archive", "audit.read", "environment.manage", "grant.manage", "project.manage"];
|
|
237
|
+
readonly permissions: readonly ["secret.read", "secret.use", "secret.write", "secret.archive", "audit.read", "environment.manage", "grant.manage", "project.manage"];
|
|
238
|
+
readonly protected: ("secret.read" | "secret.use" | "secret.write" | "secret.archive" | "audit.read" | "environment.manage" | "grant.manage" | "project.manage")[];
|
|
191
239
|
};
|
|
192
240
|
};
|
|
193
241
|
type InstanceRole = keyof typeof INSTANCE_ROLES;
|
|
194
242
|
declare const INSTANCE_ROLE_NAMES: InstanceRole[];
|
|
195
243
|
declare function isInstanceRole(value: string): value is InstanceRole;
|
|
196
|
-
|
|
244
|
+
/** Whether an instance role holds `permission` where nothing is protected, as `policy` defines it: as it ships, unless told. */
|
|
245
|
+
declare function instanceRoleGrants(role: InstanceRole, permission: Permission, policy?: Policy): boolean;
|
|
246
|
+
/**
|
|
247
|
+
* The instance's access policy, which the vault keeps (docs/design/roles.md):
|
|
248
|
+
* its project roles, the built-ins as an Owner edited them and the ones an
|
|
249
|
+
* Owner made, its instance roles as edited, and which environments are
|
|
250
|
+
* protected, by id. The vault decides on it, and tells the app it with
|
|
251
|
+
* every member's access.
|
|
252
|
+
*/
|
|
253
|
+
type Policy = {
|
|
254
|
+
roles: Readonly<Record<Role, RoleDefinition>>;
|
|
255
|
+
instanceRoles: Readonly<Record<InstanceRole, RoleDefinition>>;
|
|
256
|
+
protected: readonly string[];
|
|
257
|
+
/**
|
|
258
|
+
* The protected environments by their project's id, each with its slug,
|
|
259
|
+
* which a scoped role's filters read: what a grant on a whole project
|
|
260
|
+
* reaches of them. A fork's slug is null until its row is written.
|
|
261
|
+
*/
|
|
262
|
+
protectedIn: Readonly<Record<string, readonly {
|
|
263
|
+
environmentId: string;
|
|
264
|
+
slug: string | null;
|
|
265
|
+
}[]>>;
|
|
266
|
+
};
|
|
267
|
+
/** The policy before any Owner edits it: every role as it ships, and no environment protected. */
|
|
268
|
+
declare const DEFAULT_POLICY: Policy;
|
|
269
|
+
/**
|
|
270
|
+
* How long the policy keeps an environment's id protected before its row
|
|
271
|
+
* is written, a fork's in flight, which writes it one call later; one with
|
|
272
|
+
* no row after that is a fork refused or abandoned. Until then it is a
|
|
273
|
+
* place a check on its project weighs (`protectedWithin`), which no scoped
|
|
274
|
+
* instance role's filters take in, so short. A fork writes its row only
|
|
275
|
+
* well within it, so no row ever brings back an id the policy dropped.
|
|
276
|
+
*/
|
|
277
|
+
declare const UNWRITTEN_FORK_MS: number;
|
|
278
|
+
/** The roles an Owner may not edit: Owner, which holds everything, and the instance's Member, which holds nothing. */
|
|
279
|
+
declare const FIXED_ROLES: {
|
|
280
|
+
roles: readonly string[];
|
|
281
|
+
instanceRoles: readonly InstanceRole[];
|
|
282
|
+
};
|
|
283
|
+
/**
|
|
284
|
+
* What is wrong with a role's definition, or null: a name and a
|
|
285
|
+
* description; known permissions, each once; reading implies using, in
|
|
286
|
+
* each column; and the protected column holds no more than the other, and
|
|
287
|
+
* nothing project-wide.
|
|
288
|
+
*/
|
|
289
|
+
declare function definitionProblem(definition: RoleDefinition): string | null;
|
|
290
|
+
/** A definition as the vault stores and compares it: each column in catalogue order. */
|
|
291
|
+
declare function normalDefinition(definition: RoleDefinition): RoleDefinition;
|
|
292
|
+
/**
|
|
293
|
+
* Whether `definition` gives `holder` `permission` at `place`: its
|
|
294
|
+
* protected column for a person in a protected environment, its other
|
|
295
|
+
* column anywhere else, and project-wide permissions from that one always.
|
|
296
|
+
*/
|
|
297
|
+
declare function holds(definition: RoleDefinition | undefined, permission: Permission, place: Place, holder: Pick<Holdings, 'policy' | 'service'>): boolean;
|
|
298
|
+
/** In a policy's `protected`, every environment: the policy the vault falls back on when it cannot read its own (`CLOSED_POLICY`). */
|
|
299
|
+
declare const EVERY_ENVIRONMENT = "*";
|
|
300
|
+
/** Whether `holder` holds the protected column at `place`: a person, in an environment the policy protects. */
|
|
301
|
+
declare function guarded(holder: Pick<Holdings, 'policy' | 'service'>, place: Place): boolean;
|
|
302
|
+
/** Whether `policy` protects the environment of this id: by name, or every one (`EVERY_ENVIRONMENT`). */
|
|
303
|
+
declare function protects(policy: Policy, environmentId: string): boolean;
|
|
197
304
|
/** The roles that manage people and access: Admin, and Owner, which adds every secret. */
|
|
198
305
|
declare function administers(role: InstanceRole): boolean;
|
|
199
306
|
/**
|
|
@@ -297,10 +404,64 @@ declare function grantKind(grant: GrantPlace): 'project' | 'environment' | null;
|
|
|
297
404
|
* A person's personal token carries one too, each grant one they held when
|
|
298
405
|
* they made it (`delegable` roles only), and is weighed the same way
|
|
299
406
|
* against what they hold now, by their instance role or their grants.
|
|
407
|
+
*
|
|
408
|
+
* Each grant keeps what its role held when the credential was issued, both
|
|
409
|
+
* columns (`permissions`), and no more than its issuer held, so neither a
|
|
410
|
+
* role an Owner widens later nor its issuer widens the credential
|
|
411
|
+
* (docs/design/roles.md, section 8, rule 3).
|
|
412
|
+
*/
|
|
413
|
+
type CredentialScope = readonly ScopeGrant[];
|
|
414
|
+
/** What a role holds, or a credential's grant held when it was issued: where nothing is protected, and in a protected environment. */
|
|
415
|
+
type Columns = {
|
|
416
|
+
normal: readonly Permission[];
|
|
417
|
+
protected: readonly Permission[];
|
|
418
|
+
};
|
|
419
|
+
/**
|
|
420
|
+
* One place of a credential's scope: a role there, and what it held when
|
|
421
|
+
* the credential was issued (`issuedGrant`). One kept by a release before
|
|
422
|
+
* 0.10, its role's name alone, holds that role as it ships, a constant no
|
|
423
|
+
* edit changes, so it never widens either: a built-in role's, or nothing
|
|
424
|
+
* for any other name.
|
|
425
|
+
*/
|
|
426
|
+
type ScopeGrant = GrantPlace & {
|
|
427
|
+
role: Role;
|
|
428
|
+
permissions?: Columns;
|
|
429
|
+
};
|
|
430
|
+
/**
|
|
431
|
+
* A grant of a scope with what its role holds now in `policy`, kept: what a
|
|
432
|
+
* credential issued now carries. Given what its issuer holds at its place
|
|
433
|
+
* (`heldColumns`), no more than that either, column by column, so that
|
|
434
|
+
* neither the role nor the issuer, widened later, widens the credential:
|
|
435
|
+
*
|
|
436
|
+
* viewer edited to read in prod; Ada, a Developer, uses there
|
|
437
|
+
* Ada's token, viewer on market read, use / use
|
|
438
|
+
* Developer widened to read in prod the token still only uses prod
|
|
300
439
|
*/
|
|
301
|
-
|
|
440
|
+
declare function issuedGrant(grant: GrantPlace & {
|
|
302
441
|
role: Role;
|
|
303
|
-
})
|
|
442
|
+
}, policy?: Policy, held?: Columns): ScopeGrant;
|
|
443
|
+
/**
|
|
444
|
+
* What `holder` holds at `place` in each column a credential's grant there
|
|
445
|
+
* keeps (`issuedGrant`): `normal`, as if nothing were protected; `protected`,
|
|
446
|
+
* as a person in a protected environment. At an environment, as if it were
|
|
447
|
+
* protected; at a project, in an environment of it that no grant names,
|
|
448
|
+
* the least they hold in any of its environments, those it protects later
|
|
449
|
+
* included: only what covers the whole project reaches one.
|
|
450
|
+
*
|
|
451
|
+
* Ada, a Developer of market, at market read, use, write / use, write
|
|
452
|
+
*/
|
|
453
|
+
declare function heldColumns(holder: Holdings, place: Place): Columns;
|
|
454
|
+
/**
|
|
455
|
+
* The protected environments a grant at `place` reaches beyond it: for a
|
|
456
|
+
* grant on a project, each of its environments `policy` protects, where a
|
|
457
|
+
* person holds the protected column and a service account the other one;
|
|
458
|
+
* none for a grant on an environment. Whoever checks a grant on a project
|
|
459
|
+
* against what someone holds checks it there too (`givesService`,
|
|
460
|
+
* `personalScope`): it reaches them.
|
|
461
|
+
*/
|
|
462
|
+
declare function protectedWithin(policy: Policy, place: Place): Place[];
|
|
463
|
+
/** What a scope's grant holds, as it was issued, as a role holds it: whatever the role is now, which no edit changes. */
|
|
464
|
+
declare function scopeDefinition(grant: ScopeGrant): RoleDefinition;
|
|
304
465
|
/** The most places a scope asked for names: far more than any credential needs, and a bound on what a request makes the app check. */
|
|
305
466
|
declare const MAX_SCOPE_PLACES = 1000;
|
|
306
467
|
/**
|
|
@@ -310,8 +471,10 @@ declare const MAX_SCOPE_PLACES = 1000;
|
|
|
310
471
|
* than it was given. A project's Owner who wants a token for all of it
|
|
311
472
|
* names `maintainer`.
|
|
312
473
|
*/
|
|
313
|
-
declare function delegable(role: Role): boolean;
|
|
474
|
+
declare function delegable(role: Role, policy?: Policy): boolean;
|
|
314
475
|
/** The roles a personal token's scope may name, in catalogue order. */
|
|
476
|
+
declare function delegableRoles(policy?: Policy): Role[];
|
|
477
|
+
/** The roles a personal token's scope may name, as they ship. */
|
|
315
478
|
declare const DELEGABLE_ROLES: readonly Role[];
|
|
316
479
|
/**
|
|
317
480
|
* The longest a personal token lasts: a week. It is for an afternoon's
|
|
@@ -348,6 +511,10 @@ type Holdings = {
|
|
|
348
511
|
* holder's instance role.
|
|
349
512
|
*/
|
|
350
513
|
credentialScope?: CredentialScope | null;
|
|
514
|
+
/** The instance's policy, its roles and protected environments, as the vault said it: as it ships, absent. */
|
|
515
|
+
policy?: Policy;
|
|
516
|
+
/** A service account's, which holds each role's normal column everywhere; a person's holds a protected environment's column there. */
|
|
517
|
+
service?: boolean;
|
|
351
518
|
};
|
|
352
519
|
/** Someone who holds nothing: a stranger, a removed member, a tampered row. */
|
|
353
520
|
declare const NOTHING: Holdings;
|
|
@@ -408,9 +575,12 @@ type ServiceSetting = Scope;
|
|
|
408
575
|
* developer there, never maintainer; a grant on `market` takes holding it
|
|
409
576
|
* on all of `market`. `setting` is null for a service account, which sets
|
|
410
577
|
* up none; a request on a credential with a scope sets none up either,
|
|
411
|
-
* since what it set up would outlive it.
|
|
578
|
+
* since what it set up would outlive it. A service account holds a role's
|
|
579
|
+
* normal column even in a protected environment, so a person there, who
|
|
580
|
+
* holds its protected column, gives none what they do not hold themselves:
|
|
581
|
+
* a Developer of a protected prod, who only uses it, gives no viewer there.
|
|
412
582
|
*/
|
|
413
|
-
declare function givesService(holder: Holdings, setting: ServiceSetting | null, role: Role, place: Place): boolean;
|
|
583
|
+
declare function givesService(holder: Holdings, setting: ServiceSetting | null, role: Role, place: Place, kept?: RoleDefinition): boolean;
|
|
414
584
|
/** Whether `holder` gives a service account anything anywhere among `places`: whether they set any up. */
|
|
415
585
|
declare function setsUpServices(holder: Holdings, setting: ServiceSetting | null, places: readonly Place[]): boolean;
|
|
416
586
|
/** A service account as `managesService` weighs it: its live grants, where they are, and who admitted it. */
|
|
@@ -437,19 +607,27 @@ declare function managesService(holder: Holdings, setting: ServiceSetting | null
|
|
|
437
607
|
* Whether `holder`, the member `actor`, may issue a token or a trust
|
|
438
608
|
* binding of `account` whose scope is `scope`: they manage the account
|
|
439
609
|
* (`managesService`), and each grant of the scope is one they could give it
|
|
440
|
-
* (`givesService`) and one it holds, every permission of its role there
|
|
610
|
+
* (`givesService`) and one it holds, every permission of its role there;
|
|
611
|
+
* of a grant that keeps less than its role, every permission it `kept`, as
|
|
612
|
+
* a binding replacing others keeps what they held.
|
|
441
613
|
* For an account that holds `developer` on `market/dev`, a Developer of
|
|
442
614
|
* `dev` issues `developer` or `viewer` there; nobody issues `market/prod`
|
|
443
615
|
* for it, or `maintainer` on `market/dev`, until the account holds them.
|
|
444
616
|
*/
|
|
445
|
-
declare function issuesCredential(holder: Holdings, setting: ServiceSetting | null, actor: string, account: ServiceAccount, scope:
|
|
617
|
+
declare function issuesCredential(holder: Holdings, setting: ServiceSetting | null, actor: string, account: ServiceAccount, scope: readonly {
|
|
618
|
+
role: Role;
|
|
619
|
+
place: Place;
|
|
620
|
+
kept?: RoleDefinition;
|
|
621
|
+
}[]): boolean;
|
|
446
622
|
/**
|
|
447
623
|
* Whether the holder reads the whole log, the instance's own entries
|
|
448
624
|
* (sign-ins, people, service accounts, settings) with every project's, and
|
|
449
625
|
* verifies it: whoever holds `audit.read` by an instance role whose scope
|
|
450
|
-
* narrows nothing, an Auditor's included
|
|
451
|
-
*
|
|
452
|
-
*
|
|
626
|
+
* narrows nothing, in both its columns, an Auditor's included: an Auditor
|
|
627
|
+
* edited to read no protected environment's log reads every other place's,
|
|
628
|
+
* and not the whole. Reading, not running: an Auditor of the whole
|
|
629
|
+
* instance changes nothing it reads about. Anyone else reads the places
|
|
630
|
+
* they hold `audit.read` in.
|
|
453
631
|
*/
|
|
454
632
|
declare function readsWholeLog(holder: Holdings): boolean;
|
|
455
633
|
/**
|
|
@@ -460,4 +638,4 @@ declare function readsWholeLog(holder: Holdings): boolean;
|
|
|
460
638
|
*/
|
|
461
639
|
declare function makesProjects(holder: Holdings): boolean;
|
|
462
640
|
//#endregion
|
|
463
|
-
export {
|
|
641
|
+
export { isRole as $, ServiceAccount as A, definitionProblem as B, ROLES as C, Narrowed as Ct, RoleDefinition as D, Role as E, allows as F, guarded as G, delegableRoles as H, assignableToEnvironment as I, inScope as J, heldColumns as K, covers as L, UNWRITTEN_FORK_MS as M, administers as N, Scope as O, admits as P, isInstanceRole as Q, credentialScopeInWords as R, Policy as S, EveryProjectGrant as St, ROLE_NAMES as T, givesService as U, delegable as V, grantKind as W, isBuiltinRole as X, instanceRoleGrants as Y, isCredentialScope as Z, NOTHING as _, unscoped as _t, DELEGABLE_ROLES as a, mayManageAccess as at, Permission as b, ConversionInput as bt, FIXED_ROLES as c, ownsInstance as ct, Holdings as d, readsWholeLog as dt, isScope as et, INSTANCE_ROLES as f, roleGrants as ft, MAX_SCOPE_PLACES as g, setsUpServices as gt, MAX_PERSONAL_TOKEN_MINUTES as h, scopeInWords as ht, DEFAULT_POLICY as i, managesService as it, ServiceSetting as j, ScopeGrant as k, Filter as l, protectedWithin as lt, InstanceRole as m, scopeDefinition as mt, Columns as n, issuesCredential as nt, EVERYWHERE as o, normalDefinition as ot, INSTANCE_ROLE_NAMES as p, runsInstance as pt, holds as q, CredentialScope as r, makesProjects as rt, EVERY_ENVIRONMENT as s, normalScope as st, BuiltinRole as t, issuedGrant as tt, GrantPlace as u, protects as ut, PERMISSIONS as v, withinCredential as vt, ROLE_ID as w, convertEveryProjectGrants as wt, Place as x, ConvertedGrant as xt, PROJECT_ONLY_PERMISSIONS as y, Conversion as yt, definitionOf as z };
|