@coffre/core 0.14.4 → 0.15.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-CembYDiI.js → access-CgQTlUMz.js} +93 -1
- package/dist/{access-CU3xEOLH.d.ts → access-DqLJjnLM.d.ts} +67 -1
- package/dist/access.d.ts +2 -2
- package/dist/access.js +2 -2
- package/dist/identity.d.ts +102 -2
- package/dist/identity.js +410 -161
- package/dist/mcp.d.ts +3 -2
- package/dist/mcp.js +6 -2
- package/dist/merkle.d.ts +456 -0
- package/dist/merkle.js +964 -0
- package/dist/schemas.d.ts +11 -3
- package/dist/schemas.js +12 -2
- package/dist/vault.d.ts +1181 -6
- package/dist/vault.js +280 -1
- package/dist/{workloads-CW2dK4AW.d.ts → workloads-D049JH0M.d.ts} +9 -1
- package/dist/workloads.d.ts +2 -2
- package/dist/workloads.js +9 -1
- package/package.json +8 -3
- package/src/access.ts +93 -0
- package/src/answers.ts +209 -0
- package/src/audit/leaf.ts +81 -0
- package/src/audit/merkle.ts +13 -0
- package/src/audit/note.ts +187 -0
- package/src/audit/pair.ts +86 -0
- package/src/audit/tiles.ts +197 -0
- package/src/audit/tree.ts +163 -0
- package/src/audit/verify.ts +393 -0
- package/src/audit/witness.ts +50 -0
- package/src/identity/index.ts +2 -0
- package/src/identity/profile-rules.ts +147 -0
- package/src/identity/run-proof.ts +159 -0
- package/src/identity/workloads.ts +11 -0
- package/src/mcp.ts +6 -2
- package/src/schemas.ts +11 -0
- package/src/vault.ts +955 -1
|
@@ -610,12 +610,44 @@ function delegableRoles(policy = DEFAULT_POLICY) {
|
|
|
610
610
|
}
|
|
611
611
|
/** The roles a personal token's scope may name, as they ship. */
|
|
612
612
|
const DELEGABLE_ROLES = delegableRoles();
|
|
613
|
+
/** What a handle reads and uses, and no more: it writes nothing. */
|
|
614
|
+
const HANDLE_HOLDS = {
|
|
615
|
+
name: "Handle",
|
|
616
|
+
description: "Read and use, as its person does.",
|
|
617
|
+
permissions: ["secret.read", "secret.use"],
|
|
618
|
+
protected: ["secret.read", "secret.use"]
|
|
619
|
+
};
|
|
620
|
+
/**
|
|
621
|
+
* The roles a handle's scope is issued under (the server's `issueHandle`; the vault holds a handle's columns to them, T149): each place
|
|
622
|
+
* keeps what its person holds there, in each column, of reading and using
|
|
623
|
+
* (`issuedGrant`, capped by `heldColumns`), whatever an Owner made of the
|
|
624
|
+
* roles. `viewer` names a place its person reads, `contributor` one they
|
|
625
|
+
* only use.
|
|
626
|
+
*
|
|
627
|
+
* an Owner, at a protected prod read, use / read, use
|
|
628
|
+
* a Developer, at the same read, use / use
|
|
629
|
+
*/
|
|
630
|
+
const HANDLE_POLICY = {
|
|
631
|
+
...DEFAULT_POLICY,
|
|
632
|
+
roles: {
|
|
633
|
+
...ROLES,
|
|
634
|
+
viewer: HANDLE_HOLDS,
|
|
635
|
+
contributor: HANDLE_HOLDS
|
|
636
|
+
}
|
|
637
|
+
};
|
|
613
638
|
/**
|
|
614
639
|
* The longest a personal token lasts: a week. It is for an afternoon's
|
|
615
640
|
* script or agent, and whoever needs it longer makes another, as a person,
|
|
616
641
|
* rather than keep one around.
|
|
617
642
|
*/
|
|
618
643
|
const MAX_PERSONAL_TOKEN_MINUTES = 10080;
|
|
644
|
+
/** The longest a service account's token lives, in days. The vault holds an issue to it (T149). */
|
|
645
|
+
const MAX_SERVICE_TOKEN_DAYS = 366;
|
|
646
|
+
/**
|
|
647
|
+
* How long a `coffre login` code waits to be approved. The server expires it
|
|
648
|
+
* then, and the CLI's sign-in hint says so before it has asked for one.
|
|
649
|
+
*/
|
|
650
|
+
const DEVICE_TTL_SECONDS = 600;
|
|
619
651
|
/**
|
|
620
652
|
* A credential's scope, by path as the API names it, in words, each role
|
|
621
653
|
* with its places: `developer on market/dev, api/dev; viewer on market/prod`.
|
|
@@ -793,6 +825,66 @@ function scopeWithReads(scope, reads, projectOf) {
|
|
|
793
825
|
return result;
|
|
794
826
|
}
|
|
795
827
|
/**
|
|
828
|
+
* A scope as a token's or binding's row stores it, under its MAC: its
|
|
829
|
+
* grants as JSON, by place, each with what its role held when it was
|
|
830
|
+
* issued (`issuedGrant`), so that a role widened later widens no credential,
|
|
831
|
+
* and, a service's, whether it reads the sensitive values there.
|
|
832
|
+
*/
|
|
833
|
+
function storedScope(scope, { reads = false } = {}) {
|
|
834
|
+
const key = (grant) => `${grant.projectId}/${grant.environmentId ?? ""}`;
|
|
835
|
+
return JSON.stringify([...scope].sort((a, b) => key(a) < key(b) ? -1 : key(a) > key(b) ? 1 : 0).map((grant) => {
|
|
836
|
+
const { permissions, protected: guarded } = scopeDefinition(grant);
|
|
837
|
+
return {
|
|
838
|
+
projectId: grant.projectId,
|
|
839
|
+
environmentId: grant.environmentId,
|
|
840
|
+
role: grant.role,
|
|
841
|
+
permissions: {
|
|
842
|
+
normal: [...permissions],
|
|
843
|
+
protected: [...guarded]
|
|
844
|
+
},
|
|
845
|
+
...grant.sensitive === void 0 ? {} : { sensitive: grant.sensitive },
|
|
846
|
+
...!reads || grant.reads === void 0 ? {} : { reads: grant.reads }
|
|
847
|
+
};
|
|
848
|
+
}));
|
|
849
|
+
}
|
|
850
|
+
/**
|
|
851
|
+
* The scope a row stores: null for one 0.4 made, not sealed yet, which
|
|
852
|
+
* reaches all its account holds, as then. One its MAC checked but that
|
|
853
|
+
* does not read as a scope reaches nothing.
|
|
854
|
+
*/
|
|
855
|
+
function readScope(stored) {
|
|
856
|
+
if (stored === null) return null;
|
|
857
|
+
let parsed = null;
|
|
858
|
+
try {
|
|
859
|
+
parsed = JSON.parse(stored);
|
|
860
|
+
} catch {}
|
|
861
|
+
return isCredentialScope(parsed) ? parsed : [];
|
|
862
|
+
}
|
|
863
|
+
/**
|
|
864
|
+
* What a session reaches, as its caller holds it: its row's scope, an
|
|
865
|
+
* enrollment code's, or else its binding's, never null, with its binding's
|
|
866
|
+
* `reads` on the grants of the environments they list (`scopeWithReads`).
|
|
867
|
+
* Binding creation gives each such environment a grant of its own, so the
|
|
868
|
+
* scope itself says each one's project, with nothing to look up. A grant
|
|
869
|
+
* without `reads` is use-only, there.
|
|
870
|
+
*/
|
|
871
|
+
function sessionScope(row, binding, policy) {
|
|
872
|
+
const scope = readScope(row.scope ?? binding.scope) ?? [];
|
|
873
|
+
const projectOf = /* @__PURE__ */ new Map();
|
|
874
|
+
for (const { projectId, environmentId } of scope) if (environmentId != null && projectId !== null) projectOf.set(environmentId, projectId);
|
|
875
|
+
return scopeWithReads(scope, policy.reads, projectOf);
|
|
876
|
+
}
|
|
877
|
+
/**
|
|
878
|
+
* A workload session's scope as its row stores it with 0.15's log: what its
|
|
879
|
+
* uses hold (`sessionScope`), its binding's per-key reads included, so that
|
|
880
|
+
* its object, all a 0.15 use decides on, is no wider than what 0.14 decides
|
|
881
|
+
* on from its binding. The vault makes it from the binding's columns too,
|
|
882
|
+
* for the session it signs in (T149).
|
|
883
|
+
*/
|
|
884
|
+
function sealedSessionScope(scope, binding, policy) {
|
|
885
|
+
return storedScope(sessionScope({ scope }, binding, policy), { reads: true });
|
|
886
|
+
}
|
|
887
|
+
/**
|
|
796
888
|
* Whether the actor may give or take grants at this place: with
|
|
797
889
|
* `grant.manage` there, from a project grant or an instance role whose
|
|
798
890
|
* scope takes it in. A grant on a project reaches all its environments, so
|
|
@@ -905,4 +997,4 @@ function makesProjects(holder) {
|
|
|
905
997
|
return holder.credentialScope == null && administers(holder.role) && environments === "all" && (projects === "all" || "except" in projects);
|
|
906
998
|
}
|
|
907
999
|
//#endregion
|
|
908
|
-
export {
|
|
1000
|
+
export { protects as $, delegableRoles as A, isInstanceRole as B, allows as C, definitionOf as D, credentialScopeInWords as E, holds as F, makesProjects as G, isScope as H, inScope as I, normalDefinition as J, managesService as K, instanceRoleGrants as L, grantKind as M, guarded as N, definitionProblem as O, heldColumns as P, protectedWithin as Q, isBuiltinRole as R, admits as S, covers as T, issuedGrant as U, isRole as V, issuesCredential as W, ownsInstance as X, normalScope as Y, ownsProject as Z, ROLES as _, EVERY_ENVIRONMENT as a, scopeDefinition as at, UNWRITTEN_FORK_MS as b, HANDLE_POLICY as c, sealedSessionScope as ct, MAX_PERSONAL_TOKEN_MINUTES as d, storedScope as dt, readScope as et, MAX_SCOPE_PLACES as f, unscoped as ft, PROJECT_ONLY_PERMISSIONS as g, PERMISSIONS as h, convertEveryProjectGrants as ht, EVERYWHERE as i, runsInstance as it, givesService as j, delegable as k, INSTANCE_ROLES as l, sessionScope as lt, NOTHING as m, withinCredential as mt, DELEGABLE_ROLES as n, readsWholeLog as nt, FIXED_ROLES as o, scopeInWords as ot, MAX_SERVICE_TOKEN_DAYS as p, useOnly as pt, mayManageAccess as q, DEVICE_TTL_SECONDS as r, roleGrants as rt, HANDLE_HOLDS as s, scopeWithReads as st, DEFAULT_POLICY as t, readsSensitive as tt, INSTANCE_ROLE_NAMES as u, setsUpServices as ut, ROLE_ID as v, assignableToEnvironment as w, administers as x, ROLE_NAMES as y, isCredentialScope as z };
|
|
@@ -497,12 +497,32 @@ declare function delegable(role: Role, policy?: Policy): boolean;
|
|
|
497
497
|
declare function delegableRoles(policy?: Policy): Role[];
|
|
498
498
|
/** The roles a personal token's scope may name, as they ship. */
|
|
499
499
|
declare const DELEGABLE_ROLES: readonly Role[];
|
|
500
|
+
/** What a handle reads and uses, and no more: it writes nothing. */
|
|
501
|
+
declare const HANDLE_HOLDS: RoleDefinition;
|
|
502
|
+
/**
|
|
503
|
+
* The roles a handle's scope is issued under (the server's `issueHandle`; the vault holds a handle's columns to them, T149): each place
|
|
504
|
+
* keeps what its person holds there, in each column, of reading and using
|
|
505
|
+
* (`issuedGrant`, capped by `heldColumns`), whatever an Owner made of the
|
|
506
|
+
* roles. `viewer` names a place its person reads, `contributor` one they
|
|
507
|
+
* only use.
|
|
508
|
+
*
|
|
509
|
+
* an Owner, at a protected prod read, use / read, use
|
|
510
|
+
* a Developer, at the same read, use / use
|
|
511
|
+
*/
|
|
512
|
+
declare const HANDLE_POLICY: Policy;
|
|
500
513
|
/**
|
|
501
514
|
* The longest a personal token lasts: a week. It is for an afternoon's
|
|
502
515
|
* script or agent, and whoever needs it longer makes another, as a person,
|
|
503
516
|
* rather than keep one around.
|
|
504
517
|
*/
|
|
505
518
|
declare const MAX_PERSONAL_TOKEN_MINUTES: number;
|
|
519
|
+
/** The longest a service account's token lives, in days. The vault holds an issue to it (T149). */
|
|
520
|
+
declare const MAX_SERVICE_TOKEN_DAYS = 366;
|
|
521
|
+
/**
|
|
522
|
+
* How long a `coffre login` code waits to be approved. The server expires it
|
|
523
|
+
* then, and the CLI's sign-in hint says so before it has asked for one.
|
|
524
|
+
*/
|
|
525
|
+
declare const DEVICE_TTL_SECONDS: number;
|
|
506
526
|
/**
|
|
507
527
|
* A credential's scope, by path as the API names it, in words, each role
|
|
508
528
|
* with its places: `developer on market/dev, api/dev; viewer on market/prod`.
|
|
@@ -636,6 +656,52 @@ declare function useOnly(holder: Holdings, key: HeldKey): boolean;
|
|
|
636
656
|
declare function scopeWithReads(scope: CredentialScope, reads: Readonly<Record<string, {
|
|
637
657
|
readonly keys?: readonly string[] | '*';
|
|
638
658
|
}>> | undefined, projectOf: ReadonlyMap<string, string>): CredentialScope;
|
|
659
|
+
/**
|
|
660
|
+
* A scope as a token's or binding's row stores it, under its MAC: its
|
|
661
|
+
* grants as JSON, by place, each with what its role held when it was
|
|
662
|
+
* issued (`issuedGrant`), so that a role widened later widens no credential,
|
|
663
|
+
* and, a service's, whether it reads the sensitive values there.
|
|
664
|
+
*/
|
|
665
|
+
declare function storedScope(scope: CredentialScope, { reads }?: {
|
|
666
|
+
reads?: boolean;
|
|
667
|
+
}): string;
|
|
668
|
+
/**
|
|
669
|
+
* The scope a row stores: null for one 0.4 made, not sealed yet, which
|
|
670
|
+
* reaches all its account holds, as then. One its MAC checked but that
|
|
671
|
+
* does not read as a scope reaches nothing.
|
|
672
|
+
*/
|
|
673
|
+
declare function readScope(stored: string | null): CredentialScope | null;
|
|
674
|
+
/** What a workload binding's policy lists of reads, by environment id (`BindingPolicy['reads']`). */
|
|
675
|
+
type ListedReads = Readonly<Record<string, {
|
|
676
|
+
readonly keys?: readonly string[] | '*';
|
|
677
|
+
}>>;
|
|
678
|
+
/**
|
|
679
|
+
* What a session reaches, as its caller holds it: its row's scope, an
|
|
680
|
+
* enrollment code's, or else its binding's, never null, with its binding's
|
|
681
|
+
* `reads` on the grants of the environments they list (`scopeWithReads`).
|
|
682
|
+
* Binding creation gives each such environment a grant of its own, so the
|
|
683
|
+
* scope itself says each one's project, with nothing to look up. A grant
|
|
684
|
+
* without `reads` is use-only, there.
|
|
685
|
+
*/
|
|
686
|
+
declare function sessionScope(row: {
|
|
687
|
+
scope: string | null;
|
|
688
|
+
}, binding: {
|
|
689
|
+
scope: string | null;
|
|
690
|
+
}, policy: {
|
|
691
|
+
reads?: ListedReads;
|
|
692
|
+
}): CredentialScope;
|
|
693
|
+
/**
|
|
694
|
+
* A workload session's scope as its row stores it with 0.15's log: what its
|
|
695
|
+
* uses hold (`sessionScope`), its binding's per-key reads included, so that
|
|
696
|
+
* its object, all a 0.15 use decides on, is no wider than what 0.14 decides
|
|
697
|
+
* on from its binding. The vault makes it from the binding's columns too,
|
|
698
|
+
* for the session it signs in (T149).
|
|
699
|
+
*/
|
|
700
|
+
declare function sealedSessionScope(scope: string | null, binding: {
|
|
701
|
+
scope: string | null;
|
|
702
|
+
}, policy: {
|
|
703
|
+
reads?: ListedReads;
|
|
704
|
+
}): string;
|
|
639
705
|
/**
|
|
640
706
|
* Whether the actor may give or take grants at this place: with
|
|
641
707
|
* `grant.manage` there, from a project grant or an instance role whose
|
|
@@ -731,4 +797,4 @@ declare function readsWholeLog(holder: Holdings): boolean;
|
|
|
731
797
|
*/
|
|
732
798
|
declare function makesProjects(holder: Holdings): boolean;
|
|
733
799
|
//#endregion
|
|
734
|
-
export {
|
|
800
|
+
export { holds as $, ROLE_ID as A, unscoped as At, admits as B, NOTHING as C, scopeDefinition as Ct, Place as D, sessionScope as Dt, Permission as E, sealedSessionScope as Et, ScopeGrant as F, ConvertedGrant as Ft, definitionOf as G, assignableToEnvironment as H, ServiceAccount as I, EveryProjectGrant as It, delegableRoles as J, definitionProblem as K, ServiceSetting as L, Narrowed as Lt, Role as M, withinCredential as Mt, RoleDefinition as N, Conversion as Nt, Policy as O, setsUpServices as Ot, Scope as P, ConversionInput as Pt, heldColumns as Q, UNWRITTEN_FORK_MS as R, convertEveryProjectGrants as Rt, MAX_SERVICE_TOKEN_DAYS as S, runsInstance as St, PROJECT_ONLY_PERMISSIONS as T, scopeWithReads as Tt, covers as U, allows as V, credentialScopeInWords as W, grantKind as X, givesService as Y, guarded as Z, INSTANCE_ROLES as _, protects as _t, DEFAULT_POLICY as a, isRole as at, MAX_PERSONAL_TOKEN_MINUTES as b, readsWholeLog as bt, EVERYWHERE as c, issuesCredential as ct, Filter as d, mayManageAccess as dt, inScope as et, GrantPlace as f, normalDefinition as ft, Holdings as g, protectedWithin as gt, HeldKey as h, ownsProject as ht, CredentialScope as i, isInstanceRole as it, ROLE_NAMES as j, useOnly as jt, ROLES as k, storedScope as kt, EVERY_ENVIRONMENT as l, makesProjects as lt, HANDLE_POLICY as m, ownsInstance as mt, CallerKind as n, isBuiltinRole as nt, DELEGABLE_ROLES as o, isScope as ot, HANDLE_HOLDS as p, normalScope as pt, delegable as q, Columns as r, isCredentialScope as rt, DEVICE_TTL_SECONDS as s, issuedGrant as st, BuiltinRole as t, instanceRoleGrants as tt, FIXED_ROLES as u, managesService as ut, INSTANCE_ROLE_NAMES as v, readScope as vt, PERMISSIONS as w, scopeInWords as wt, MAX_SCOPE_PLACES as x, roleGrants as xt, InstanceRole as y, readsSensitive as yt, administers as z };
|
package/dist/access.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { BuiltinRole, CallerKind, Columns, type Conversion, type ConversionInput, type ConvertedGrant, CredentialScope, DEFAULT_POLICY, DELEGABLE_ROLES, EVERYWHERE, EVERY_ENVIRONMENT, type EveryProjectGrant, FIXED_ROLES, Filter, GrantPlace, HeldKey, Holdings, INSTANCE_ROLES, INSTANCE_ROLE_NAMES, InstanceRole, MAX_PERSONAL_TOKEN_MINUTES, MAX_SCOPE_PLACES, NOTHING, type Narrowed, PERMISSIONS, PROJECT_ONLY_PERMISSIONS, Permission, Place, Policy, ROLES, ROLE_ID, ROLE_NAMES, Role, RoleDefinition, Scope, ScopeGrant, ServiceAccount, ServiceSetting, UNWRITTEN_FORK_MS, administers, admits, allows, assignableToEnvironment, convertEveryProjectGrants, covers, credentialScopeInWords, definitionOf, definitionProblem, delegable, delegableRoles, givesService, grantKind, guarded, heldColumns, holds, inScope, instanceRoleGrants, isBuiltinRole, isCredentialScope, isInstanceRole, isRole, isScope, issuedGrant, issuesCredential, makesProjects, managesService, mayManageAccess, normalDefinition, normalScope, ownsInstance, ownsProject, protectedWithin, protects, readsSensitive, readsWholeLog, roleGrants, runsInstance, scopeDefinition, scopeInWords, scopeWithReads, setsUpServices, unscoped, useOnly, withinCredential };
|
|
1
|
+
import { $ as holds, A as ROLE_ID, At as unscoped, B as admits, C as NOTHING, Ct as scopeDefinition, D as Place, Dt as sessionScope, E as Permission, Et as sealedSessionScope, F as ScopeGrant, Ft as ConvertedGrant, G as definitionOf, H as assignableToEnvironment, I as ServiceAccount, It as EveryProjectGrant, J as delegableRoles, K as definitionProblem, L as ServiceSetting, Lt as Narrowed, M as Role, Mt as withinCredential, N as RoleDefinition, Nt as Conversion, O as Policy, Ot as setsUpServices, P as Scope, Pt as ConversionInput, Q as heldColumns, R as UNWRITTEN_FORK_MS, Rt as convertEveryProjectGrants, S as MAX_SERVICE_TOKEN_DAYS, St as runsInstance, T as PROJECT_ONLY_PERMISSIONS, Tt as scopeWithReads, U as covers, V as allows, W as credentialScopeInWords, X as grantKind, Y as givesService, Z as guarded, _ as INSTANCE_ROLES, _t as protects, a as DEFAULT_POLICY, at as isRole, b as MAX_PERSONAL_TOKEN_MINUTES, bt as readsWholeLog, c as EVERYWHERE, ct as issuesCredential, d as Filter, dt as mayManageAccess, et as inScope, f as GrantPlace, ft as normalDefinition, g as Holdings, gt as protectedWithin, h as HeldKey, ht as ownsProject, i as CredentialScope, it as isInstanceRole, j as ROLE_NAMES, jt as useOnly, k as ROLES, kt as storedScope, l as EVERY_ENVIRONMENT, lt as makesProjects, m as HANDLE_POLICY, mt as ownsInstance, n as CallerKind, nt as isBuiltinRole, o as DELEGABLE_ROLES, ot as isScope, p as HANDLE_HOLDS, pt as normalScope, q as delegable, r as Columns, rt as isCredentialScope, s as DEVICE_TTL_SECONDS, st as issuedGrant, t as BuiltinRole, tt as instanceRoleGrants, u as FIXED_ROLES, ut as managesService, v as INSTANCE_ROLE_NAMES, vt as readScope, w as PERMISSIONS, wt as scopeInWords, x as MAX_SCOPE_PLACES, xt as roleGrants, y as InstanceRole, yt as readsSensitive, z as administers } from "./access-DqLJjnLM.js";
|
|
2
|
+
export { BuiltinRole, CallerKind, Columns, type Conversion, type ConversionInput, type ConvertedGrant, CredentialScope, DEFAULT_POLICY, DELEGABLE_ROLES, DEVICE_TTL_SECONDS, EVERYWHERE, EVERY_ENVIRONMENT, type EveryProjectGrant, FIXED_ROLES, Filter, GrantPlace, HANDLE_HOLDS, HANDLE_POLICY, HeldKey, Holdings, INSTANCE_ROLES, INSTANCE_ROLE_NAMES, InstanceRole, MAX_PERSONAL_TOKEN_MINUTES, MAX_SCOPE_PLACES, MAX_SERVICE_TOKEN_DAYS, NOTHING, type Narrowed, PERMISSIONS, PROJECT_ONLY_PERMISSIONS, Permission, Place, Policy, ROLES, ROLE_ID, ROLE_NAMES, Role, RoleDefinition, Scope, ScopeGrant, ServiceAccount, ServiceSetting, UNWRITTEN_FORK_MS, administers, admits, allows, assignableToEnvironment, convertEveryProjectGrants, covers, credentialScopeInWords, definitionOf, definitionProblem, delegable, delegableRoles, givesService, grantKind, guarded, heldColumns, holds, inScope, instanceRoleGrants, isBuiltinRole, isCredentialScope, isInstanceRole, isRole, isScope, issuedGrant, issuesCredential, makesProjects, managesService, mayManageAccess, normalDefinition, normalScope, ownsInstance, ownsProject, protectedWithin, protects, readScope, readsSensitive, readsWholeLog, roleGrants, runsInstance, scopeDefinition, scopeInWords, scopeWithReads, sealedSessionScope, sessionScope, setsUpServices, storedScope, unscoped, useOnly, withinCredential };
|
package/dist/access.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as
|
|
2
|
-
export { DEFAULT_POLICY, DELEGABLE_ROLES, EVERYWHERE, EVERY_ENVIRONMENT, FIXED_ROLES, INSTANCE_ROLES, INSTANCE_ROLE_NAMES, MAX_PERSONAL_TOKEN_MINUTES, MAX_SCOPE_PLACES, NOTHING, PERMISSIONS, PROJECT_ONLY_PERMISSIONS, ROLES, ROLE_ID, ROLE_NAMES, UNWRITTEN_FORK_MS, administers, admits, allows, assignableToEnvironment, convertEveryProjectGrants, covers, credentialScopeInWords, definitionOf, definitionProblem, delegable, delegableRoles, givesService, grantKind, guarded, heldColumns, holds, inScope, instanceRoleGrants, isBuiltinRole, isCredentialScope, isInstanceRole, isRole, isScope, issuedGrant, issuesCredential, makesProjects, managesService, mayManageAccess, normalDefinition, normalScope, ownsInstance, ownsProject, protectedWithin, protects, readsSensitive, readsWholeLog, roleGrants, runsInstance, scopeDefinition, scopeInWords, scopeWithReads, setsUpServices, unscoped, useOnly, withinCredential };
|
|
1
|
+
import { $ as protects, A as delegableRoles, B as isInstanceRole, C as allows, D as definitionOf, E as credentialScopeInWords, F as holds, G as makesProjects, H as isScope, I as inScope, J as normalDefinition, K as managesService, L as instanceRoleGrants, M as grantKind, N as guarded, O as definitionProblem, P as heldColumns, Q as protectedWithin, R as isBuiltinRole, S as admits, T as covers, U as issuedGrant, V as isRole, W as issuesCredential, X as ownsInstance, Y as normalScope, Z as ownsProject, _ as ROLES, a as EVERY_ENVIRONMENT, at as scopeDefinition, b as UNWRITTEN_FORK_MS, c as HANDLE_POLICY, ct as sealedSessionScope, d as MAX_PERSONAL_TOKEN_MINUTES, dt as storedScope, et as readScope, f as MAX_SCOPE_PLACES, ft as unscoped, g as PROJECT_ONLY_PERMISSIONS, h as PERMISSIONS, ht as convertEveryProjectGrants, i as EVERYWHERE, it as runsInstance, j as givesService, k as delegable, l as INSTANCE_ROLES, lt as sessionScope, m as NOTHING, mt as withinCredential, n as DELEGABLE_ROLES, nt as readsWholeLog, o as FIXED_ROLES, ot as scopeInWords, p as MAX_SERVICE_TOKEN_DAYS, pt as useOnly, q as mayManageAccess, r as DEVICE_TTL_SECONDS, rt as roleGrants, s as HANDLE_HOLDS, st as scopeWithReads, t as DEFAULT_POLICY, tt as readsSensitive, u as INSTANCE_ROLE_NAMES, ut as setsUpServices, v as ROLE_ID, w as assignableToEnvironment, x as administers, y as ROLE_NAMES, z as isCredentialScope } from "./access-CgQTlUMz.js";
|
|
2
|
+
export { DEFAULT_POLICY, DELEGABLE_ROLES, DEVICE_TTL_SECONDS, EVERYWHERE, EVERY_ENVIRONMENT, FIXED_ROLES, HANDLE_HOLDS, HANDLE_POLICY, INSTANCE_ROLES, INSTANCE_ROLE_NAMES, MAX_PERSONAL_TOKEN_MINUTES, MAX_SCOPE_PLACES, MAX_SERVICE_TOKEN_DAYS, NOTHING, PERMISSIONS, PROJECT_ONLY_PERMISSIONS, ROLES, ROLE_ID, ROLE_NAMES, UNWRITTEN_FORK_MS, administers, admits, allows, assignableToEnvironment, convertEveryProjectGrants, covers, credentialScopeInWords, definitionOf, definitionProblem, delegable, delegableRoles, givesService, grantKind, guarded, heldColumns, holds, inScope, instanceRoleGrants, isBuiltinRole, isCredentialScope, isInstanceRole, isRole, isScope, issuedGrant, issuesCredential, makesProjects, managesService, mayManageAccess, normalDefinition, normalScope, ownsInstance, ownsProject, protectedWithin, protects, readScope, readsSensitive, readsWholeLog, roleGrants, runsInstance, scopeDefinition, scopeInWords, scopeWithReads, sealedSessionScope, sessionScope, setsUpServices, storedScope, unscoped, useOnly, withinCredential };
|
package/dist/identity.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as githubReusable, A as PROFILE_URNS, B as WorkloadProfile, C as MAX_ISSUER_BYTES, D as OIDC_PROFILES, E as MAX_SOURCES, F as Starts, G as checkPolicy, H as canonicalClaims, I as WORKLOAD_PROFILES, J as defaultIssuer, K as claimAt, L as WORKLOAD_SIGN_IN_PATH, M as REPEATING_PROFILES, N as REQUIRED_CLAIMS, O as POLICY_DEFAULTS, P as SESSION_MS, Q as githubEventsAt, R as WorkloadAlert, S as MAX_CLAIM_BYTES, T as MAX_READ_PLACES, U as checkBinding, V as addressWithin, W as checkFetchUrl, X as freezeTarget, Y as differingClaims, Z as fullRef, _ as GITLAB_PIPELINE_SOURCES, a as BindingPolicy, at as policyText, b as MAX_BINDINGS, c as CheckedBinding, ct as ConstraintsInvalid, d as EVENT_EXPOSURE, dt as constraintsAllow, et as githubWorkflow, f as EXCHANGED_CREDENTIAL_MS, ft as constraintsText, g as GITLAB_ISSUER, h as GITHUB_ISSUER, i as BindingInvalid, it as parseCidr, j as Preset, k as POLICY_FIELDS, l as Cidr, lt as MAX_CONSTRAINTS, m as GITHUB_EVENTS, n as BearerProfile, nt as isBearerProfile, o as BindingReads, ot as workflowRef, p as EXCHANGE_SKEW_SECONDS, pt as intersect, q as claimValues, r as BindingClaims, rt as parseAddress, s as CREDENTIAL_NAME, st as Constraints, t as BEARER_PROFILES, tt as gitlabProject, u as ClaimValue, ut as checkConstraints, v as GOOGLE_ISSUER, w as MAX_READ_KEYS, x as MAX_CLAIMS, y as KEY_NAMING_PROFILES, z as WorkloadCaller } from "./workloads-D049JH0M.js";
|
|
2
2
|
import { MAX_PROOF_LENGTH, MAX_SIGNED_HEADERS, ProofClaims, ProofClaims as ProofClaims$1, PublicJwk, PublicJwk as PublicJwk$1, canonicalHtu, canonicalRequest, fetchMethod, sentTarget, thumbprint } from "@coffre/client/dpop";
|
|
3
3
|
import { JSONWebKeySet, JWTPayload } from "jose";
|
|
4
4
|
//#region src/identity/github-app.d.ts
|
|
@@ -710,6 +710,106 @@ export interface Gate {
|
|
|
710
710
|
}): Promise<GateAdmission>;
|
|
711
711
|
}
|
|
712
712
|
//#endregion
|
|
713
|
+
//#region src/identity/profile-rules.d.ts
|
|
714
|
+
/**
|
|
715
|
+
* What each platform's binding and tokens must say beyond the claims a
|
|
716
|
+
* binding names (docs/design/workload-access.md, section 4.2). Core holds
|
|
717
|
+
* the rules every profile shares: the required claims, the issuers that
|
|
718
|
+
* force a profile, the policy's fields. These are each platform's own:
|
|
719
|
+
* the shape of the IDs it issues, which issuer goes with which, and what a
|
|
720
|
+
* token of it says that its binding cannot.
|
|
721
|
+
*
|
|
722
|
+
* A binding names IDs the platform never reuses, so each is checked for
|
|
723
|
+
* the shape the platform gives it: a name in its place is refused, since a
|
|
724
|
+
* name can be taken again after its owner is gone.
|
|
725
|
+
*/
|
|
726
|
+
export type ProfileRules = {
|
|
727
|
+
/** At binding time, after `checkBinding` and `checkPolicy`. Throws `BindingInvalid`. */
|
|
728
|
+
binding(binding: CheckedBinding, policy: BindingPolicy): void;
|
|
729
|
+
/** At the exchange, once the token verified and matched its binding's claims: why it is still refused, or null. */
|
|
730
|
+
token(claims: Record<string, unknown>, binding: {
|
|
731
|
+
issuer: string;
|
|
732
|
+
claims: BindingClaims;
|
|
733
|
+
policy: BindingPolicy;
|
|
734
|
+
}): string | null;
|
|
735
|
+
};
|
|
736
|
+
export declare const PROFILE_RULES: { readonly [P in WorkloadProfile]?: ProfileRules; };
|
|
737
|
+
/**
|
|
738
|
+
* The audiences a token of a binding may name, the first the one its SDK
|
|
739
|
+
* asks for: the session's key, `<publicUrl>#jkt=<thumbprint>`, for the
|
|
740
|
+
* platforms whose caller picks the audience, and `?jkt=` for one that
|
|
741
|
+
* refuses a `#` in it (section 4.2); the exact audience of a platform that
|
|
742
|
+
* fixes it; this instance's URL for every other.
|
|
743
|
+
*/
|
|
744
|
+
export declare function expectedAudiences(profile: WorkloadProfile, policy: BindingPolicy, expected: {
|
|
745
|
+
publicUrl: string;
|
|
746
|
+
jkt: string;
|
|
747
|
+
}): string[];
|
|
748
|
+
//#endregion
|
|
749
|
+
//#region src/identity/run-proof.d.ts
|
|
750
|
+
/**
|
|
751
|
+
* The claims of the run a credential was issued for, as the issuer
|
|
752
|
+
* asserted them: in the sign-in's record, so that a read leads back to its
|
|
753
|
+
* run. What the issuer says, not proof of which run sent the request.
|
|
754
|
+
*/
|
|
755
|
+
export declare const RUN_CLAIMS: readonly ["sub", "jti", "actor", "event_name", "ref", "base_ref", "head_ref", "sha", "repository", "repository_id", "run_id", "run_attempt", "workflow_ref", "job_workflow_ref", "job_workflow_sha", "environment", "project_path", "project_id", "namespace_id", "pipeline_id", "pipeline_source", "job_id", "kubernetes.io.pod.name"];
|
|
756
|
+
/** A binding's `jwks_uri` when it carries its issuer's keys: the SHA-256 of those keys (`UploadedKeys`), where a fetched set's URL would be. */
|
|
757
|
+
export declare const UPLOADED_KEYS = "sha256:";
|
|
758
|
+
/** The run's claims, as the issuer stated them: those that say which run, each bounded. */
|
|
759
|
+
export declare function runClaims(claims: Record<string, unknown>): Record<string, string | number>;
|
|
760
|
+
/** A token's one audience, or null for none or several: a token for several parties is no single party's. */
|
|
761
|
+
export declare function soleAudience(aud: unknown): string | null;
|
|
762
|
+
/**
|
|
763
|
+
* A binding as the vault weighs a sign-in through it (T149, PR 3b): its
|
|
764
|
+
* sealed object's columns, the instance it was made on (`origin`), and the
|
|
765
|
+
* keys uploaded with it as its row keeps them, which must be the ones its
|
|
766
|
+
* `jwksUri` digests. Only such a binding's: the vault fetches nothing, so
|
|
767
|
+
* the tokens of an issuer that publishes its keys are the app's to verify.
|
|
768
|
+
*/
|
|
769
|
+
export type RunBinding = {
|
|
770
|
+
profile: WorkloadProfile;
|
|
771
|
+
issuer: string;
|
|
772
|
+
origin: string;
|
|
773
|
+
jwksUri: string;
|
|
774
|
+
jwks: string;
|
|
775
|
+
claims: string;
|
|
776
|
+
policy: string | null;
|
|
777
|
+
};
|
|
778
|
+
/** Why a run's proof buys nothing, as the app's refusals say it (`ExchangeReason`), with the key a refused token named. */
|
|
779
|
+
export declare class RunProofRefused extends Error {
|
|
780
|
+
readonly reason: string;
|
|
781
|
+
readonly kid: string | null;
|
|
782
|
+
constructor(reason: string, message: string, kid?: string | null);
|
|
783
|
+
}
|
|
784
|
+
/** What a run's proof says, verified: what the credential it buys is held to. */
|
|
785
|
+
export type RunProof = {
|
|
786
|
+
claims: Record<string, unknown>;
|
|
787
|
+
/** The run's claims, for the sign-in's record. */
|
|
788
|
+
run: Record<string, string | number>;
|
|
789
|
+
/** The token's signing input's hash, spent once; null for a token its platform hands out again, or one that names the session's key. */
|
|
790
|
+
spent: Buffer | null;
|
|
791
|
+
/** The last instant the token holds by its own times, ms: a CI run's (its `exp`, its `iat`'s hour); null for a workload's session. */
|
|
792
|
+
validUntil: number | null;
|
|
793
|
+
/** A workload's session's hard end by the token, ms (its `exp`); null when the token names the session's key, or for a CI run. */
|
|
794
|
+
notAfter: number | null;
|
|
795
|
+
};
|
|
796
|
+
/**
|
|
797
|
+
* Verify a CI run's or a workload's ID token against one binding, sealed
|
|
798
|
+
* (D148), whose keys were uploaded with it: the vault's own check, which
|
|
799
|
+
* no app can steer, and which asks no one. The binding's keys, held to the
|
|
800
|
+
* digest its seal covers (a key they lack is refused, never looked for),
|
|
801
|
+
* its issuer, its audience (the instance it was made on, or, for a
|
|
802
|
+
* platform whose caller names the session's key, that key: `jkt`, from the
|
|
803
|
+
* DPoP proof the vault verified, never from the app), the token's times,
|
|
804
|
+
* the binding's claims and its profile's rules. Throws `RunProofRefused`.
|
|
805
|
+
*/
|
|
806
|
+
export declare function verifyRunToken(token: string, binding: RunBinding, context: {
|
|
807
|
+
now: Date;
|
|
808
|
+
workload: {
|
|
809
|
+
jkt: string;
|
|
810
|
+
} | null;
|
|
811
|
+
}): Promise<RunProof>;
|
|
812
|
+
//#endregion
|
|
713
813
|
//#region src/identity/signin/sealed.d.ts
|
|
714
814
|
/**
|
|
715
815
|
* Derive a purpose-bound key from one of coffre's existing 32-byte secrets.
|
|
@@ -915,4 +1015,4 @@ export declare function uploadedKeys(value: unknown): Promise<UploadedKeys>;
|
|
|
915
1015
|
/** The keys of a set `uploadedKeys` kept, as an owner sees them. */
|
|
916
1016
|
export declare function keySummaries(jwks: string): KeySummary[];
|
|
917
1017
|
//#endregion
|
|
918
|
-
export { BEARER_PROFILES, BearerProfile, BindingClaims, BindingInvalid, BindingPolicy, BindingReads, CREDENTIAL_NAME, CheckedBinding, Cidr, ClaimValue, Constraints, ConstraintsInvalid, EVENT_EXPOSURE, GITHUB_EVENTS, GITHUB_ISSUER, GITLAB_ISSUER, GITLAB_PIPELINE_SOURCES, GOOGLE_ISSUER, type JSONWebKeySet, KEY_NAMING_PROFILES, MAX_BINDINGS, MAX_CLAIMS, MAX_CLAIM_BYTES, MAX_CONSTRAINTS, MAX_ISSUER_BYTES, MAX_PROOF_LENGTH, MAX_READ_KEYS, MAX_READ_PLACES, MAX_SIGNED_HEADERS, MAX_SOURCES, OIDC_PROFILES, POLICY_DEFAULTS, POLICY_FIELDS, PROFILE_URNS, Preset, type ProofClaims, type PublicJwk, REPEATING_PROFILES, REQUIRED_CLAIMS, Starts, WORKLOAD_PROFILES, WorkloadAlert, WorkloadCaller, WorkloadProfile, addressWithin, canonicalClaims, canonicalHtu, canonicalRequest, checkBinding, checkConstraints, checkFetchUrl, checkPolicy, claimAt, claimValues, constraintsAllow, constraintsText, defaultIssuer, differingClaims, fetchMethod, freezeTarget, fullRef, githubEventsAt, githubReusable, githubWorkflow, gitlabProject, intersect, isBearerProfile, parseAddress, parseCidr, policyText, sentTarget, thumbprint, workflowRef };
|
|
1018
|
+
export { BEARER_PROFILES, BearerProfile, BindingClaims, BindingInvalid, BindingPolicy, BindingReads, CREDENTIAL_NAME, CheckedBinding, Cidr, ClaimValue, Constraints, ConstraintsInvalid, EVENT_EXPOSURE, EXCHANGED_CREDENTIAL_MS, EXCHANGE_SKEW_SECONDS, GITHUB_EVENTS, GITHUB_ISSUER, GITLAB_ISSUER, GITLAB_PIPELINE_SOURCES, GOOGLE_ISSUER, type JSONWebKeySet, KEY_NAMING_PROFILES, MAX_BINDINGS, MAX_CLAIMS, MAX_CLAIM_BYTES, MAX_CONSTRAINTS, MAX_ISSUER_BYTES, MAX_PROOF_LENGTH, MAX_READ_KEYS, MAX_READ_PLACES, MAX_SIGNED_HEADERS, MAX_SOURCES, OIDC_PROFILES, POLICY_DEFAULTS, POLICY_FIELDS, PROFILE_URNS, Preset, type ProofClaims, type PublicJwk, REPEATING_PROFILES, REQUIRED_CLAIMS, SESSION_MS, Starts, WORKLOAD_PROFILES, WORKLOAD_SIGN_IN_PATH, WorkloadAlert, WorkloadCaller, WorkloadProfile, addressWithin, canonicalClaims, canonicalHtu, canonicalRequest, checkBinding, checkConstraints, checkFetchUrl, checkPolicy, claimAt, claimValues, constraintsAllow, constraintsText, defaultIssuer, differingClaims, fetchMethod, freezeTarget, fullRef, githubEventsAt, githubReusable, githubWorkflow, gitlabProject, intersect, isBearerProfile, parseAddress, parseCidr, policyText, sentTarget, thumbprint, workflowRef };
|