@fabrika/auth-core 0.9.0-dev.2 → 0.9.0-dev.21
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/package.json +2 -2
- package/src/canonical-path.ts +18 -0
- package/src/client-address.ts +74 -0
- package/src/contract-canonical.ts +152 -1
- package/src/contract-encoding.ts +181 -0
- package/src/contract.ts +201 -9
- package/src/dev-environment.ts +6 -0
- package/src/egress.ts +97 -0
- package/src/endpoint-digest.ts +22 -2
- package/src/framework-release.ts +2 -0
- package/src/framework-variables.ts +15 -0
- package/src/iam-mail.ts +354 -0
- package/src/index.ts +9 -0
- package/src/locale.ts +13 -1
- package/src/managed-environment.ts +140 -0
- package/src/membership.ts +12 -4
- package/src/ops.ts +1933 -0
- package/src/public-egress.ts +168 -0
- package/src/requirement.ts +5 -2
- package/src/rpc.ts +8 -8
- package/src/sha256.ts +52 -14
- package/src/terminal.ts +105 -0
- package/src/token.ts +73 -13
- package/src/types.ts +63 -2
- package/src/wire.ts +7 -0
- package/types/src/canonical-path.d.ts +6 -0
- package/types/src/client-address.d.ts +7 -0
- package/types/src/contract-canonical.d.ts +11 -1
- package/types/src/contract-encoding.d.ts +18 -0
- package/types/src/contract.d.ts +186 -8
- package/types/src/dev-environment.d.ts +5 -0
- package/types/src/egress.d.ts +27 -0
- package/types/src/endpoint-digest.d.ts +5 -0
- package/types/src/framework-release.d.ts +2 -0
- package/types/src/framework-variables.d.ts +12 -1
- package/types/src/iam-mail.d.ts +92 -0
- package/types/src/index.d.ts +9 -0
- package/types/src/locale.d.ts +11 -1
- package/types/src/managed-environment.d.ts +32 -0
- package/types/src/membership.d.ts +8 -3
- package/types/src/ops.d.ts +657 -0
- package/types/src/public-egress.d.ts +31 -0
- package/types/src/requirement.d.ts +2 -2
- package/types/src/rpc.d.ts +5 -5
- package/types/src/sha256.d.ts +10 -0
- package/types/src/terminal.d.ts +72 -0
- package/types/src/token.d.ts +36 -11
- package/types/src/types.d.ts +42 -2
- package/types/src/wire.d.ts +6 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** The declared form of public egress: every public host, over HTTPS or HTTP, on its default port. */
|
|
2
|
+
export declare const PUBLIC_EGRESS = "public";
|
|
3
|
+
export type PublicEgress = typeof PUBLIC_EGRESS;
|
|
4
|
+
/** What a site declares in `egress`: its exact HTTPS origins, sorted, or every public host (a cron job only). */
|
|
5
|
+
export type DeclaredEgress = readonly string[] | PublicEgress;
|
|
6
|
+
/**
|
|
7
|
+
* The name suffixes public egress refuses, each with every name under it: local and special-use names (RFC 6761,
|
|
8
|
+
* RFC 6762, RFC 8375, RFC 9476), the names private networks conventionally use (`.internal` holds Google's metadata
|
|
9
|
+
* host and Control's own `operations.internal`), and the platform subdomains an installation is served on beside its
|
|
10
|
+
* own domains: Cloudflare's `workers.dev`, where its Workers have their default routes, and Zerops' `zerops.app`, where
|
|
11
|
+
* its proxies, Control and IAM have their subdomains (a namespace proxy's `proxy-…-8080.<region>.zerops.app`), with the
|
|
12
|
+
* `zerops` suffix of a Zerops project's private network. Control knows no list of those subdomains, so every one is
|
|
13
|
+
* refused, another installation's too.
|
|
14
|
+
*/
|
|
15
|
+
export declare const PUBLIC_EGRESS_REFUSED_SUFFIXES: readonly ["localhost", "local", "internal", "intranet", "lan", "home", "corp", "private", "arpa", "test", "invalid", "example", "onion", "alt", "zerops", "zerops.app", "workers.dev"];
|
|
16
|
+
/** A host name without its trailing dots, lowercased: the form every comparison here uses. */
|
|
17
|
+
export declare function normalizedHost(hostname: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Why public egress refuses `url`, or `null` when the URL alone admits it: a scheme other than `https:` and `http:`, a
|
|
20
|
+
* port other than the scheme's default, credentials in the URL, an IP literal, a name of one label, a name under a
|
|
21
|
+
* refused suffix, or one of `refusedHosts` (normalized names). A host it admits may still resolve to a private address,
|
|
22
|
+
* which only a runtime that resolves names refuses.
|
|
23
|
+
*/
|
|
24
|
+
export declare function publicEgressRefusal(url: URL, refusedHosts?: ReadonlySet<string>): string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Whether `address` (an IPv4 or IPv6 address, as a resolver answers it) is a public unicast address: not private,
|
|
27
|
+
* loopback, link-local (which holds the cloud metadata address 169.254.169.254), shared, multicast, reserved,
|
|
28
|
+
* documentation, or an IPv6 form that embeds or tunnels an IPv4 address it cannot vouch for. A text that is no address
|
|
29
|
+
* is not public.
|
|
30
|
+
*/
|
|
31
|
+
export declare function isPublicAddress(address: string): boolean;
|
|
@@ -6,8 +6,8 @@ import type { PermissionEntry } from './types';
|
|
|
6
6
|
* Whether a token's permissions meet an endpoint's requirement. This is authorization, not a gate: it reads only the
|
|
7
7
|
* token. `member` is any permission of this application; an action is that action in some scope, global included.
|
|
8
8
|
* The access form narrows it to one scope afterwards, against the application's own data. The `app` form is the
|
|
9
|
-
* action held as a global grant, so an entry scoped to any value does not meet it
|
|
10
|
-
* one of their actions. `authenticated`, which only an installation row carries, needs no permission.
|
|
9
|
+
* action held as a global grant, so an entry scoped to any value does not meet it; `anyOf` is one of its actions held so.
|
|
10
|
+
* Several capabilities need every one of their actions. `authenticated`, which only an installation row carries, needs no permission.
|
|
11
11
|
*/
|
|
12
12
|
export declare function satisfies(requirement: EndpointRequirement | AuthenticatedRequirement, perms: readonly PermissionEntry[]): boolean;
|
|
13
13
|
/**
|
package/types/src/rpc.d.ts
CHANGED
|
@@ -110,8 +110,8 @@ export interface IssueKeyServiceSpec {
|
|
|
110
110
|
export interface IssueKeyInput {
|
|
111
111
|
app: string;
|
|
112
112
|
/**
|
|
113
|
-
* The
|
|
114
|
-
* a `px_token` access JWT (verified against
|
|
113
|
+
* The IAM-native credential the ISSUER is resolved from server-side (never self-asserted):
|
|
114
|
+
* a `px_token` access JWT (verified against IAM's signing keys) or a `px_` key. Null = absent.
|
|
115
115
|
*/
|
|
116
116
|
credential: string | null;
|
|
117
117
|
requestId: string;
|
|
@@ -185,7 +185,7 @@ export interface AuditInput {
|
|
|
185
185
|
}
|
|
186
186
|
export interface RevokeKeyInput {
|
|
187
187
|
app: string;
|
|
188
|
-
/** The
|
|
188
|
+
/** The IAM-native credential the CALLER (authorizer) is resolved from; null = absent. */
|
|
189
189
|
credential: string | null;
|
|
190
190
|
requestId: string;
|
|
191
191
|
/** The credential id (the `id` returned by `issueKey`), NOT the plaintext `px_` token. */
|
|
@@ -203,7 +203,7 @@ export type RevokeKeyResult =
|
|
|
203
203
|
export interface ListPrincipalsInput {
|
|
204
204
|
/** Self-asserted caller app id; superseded by the credential's aud on a valid `px_token`. */
|
|
205
205
|
app: string;
|
|
206
|
-
/** The
|
|
206
|
+
/** The IAM-native credential the CALLER is resolved from (px_token / px_ key); null = absent. */
|
|
207
207
|
credential: string | null;
|
|
208
208
|
requestId: string;
|
|
209
209
|
}
|
|
@@ -239,7 +239,7 @@ export interface IamRpc {
|
|
|
239
239
|
listOwnDeviceAuthorizations(input: ListOwnDeviceAuthorizationsInput): Promise<ListOwnDeviceAuthorizationsResult>;
|
|
240
240
|
/**
|
|
241
241
|
* Mint a short-lived, per-app permission token from the browser's SSO session — the
|
|
242
|
-
*
|
|
242
|
+
* IAM-native auth path. The SDK middleware calls this only when its cached permission
|
|
243
243
|
* token is missing/near-expiry (≈ once per TTL), NOT per request: every other request verifies
|
|
244
244
|
* the cached token locally against `getJwks`.
|
|
245
245
|
*/
|
package/types/src/sha256.d.ts
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
/** The SHA-256 of `text`'s UTF-8 bytes, as 64 lower-case hex digits. */
|
|
2
2
|
export declare function sha256Hex(text: string): string;
|
|
3
|
+
/**
|
|
4
|
+
* SHA-256 over text fed in pieces, so a digest of a large serialization never needs the whole text in memory. Each
|
|
5
|
+
* piece is whole text: a surrogate pair split across two pieces encodes as two replacement characters.
|
|
6
|
+
*/
|
|
7
|
+
export declare class Sha256 {
|
|
8
|
+
#private;
|
|
9
|
+
update(text: string): this;
|
|
10
|
+
/** The digest of everything fed so far; the hash takes no piece after it. */
|
|
11
|
+
hex(): string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { MembershipCaller } from './membership';
|
|
2
|
+
/** The terminal declaration of a contract: the page on the application's own origin that identifies a person. */
|
|
3
|
+
export interface TerminalArtifact {
|
|
4
|
+
readonly identify: string;
|
|
5
|
+
}
|
|
6
|
+
/** The longest identification path a contract declares. */
|
|
7
|
+
export declare const MAX_TERMINAL_IDENTIFY_PATH_LENGTH = 200;
|
|
8
|
+
/** The query parameter IAM appends to the identification page: the identification's id. */
|
|
9
|
+
export declare const IDENTIFICATION_QUERY_PARAMETER = "identification";
|
|
10
|
+
/**
|
|
11
|
+
* Why `path` is not an identification page, or `null`: an absolute, canonical path on the application's own origin,
|
|
12
|
+
* with no query or fragment (IAM appends its own) and outside the platform's `/__fabrika`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function terminalIdentifyProblem(path: string): string | null;
|
|
15
|
+
/** Every identification operation carries the caller's verified credential: a public procedure's workload token. */
|
|
16
|
+
export type TerminalCaller = MembershipCaller;
|
|
17
|
+
/**
|
|
18
|
+
* Why IAM refused. `not_found` is an identification that is unknown, expired, consumed, cancelled, of another
|
|
19
|
+
* application, or whose terminal no longer lists the application: alike, so an id reveals nothing. `invalid_principal`
|
|
20
|
+
* is a principal that cannot sign in on a terminal: unknown, disabled, not a person, or external (ADR-0051).
|
|
21
|
+
*/
|
|
22
|
+
export type TerminalFailure = {
|
|
23
|
+
ok: false;
|
|
24
|
+
reason: 'missing_token' | 'invalid_token' | 'not_allowed' | 'not_found' | 'invalid_principal';
|
|
25
|
+
};
|
|
26
|
+
export type TerminalFailureReason = TerminalFailure['reason'];
|
|
27
|
+
/** The terminal an identification was opened on, as the token's `terminal` claim names it. */
|
|
28
|
+
export interface IdentificationTerminal {
|
|
29
|
+
id: string;
|
|
30
|
+
label: string;
|
|
31
|
+
}
|
|
32
|
+
/** Read an open identification: the id is the `identification` query parameter of the identification page. */
|
|
33
|
+
export interface InspectIdentificationInput extends TerminalCaller {
|
|
34
|
+
id: string;
|
|
35
|
+
}
|
|
36
|
+
/** `expiresAt` is unix seconds. The application keys its throttle of guesses on `terminal.id`. */
|
|
37
|
+
export type InspectIdentificationResult = {
|
|
38
|
+
ok: true;
|
|
39
|
+
terminal: IdentificationTerminal;
|
|
40
|
+
expiresAt: number;
|
|
41
|
+
} | TerminalFailure;
|
|
42
|
+
/**
|
|
43
|
+
* The application's word that `principalId` stands at the identification's terminal. IAM consumes the identification
|
|
44
|
+
* (single use), signs the person in under the terminal's ceiling, and answers the URL the browser goes to next: IAM's
|
|
45
|
+
* completion of the identification, which issues the handoff code only to the terminal's own browser. The application
|
|
46
|
+
* never holds a code.
|
|
47
|
+
*/
|
|
48
|
+
export interface AssertIdentityInput extends TerminalCaller {
|
|
49
|
+
id: string;
|
|
50
|
+
principalId: string;
|
|
51
|
+
}
|
|
52
|
+
export type AssertIdentityResult = {
|
|
53
|
+
ok: true;
|
|
54
|
+
completionUrl: string;
|
|
55
|
+
} | TerminalFailure;
|
|
56
|
+
/** End an identification the person abandoned. Repeating it, or cancelling a consumed one, answers `not_found`. */
|
|
57
|
+
export interface CancelIdentificationInput extends TerminalCaller {
|
|
58
|
+
id: string;
|
|
59
|
+
}
|
|
60
|
+
export type CancelIdentificationResult = {
|
|
61
|
+
ok: true;
|
|
62
|
+
} | TerminalFailure;
|
|
63
|
+
/**
|
|
64
|
+
* The identification operations IAM serves an application: on the membership transport (`/membership/<method>`) and
|
|
65
|
+
* on its application entrypoint. A SEPARATE interface from `IamMembershipRpc`, so a transport that predates terminals
|
|
66
|
+
* still satisfies that one.
|
|
67
|
+
*/
|
|
68
|
+
export interface IamTerminalRpc {
|
|
69
|
+
inspectIdentification(input: InspectIdentificationInput): Promise<InspectIdentificationResult>;
|
|
70
|
+
assertIdentity(input: AssertIdentityInput): Promise<AssertIdentityResult>;
|
|
71
|
+
cancelIdentification(input: CancelIdentificationInput): Promise<CancelIdentificationResult>;
|
|
72
|
+
}
|
package/types/src/token.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
2
|
+
* The IAM-issued token contract — the SECOND thing (after `IamRpc`) that must not drift
|
|
3
3
|
* between the Worker and the SDK.
|
|
4
4
|
*
|
|
5
5
|
* Background: today a request is authorized by the Worker resolving a Cloudflare Access JWT on
|
|
6
6
|
* every call over RPC (the CF token carries only identity, so authz needs a round-trip). When
|
|
7
|
-
*
|
|
7
|
+
* IAM issues its OWN token it can embed the already-resolved permission set, and the SDK
|
|
8
8
|
* authorizes LOCALLY — no per-request round-trip. This module is the wire shape of that token:
|
|
9
9
|
*
|
|
10
10
|
* - the Worker BUILDS claims here and signs them (`buildAccessClaims`);
|
|
@@ -38,14 +38,14 @@ export declare const FABRIKA_COOKIE_PREFIX = "__Host-px_";
|
|
|
38
38
|
* because those origins are potentially trustworthy.
|
|
39
39
|
*/
|
|
40
40
|
export declare const SESSION_COOKIE = "__Host-px_session";
|
|
41
|
-
/** Prefix marking
|
|
41
|
+
/** Prefix marking an IAM opaque credential (API key / share link), e.g. `Bearer px_<random>`. */
|
|
42
42
|
export declare const API_KEY_PREFIX = "px_";
|
|
43
43
|
/**
|
|
44
44
|
* Where a job or a webhook exchanges its own `px_` key for an access token at IAM's public origin: `POST` with the key
|
|
45
45
|
* as the bearer and `{ app }` as the body. IAM answers `MintFromKeyResult`, and only for a workload key of that app.
|
|
46
46
|
*/
|
|
47
47
|
export declare const WORKLOAD_TOKEN_PATH = "/auth/workload/token";
|
|
48
|
-
/** Signing algorithm
|
|
48
|
+
/** Signing algorithm IAM issues with and the SDK verifies (ECDSA P-256 — compact, ubiquitous). */
|
|
49
49
|
export declare const TOKEN_ALG = "ES256";
|
|
50
50
|
/** JWT `typ` of an OAuth resource access token (RFC 9068). Native app tokens carry no `typ`. */
|
|
51
51
|
export declare const RESOURCE_ACCESS_TOKEN_TYP = "at+jwt";
|
|
@@ -57,19 +57,27 @@ export declare const DEFAULT_TOKEN_TTL_SECONDS = 300;
|
|
|
57
57
|
*/
|
|
58
58
|
export declare const TOKEN_REFRESH_SKEW_SECONDS = 30;
|
|
59
59
|
/**
|
|
60
|
-
* The largest access token IAM signs, in bytes (a JWT is ASCII)
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
60
|
+
* The largest access token IAM signs, in bytes (a JWT is ASCII), except an application token below. A client sends
|
|
61
|
+
* such a token itself (an OAuth access token, a console bearer), so it crosses Caddy's `forward_auth` into the proxy's
|
|
62
|
+
* auth service and reaches installation services, which run on Bun with its default: a request's headers at most
|
|
63
|
+
* 16 KiB in total. 8 KiB leaves the rest for the request's own headers and cookies.
|
|
64
64
|
*/
|
|
65
65
|
export declare const MAX_ACCESS_TOKEN_BYTES = 8192;
|
|
66
66
|
/**
|
|
67
|
-
* The
|
|
67
|
+
* The largest token IAM mints for the proxy to inject toward a contract application, in bytes. No client sends it; on
|
|
68
|
+
* that hop it travels twice (`X-Fabrika-Token`, and `Authorization` on a bearer request), so two copies and 16 KiB of
|
|
69
|
+
* the request's own headers fit the header limit the platform starts the application's Bun with.
|
|
70
|
+
*/
|
|
71
|
+
export declare const MAX_APPLICATION_TOKEN_BYTES = 24576;
|
|
72
|
+
/** The request-header limit the platform starts an application's Bun server with (`--max-http-header-size`). */
|
|
73
|
+
export declare const APPLICATION_SERVER_MAX_HEADER_BYTES = 65536;
|
|
74
|
+
/**
|
|
75
|
+
* The IAM access token. `perms` is always present (matched via `permits`); `ptype` is present
|
|
68
76
|
* only when `sub` is a principal. `label` is the audit actor — the principal's label when bound, the
|
|
69
77
|
* credential label otherwise (or null).
|
|
70
78
|
*/
|
|
71
79
|
export interface AccessTokenClaims {
|
|
72
|
-
/** Issuer —
|
|
80
|
+
/** Issuer — IAM's own origin (e.g. `https://iam.example.com`). */
|
|
73
81
|
iss: string;
|
|
74
82
|
/** The app id this token is scoped to. The SDK REJECTS a token whose `aud` is not its app. */
|
|
75
83
|
aud: string;
|
|
@@ -101,11 +109,26 @@ export interface AccessTokenClaims {
|
|
|
101
109
|
* key carries what the key's own grants narrow, so a check that resolves the person's permissions requires this.
|
|
102
110
|
*/
|
|
103
111
|
session?: true;
|
|
112
|
+
/**
|
|
113
|
+
* Present only on a session token of a person an application asserted at an enrolled terminal (ADR-0067), and
|
|
114
|
+
* always together with `terminal`.
|
|
115
|
+
*/
|
|
116
|
+
amr?: TerminalAuthenticationMethod;
|
|
117
|
+
/** The terminal the person is signed in on; present exactly when `amr` is. */
|
|
118
|
+
terminal?: TerminalTokenClaims;
|
|
104
119
|
/** Present only on an OAuth resource token (`aud` is then a resource URI, not an app id). */
|
|
105
120
|
oauth?: OAuthTokenClaims;
|
|
106
121
|
/** Present only on a share-link token, which has no `ptype`: `sub` is then the link key's id. */
|
|
107
122
|
link?: LinkTokenClaims;
|
|
108
123
|
}
|
|
124
|
+
/** The `amr` value of a session an application asserted at a terminal. */
|
|
125
|
+
export declare const TERMINAL_AUTHENTICATION_METHOD = "terminal_assertion";
|
|
126
|
+
export type TerminalAuthenticationMethod = typeof TERMINAL_AUTHENTICATION_METHOD;
|
|
127
|
+
/** The terminal a person's session was asserted on: its principal id and the label an administrator gave it. */
|
|
128
|
+
export interface TerminalTokenClaims {
|
|
129
|
+
id: string;
|
|
130
|
+
label: string;
|
|
131
|
+
}
|
|
109
132
|
/** What a share-link token adds: the link mount that issued the key and the chain the key is bound to. */
|
|
110
133
|
export interface LinkTokenClaims {
|
|
111
134
|
mount: string;
|
|
@@ -155,7 +178,7 @@ export interface Jwks {
|
|
|
155
178
|
keys: PublicJwk[];
|
|
156
179
|
}
|
|
157
180
|
export interface AccessTokenParams {
|
|
158
|
-
/** Issuer (
|
|
181
|
+
/** Issuer (IAM origin). */
|
|
159
182
|
iss: string;
|
|
160
183
|
/** App id this token is for (becomes `aud`). */
|
|
161
184
|
app: string;
|
|
@@ -171,6 +194,8 @@ export interface AccessTokenParams {
|
|
|
171
194
|
email?: string;
|
|
172
195
|
/** Minted from a signed-in session; refused on a token without `type` or of a workload. */
|
|
173
196
|
session?: true;
|
|
197
|
+
/** The terminal of a person's session asserted on one; sets `amr` too, and requires a user `type` and `session`. */
|
|
198
|
+
terminal?: TerminalTokenClaims;
|
|
174
199
|
permissions: PermissionEntry[];
|
|
175
200
|
issuedAt: number;
|
|
176
201
|
expiresAt: number;
|
package/types/src/types.d.ts
CHANGED
|
@@ -22,8 +22,9 @@ export declare function isWorkloadKind(value: unknown): value is WorkloadKind;
|
|
|
22
22
|
* - 'grant' — explicit `grants` row
|
|
23
23
|
* - 'bootstrap' — IAM_BOOTSTRAP_ADMINS env match (resolution-time only)
|
|
24
24
|
* - `group:${groupRef}` — IdP group → role mapping (the `<org>/<team>` ref)
|
|
25
|
+
* - 'terminal' — a grant of the terminal a person is signed in on (ADR-0067)
|
|
25
26
|
*/
|
|
26
|
-
export type PermissionSource = 'grant' | 'bootstrap' | `group:${string}`;
|
|
27
|
+
export type PermissionSource = 'grant' | 'bootstrap' | 'terminal' | `group:${string}`;
|
|
27
28
|
/**
|
|
28
29
|
* A flat, app-owned scope coordinate — one dimension (`type`) and an opaque value.
|
|
29
30
|
* Dimensions are INDEPENDENT: there is NO hierarchy/containment between them.
|
|
@@ -33,6 +34,34 @@ export interface Scope {
|
|
|
33
34
|
type: string;
|
|
34
35
|
value: string;
|
|
35
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* The pseudo-scope of a relation entry: `{ type: '~rel', value: <relation> }` means the action is held where a row of
|
|
39
|
+
* the application names the principal in that relation. No dimension may start with `~`, so no reader that compares
|
|
40
|
+
* scopes by `(type, value)` mistakes one for a dimension value, and none resolves it but the framework.
|
|
41
|
+
*/
|
|
42
|
+
export declare const RELATION_SCOPE_TYPE = "~rel";
|
|
43
|
+
/**
|
|
44
|
+
* The pseudo-scope of a relation entry held inside one node: `{ type: '~relin', value: '<relation>:<dimension>:<node>' }`
|
|
45
|
+
* means the action is held where a row names the principal in that relation, on rows that lie inside `node` of
|
|
46
|
+
* `dimension`. IAM gives it a grant at that node of a role with `via`. Its own type, never `~rel`: a release that reads
|
|
47
|
+
* `~rel` as "the relation anywhere" ignores this one and reaches less.
|
|
48
|
+
*/
|
|
49
|
+
export declare const RELATION_INSIDE_SCOPE_TYPE = "~relin";
|
|
50
|
+
/** A relation held inside one node of a dimension, as a `~relin` entry names it. */
|
|
51
|
+
export interface RelationInside {
|
|
52
|
+
readonly relation: string;
|
|
53
|
+
readonly dimension: string;
|
|
54
|
+
readonly node: string;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* The `~relin` scope of `relation` inside `node` of `dimension`. A relation or dimension name never holds `:` (the
|
|
58
|
+
* contract's names do not), so the node, last, is read back verbatim, colons included; a name that holds one is refused.
|
|
59
|
+
*/
|
|
60
|
+
export declare function relationInsideScope(inside: RelationInside): Scope;
|
|
61
|
+
/** The relation, dimension and node of a `~relin` scope, or null for any other scope or a malformed value. */
|
|
62
|
+
export declare function parseRelationInside(scope: Scope): RelationInside | null;
|
|
63
|
+
/** A scope type no dimension, grant or key may name: IAM derives a `~` entry itself and never stores one. */
|
|
64
|
+
export declare function isReservedScopeType(type: string): boolean;
|
|
36
65
|
export interface PermissionEntry {
|
|
37
66
|
action: string;
|
|
38
67
|
/** null = global / all scopes */
|
|
@@ -69,6 +98,13 @@ export interface RoleDef {
|
|
|
69
98
|
};
|
|
70
99
|
/** An external principal may hold this membership role (ADR-0051). Only a membership role may declare it. */
|
|
71
100
|
external?: true;
|
|
101
|
+
/**
|
|
102
|
+
* Relation → exact actions. A GLOBAL grant of this role also carries `{ action, scope: { type: '~rel', value:
|
|
103
|
+
* relation } }`: the application holds the action where one of its rows names the principal in that relation. A
|
|
104
|
+
* grant at a node carries `~relin` instead (`relationInsideScope`): the relation holds only inside that node. Only an
|
|
105
|
+
* internal role declares it.
|
|
106
|
+
*/
|
|
107
|
+
via?: Record<string, string[]>;
|
|
72
108
|
}
|
|
73
109
|
/**
|
|
74
110
|
* One scope dimension an app exposes. IAM evaluates every value as a flat scope; `in` only tells IAM
|
|
@@ -131,7 +167,7 @@ export interface AppDelegationDef {
|
|
|
131
167
|
dimension: string;
|
|
132
168
|
purpose: 'members' | 'creates';
|
|
133
169
|
}
|
|
134
|
-
/** An app's full authz vocabulary, declared in the app's code, reconciled into
|
|
170
|
+
/** An app's full authz vocabulary, declared in the app's code, reconciled into IAM. */
|
|
135
171
|
export interface AppSchema {
|
|
136
172
|
scopes: AppScopeDef[];
|
|
137
173
|
actions: AppActionDef[];
|
|
@@ -165,6 +201,10 @@ export interface AppSchema {
|
|
|
165
201
|
};
|
|
166
202
|
/** `labels`: a holder of the app's `members.list` also sees each member's label. Absent, labels stay with `members.manage`. */
|
|
167
203
|
directory?: 'labels';
|
|
204
|
+
/** The app's identification page for a person at an enrolled terminal (ADR-0067); absent, no terminal lists it. */
|
|
205
|
+
terminal?: {
|
|
206
|
+
identify: string;
|
|
207
|
+
};
|
|
168
208
|
}
|
|
169
209
|
/**
|
|
170
210
|
* A job, a webhook or a public procedure (`public`, named by its endpoint id) of a contract application, or a consuming
|
package/types/src/wire.d.ts
CHANGED
|
@@ -51,6 +51,12 @@ export declare const FABRIKA_PROXY_SECRET = "FABRIKA_PROXY_SECRET";
|
|
|
51
51
|
* the name carries a digest of the id rather than the id.
|
|
52
52
|
*/
|
|
53
53
|
export declare function proxySecretVariable(id: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* The variable holding the secret the platform proxy sends IAM's installation entry in `PROXY_SECRET_HEADER`. The proxy
|
|
56
|
+
* and IAM hold it under this one name. It proves only who wrote IAM's request-id header; IAM keys every request without
|
|
57
|
+
* it on one shared client bucket.
|
|
58
|
+
*/
|
|
59
|
+
export declare const IAM_PROXY_SECRET_VARIABLE = "FABRIKA_INSTALLATION_PROXY_SECRET_IAM";
|
|
54
60
|
/**
|
|
55
61
|
* Every `X-Fabrika-*` name a proxy hop carries to an application. Caddy's first step and the Cloudflare proxy Worker
|
|
56
62
|
* delete each of them from the client's request before anything else, then set only what the decision asserts. A new
|